Ready to get started?

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

 Download Now

Learn more:

Azure Data Catalog Icon Azure Data Catalog ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Azure Data Catalog.

Automate Azure Data Catalog Integration Tasks from PowerShell



Are you in search of a quick and easy way to access Azure Data Catalog data from PowerShell? This article demonstrates how to utilize the Azure Data Catalog Cmdlets for tasks like connecting to Azure Data Catalog data, automating operations, downloading data, and more.

The CData Cmdlets for Azure Data Catalog are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Azure Data Catalog.

PowerShell Cmdlets or ADO.NET Provider?

The Cmdlets are not only a PowerShell interface to Azure Data Catalog, but also an SQL interface; this tutorial shows how to use both to retrieve Azure Data Catalog data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Azure Data Catalog. To access Azure Data Catalog data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Azure Data Catalog.

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

You can optionally set the following to read the different catalog data returned from Azure Data Catalog.

    CatalogName: Set this to the CatalogName associated with your Azure Data Catalog. To get your Catalog name, navigate to your Azure Portal home page > Data Catalog > Catalog Name

Connect Using OAuth Authentication

You must use OAuth to authenticate with Azure Data Catalog. OAuth requires the authenticating user to interact with Azure Data Catalog using the browser. For more information, refer to the OAuth section in the help documentation.

PowerShell

  1. Install the module:

    Install-Module AzureDataCatalogCmdlets
  2. Connect:

    $azuredatacatalog = Connect-AzureDataCatalog
  3. Search for and retrieve data:

    $name = "FactProductInventory" $tables = Select-AzureDataCatalog -Connection $azuredatacatalog -Table "Tables" -Where "Name = `'$Name`'" $tables

    You can also use the Invoke-AzureDataCatalog cmdlet to execute SQL commands:

    $tables = Invoke-AzureDataCatalog -Connection $azuredatacatalog -Query 'SELECT * FROM Tables WHERE Name = @Name' -Params @{'@Name'='FactProductInventory'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.AzureDataCatalog.AzureDataCatalogConnection("InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the AzureDataCatalogDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT DslAddressDatabase, Type from Tables" $da= New-Object System.Data.CData.AzureDataCatalog.AzureDataCatalogDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.dsladdressdatabase $_.type }