Azure Table on Azure Automation

Manso 6 Reputation points
2022-06-29T12:08:51.563+00:00

We're trying to perform Azure Table data operations from Azure Automation. Currently using Powershell 7.1 and have installed module AzTable. The following works:

$azureContext = (Connect-AzAccount -Identity).context  
$azureContext = Set-AzContext -SubscriptionName $azureContext.Subscription -DefaultProfile $azureContext  
$storageContext = New-AzStorageContext -StorageAccountName $storageAccount  
  
$table = (Get-AzStorageTable -Name $tableName -Context $storageContext).CloudTable  

But when trying a data operation such as

Add-AzTableRow -Table $table -partitionKey "1" -rowKey ("key1") -property @{"prop1"="test1";"prop2"="test2"}  

We end up with exceptions such as

MethodInvocationException: C:\ModulesV2\User\AzTable\AzureRmStorageTableCoreHelper.psm1:266 Line | 266 | … return ($Table.Execute([Microsoft.Azure.Cosmos.Table.TableOperat … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Exception calling "Execute" with "1" argument(s): "The specified resource does not exist."

We will try to use $table.ExecuteBatch() but that also fails. We're missing some dependencies but can't figure out which. This is a vanilla Azure Automation account we just created.

Should this be supported?

Azure Table Storage
Azure Table Storage
An Azure service that stores structured NoSQL data in the cloud.
156 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,124 questions
{count} vote