找不到“的重载”;执行;并且参数计数为:“quot;“1”;。无法插入azure存储表
我有一个powershell脚本将数据上载到azure存储表。Powershell脚本如下所示:找不到“的重载”;执行;并且参数计数为:“quot;“1”;。无法插入azure存储表,azure,powershell,azure-storage,azure-table-storage,azure-powershell,Azure,Powershell,Azure Storage,Azure Table Storage,Azure Powershell,我有一个powershell脚本将数据上载到azure存储表。Powershell脚本如下所示: $StorageAccountName = "xxx" $StorageAccountKey = "xxxxx" $ctx = New-AzStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey $tableName = "ProvisioningRecord" $t
$StorageAccountName = "xxx"
$StorageAccountKey = "xxxxx"
$ctx = New-AzStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey
$tableName = "ProvisioningRecord"
$table = Get-AzStorageTable –Name $tableName -Context $ctx
Add-Entity -table $table -partitionKey abc -rowKey xyz
function Add-Entity {
[CmdletBinding()]
param(
$table,
[String]$partitionKey,
[String]$rowKey
)
$entity = New-Object -TypeName "Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity" -ArgumentList $partitionKey, $rowKey
$result = $table.CloudTable.Execute([Microsoft.WindowsAzure.Storage.Table.TableOperation]::Insert($entity))
}
我得到一个错误:
Cannot find an overload for "Execute" and the argument count: "1".
At line:1 char:1
+ $result = $table.CloudTable.Execute([Microsoft.WindowsAzure.Storage.T ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
以下链接:我添加了
这给了我一个错误:
New-Object : Cannot find type [Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity,Microsoft.Azure.Cosmos.Table, Version=0.10.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]:
verify that the assembly containing this type is loaded.
At line:1 char:11
+ $entity = New-Object -TypeName "Microsoft.WindowsAzure.Storage.Table. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
但经过上述修改(添加$assemblySN)的相同代码在Powershell版本5.1.17134.590中也适用。相同的脚本在Powershell版本5.1.17763.316中不起作用
有人能帮我吗?您使用哪种版本的Az.存储模块?(运行Get模块进行检查) 从Az.Storage 1.1.0开始,表由Microsoft.Azure.Cosmos.table SDK管理。(因为新的存储客户端库不再支持表。) 因此Azure表对象的命名空间从“Microsoft.WindowsAzure.Storage.Table”更改为“Microsoft.Azure.Cosmos.Table”。您需要相应地更改脚本中的名称空间 请参阅中的更多详细信息
New-Object : Cannot find type [Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity,Microsoft.Azure.Cosmos.Table, Version=0.10.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]:
verify that the assembly containing this type is loaded.
At line:1 char:11
+ $entity = New-Object -TypeName "Microsoft.WindowsAzure.Storage.Table. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand