我正在尝试使用这些 PoserShell 命令获取 Azure 存储表中的所有行:
$saContext = (AzureRmStorageTable\Get-AzureRmStorageAccount -Name $storageAccount -ResourceGroupName $resourceGroup).Context
$table = Get-AzureStorageTable -Name $tableName -Context $saContext
Get-AzureStorageTableRowAll -table $table
但它会返回此错误:
Cannot find an overload for "ExecuteQuery" and the argument count: "1".
At C:\Program Files\WindowsPowerShell\Modules\AzureRmStorageTable\1.0.0.17\AzureRmStorageTableCoreHelper.psm1:305 char:6
+ $result = $table.CloudTable.ExecuteQuery($tableQuery)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
我什至也使用了这些命令行,但所有命令都会返回相同的错误:
#Get-AzureStorageTableRowByColumnName -columnName "Average" -operator Equal -table $table -value 3228132966.4
#Get-AzureStorageTableTable -resourceGroup $resourceGroup -storageAccountName $storageAccount -tableName $tableName
#Get-AzureStorageTableRowAll -table $table | ft
#Get-AzureStorageTableRowByPartitionKey -table $table –partitionKey “I-Used-One-Of-My-Partition-Keys-From-Table” | ft
你知道如何使用 PowerShell 在 Azure 存储表中获取一行吗?
事实上,我已经从 here 安装了 AzureRmStorageTable
.
最佳答案
这是如何使用新的 Az 命令获取所有行的答案,需要 AzTable 模块。
$storageAccountName = "name"
$storageAccountKey = "key=="
$context = New-AzStorageContext $storageAccountName -StorageAccountKey $storageAccountKey
$cloudTable = (Get-AzStorageTable –Name "table_name" –Context $context).CloudTable
Get-AzTableRow -Table $cloudTable
使用过滤器检索行:
[string]$filter = "Timestamp lt datetime'2019-05-27T13:58:04.0587693+02:00'"
Get-AzTableRow -Table $cloudTable -CustomFilter $filter
来自 Azure 的更多文档 https://learn.microsoft.com/bs-latn-ba/azure/storage/tables/table-storage-how-to-use-powershell
关于powershell - 如何使用 PowerShell 在 Azure 存储表中获取行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46836512/