powershell - 如何使用 PowerShell 在 Azure 存储表中获取行?

标签 powershell azure azure-storage azure-table-storage

我正在尝试使用这些 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/

相关文章:

powershell - 从 Powershell 使用 native CMD 命令时的编码问题

powershell - PowerShell反射:将MIME类型或子类型定义为脚本的输出类型

python - 保留 Azure Batch 的输出文件时出现 FileUploadMiscError

.net - WindowsAzure.Storage v2 StorageException

windows - Windows : how to read Unicode input from console? 上的 GHCi

azure - 为什么每次我在 CosmosDB 文档资源管理器中查询 SELECT count(1) FROM c 时,它的值都会更改?

excel - 将 Azure Blob 存储连接到 Grafana

c# - 尝试在 c# 中上传到 Azure 时出现 400(未指定此请求必需的 HTTP header 。)

azure - 使用 Python Sdk 识别没有任何资源(例如表、容器)的存储帐户

python - 如何在 anaconda 提示符下运行 powershell 脚本?