Reputation: 11
I am trying to automate a query from tables on various Azure
Storages.
The tables are automatically generated with a different name every week
I am looking for a way to automatically generate a list of the tables available on a given storage and then I can use the foreach()
function to query each table.
I've seen a few bits of scripts here and there but cannot get something effective for example:
$response = Invoke-WebRequest -Uri 'https://MyAccountName.table.core.windows.net/Tables/'
[xml]$tables = $response.Content
$tableNames = $tables.feed.entry.content.properties.TableName
Upvotes: 1
Views: 1501
Reputation: 136196
To fetch the list of tables in your storage account you can use Azure PowerShell Cmdlets. There's absolutely no need to do it via consuming REST API. The Cmdlet you would want to use is Get-AzureStorageTable
.
Here's a sample code:
$StorageAccountName = "your storage account name"
$StorageAccountKey = "your storage account key"
$ctx = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey
Get-AzureStorageTable -Context $ctx
Upvotes: 2