Automate Asana Integration Tasks from PowerShell

Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Are you in search of a quick and easy way to access Asana data from PowerShell? This article demonstrates how to utilize the Asana Cmdlets for tasks like connecting to Asana data, automating operations, downloading data, and more.

The CData ADO.NET Provider for Asana is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Asana.

ADO.NET Provider

The ADO.NET Provider provides a SQL interface for Asana; this tutorial shows how to use the Provider to retrieve Asana data.

Once you have acquired the necessary connection properties, accessing Asana data in PowerShell can be enabled in three steps.

You can optionally set the following to refine the data returned from Asana.

  • WorkspaceId: Set this to the globally unique identifier (gid) associated with your Asana Workspace to only return projects from the specified workspace. To get your workspace id, navigate to https://app.asana.com/api/1.0/workspaces while logged into Asana. This displays a JSON object containing your workspace name and Id.
  • ProjectId: Set this to the globally unique identifier (gid) associated with your Asana Project to only return data mapped under the specified project. Project IDs can be found in the URL of your project's Overview page. This will be the numbers directly after /0/.

Connect Using OAuth Authentication

You must use OAuth to authenticate with Asana. OAuth requires the authenticating user to interact with Asana using the browser. See the "Getting Started" chapter of the help documentation for a guide to using OAuth.

  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Asana\lib\System.Data.CData.Asana.dll")
  2. Connect to Asana:

    $conn= New-Object System.Data.CData.Asana.AsanaConnection("OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;CallbackURL='http://localhost:33333';InitiateOAuth=GETANDREFRESH;")
    $conn.Open()
  3. Instantiate the AsanaDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Id, WorkspaceId from projects"
    
    $da= New-Object System.Data.CData.Asana.AsanaDataAdapter($sql, $conn)
    $dt= New-Object System.Data.DataTable
    $da.Fill($dt)
    
    $dt.Rows | foreach {
        Write-Host $_.id $_.workspaceid
    }

Ready to get started?

Download a free trial of the Asana Data Provider to get started:

 Download Now

Learn more:

Asana Icon Asana ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Asana data including Project, Tasks, Teams, Users, and more!