【问题标题】:Powershell List all tables on Azure StoragePowershell 列出 Azure 存储上的所有表
【发布时间】:2016-12-06 14:37:41
【问题描述】:

我正在尝试从各种 Azure 存储上的表中自动执行查询。 每周都会自动生成不同名称的表格

我正在寻找一种方法来自动生成给定存储上可用表的列表,然后我可以使用foreach() 函数来查询每个表。

我在这里和那里看到了一些脚本,但无法获得有效的东西 例如:

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

【问题讨论】:

  • 是否有理由使用 REST API 而不是使用 Azure PowerShell Cmdlet 获取表列表?

标签: powershell azure


【解决方案1】:

要获取存储帐户中的表列表,您可以使用 Azure PowerShell Cmdlet。完全没有必要通过使用 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

【讨论】:

  • 对不起,我只看到关于您的帖子的电子邮件通知。谢谢你的回答
猜你喜欢
  • 2014-05-02
  • 2021-04-16
  • 2021-08-31
  • 2021-10-10
  • 2021-11-16
  • 1970-01-01
  • 2019-07-28
  • 2014-07-20
  • 2018-09-15
相关资源
最近更新 更多