首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >使用"1“参数调用"Execute”时出现异常:“远程服务器返回错误:(400)错误请求。”错误

使用"1“参数调用"Execute”时出现异常:“远程服务器返回错误:(400)错误请求。”错误
EN

Stack Overflow用户
提问于 2018-06-16 02:54:49
回答 1查看 661关注 0票数 0
代码语言:javascript
复制
 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存储表中。

下面是我得到的错误:

代码语言:javascript
复制
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存储表中插入数据时,会发生这种情况。

EN

回答 1

Stack Overflow用户

发布于 2018-06-16 03:38:04

Azure存储表require a partition key and row key。这就是数据结构的设置方式。如果您愿意,您可以为每个实体提供相同的分区键,并使用类似于您的subscriptionGuid的东西作为行键。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50881289

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档