繁体   English   中英

使用“ 1”作为参数调用“ Execute”的异常:“远程服务器返回错误:(400)错误的请求。”错误

[英]Getting Exception calling “Execute” with “1” argument(s): “The remote server returned an error: (400) Bad Request.” error

 param
 (
 $table, 
 [string] $SubscriptionName, 
 [string] $SubscriptionGuid, 
 [string] $date, 
 [string] $ResourceQtyConsumed,
 [string] $ResourceRate,
 [string] $ExtendedCost
 )

 $entity = New-Object -TypeName "Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity" #-ArgumentList $SubscriptionName,$SubscriptionGuid
 $entity.Properties.Add("subscription Name",$SubscriptionName)
 $entity.Properties.Add("subscriptionGuid",$SubscriptionGuid)
 $entity.Properties.Add("Date",$date)
 $entity.Properties.Add("resourceqtyconsumed",$ResourceQtyConsumed)
 $entity.Properties.Add("resourcerate",$ResourceRate)
 $entity.Properties.Add("extendedcost",$ExtendedCost)

 $result = $table.CloudTable.Execute([Microsoft.WindowsAzure.Storage.Table.TableOperation]::Insert($entity))

我收到了400错误的请求,试图将csv中的数据插入到Azure存储表中。

以下是我遇到的错误:

Exception calling "Execute" with "1" argument(s): "The remote server returned an error: (400) Bad Request."
At C:\kiran\powershell\Cost.ps1:76 char:2
+  $result = $table.CloudTable.Execute([Microsoft.WindowsAzure.Storage. ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : StorageException

经过研究,我知道这里有Rowkey和partition,但是我真的不确定在哪里添加它们。 我需要表中列出的列,但不需要分区或行键。

从Powershell插入来自Azure存储表的数据时,这正在发生。

Azure存储表需要分区键和行键 这就是建立数据结构的方式。 如果需要,可以为每个实体提供相同的分区键,并使用诸如subscriptionGuid类的键作为行键。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM