Azure Table on Azure Automation
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?