![]() |
VOOZH | about |
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.
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.
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.
Install the module:
Install-Module AzureDataCatalogCmdlets
Connect:
$azuredatacatalog = Connect-AzureDataCatalog -InitiateOAuth "$InitiateOAuth"
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'}
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")
Connect to Azure Data Catalog:
$conn= New-Object System.Data.CData.AzureDataCatalog.AzureDataCatalogConnection("InitiateOAuth=GETANDREFRESH;")
$conn.Open()
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
}
Download a free trial of the Azure Data Catalog Data Provider to get started:
Download NowLearn more:
👁 Azure Data Catalog IconRapidly create and deploy powerful .NET applications that integrate with Azure Data Catalog.