Automate Azure Table Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Azure ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with live Azure Table Storage data!

Are you looking for a quick and easy way to access Azure Table data from PowerShell? We show how to use the Cmdlets for Azure Table and the CData ADO.NET Provider for Azure Table to connect to Azure Table data and synchronize, automate, download, and more.

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

Cmdlets or ADO.NET?

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

After obtaining the needed connection properties, accessing Azure Table data in PowerShell consists of three basic steps.

Specify your AccessKey and your Account to connect. Set the Account property to the Storage Account Name and set AccessKey to one of the Access Keys. Either the Primary or Secondary Access Keys can be used. To obtain these values, navigate to the Storage Accounts blade in the Azure portal. You can obtain the access key by selecting your account and clicking Access Keys in the Settings section.


  1. Install the module:

    Install-Module AzureTablesCmdlets
  2. Connect:

    $azuretables = Connect-AzureTables -AccessKey "$AccessKey" -Account "$Account"
  3. Search for and retrieve data:

    $shipcity = "New York" $northwindproducts = Select-AzureTables -Connection $azuretables -Table "NorthwindProducts" -Where "ShipCity = `'$ShipCity`'" $northwindproducts

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

    $northwindproducts = Invoke-AzureTables -Connection $azuretables -Query 'SELECT * FROM NorthwindProducts WHERE ShipCity = @ShipCity' -Params @{'@ShipCity'='New York'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.AzureTables.AzureTablesConnection("AccessKey=myAccessKey;Account=myAccountName;") $conn.Open()
  3. Instantiate the AzureTablesDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Name, Price from NorthwindProducts" $da= New-Object System.Data.CData.AzureTables.AzureTablesDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $ $_.price }

Update Azure Table Data


Update-AzureTables -Connection $AzureTables -Columns @('Name','Price') -Values @('MyName', 'MyPrice') -Table NorthwindProducts -Id "MyId"


$cmd = New-Object System.Data.CData.AzureTables.AzureTablesCommand("UPDATE NorthwindProducts SET ShipCity='New York' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.AzureTables.AzureTablesParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert Azure Table Data


Add-AzureTables -Connection $AzureTables -Table NorthwindProducts -Columns @("Name", "Price") -Values @("MyName", "MyPrice")


$cmd = New-Object System.Data.CData.AzureTables.AzureTablesCommand("INSERT INTO NorthwindProducts (ShipCity) VALUES (@myShipCity)", $conn) $cmd.Parameters.Add(new System.Data.CData.AzureTables.AzureTablesParameter("@myShipCity","New York")) $cmd.ExecuteNonQuery()

Delete Azure Table Data


Remove-AzureTables -Connection $AzureTables -Table "NorthwindProducts" -Id "MyId"


$cmd = New-Object System.Data.CData.AzureTables.AzureTablesCommand("DELETE FROM NorthwindProducts WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.AzureTables.AzureTablesParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()