2016-08-01 30 views
0

我试图自动化各种Azure存储上的表格查询。 该表由每周Powershell列出Azure存储上的所有表格

我正在寻找一种方法来自动生成一个给定的可用存储空间的表的列表,然后我可以使用foreach()功能来查询每个表不同的名称自动生成。

我已经看到了在这里和那里的脚本的几个位,但不能得到的东西有效 例如:

$response = Invoke-WebRequest -Uri 'https://MyAccountName.table.core.windows.net/Tables/' 
[xml]$tables = $response.Content 
$tableNames = $tables.feed.entry.content.properties.TableName 
+0

是否有使用REST API,而不是获取使用Azure的PowerShell命令表列出的理由? –

回答

0

要在您的存储账户取表的列表,你可以使用Azure的PowerShell命令。绝对不需要通过使用REST API来完成。你想要使用的Cmdlet是Get-AzureStorageTable

下面是一个示例代码:

$StorageAccountName = "your storage account name" 
$StorageAccountKey = "your storage account key" 
$ctx = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey 
Get-AzureStorageTable -Context $ctx 
+0

对不起,我只看到关于你帖子的电子邮件通知。 我感谢你的回答 – FredL