0
votes
 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))

I am getting the 400 bad request, I am trying to insert data from csv to the azure storage table.

Below is the error I am getting:

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

After research I got to know there is Rowkey and partition, but I am really not sure where to add those. I need the listed columns in my table but not partition or Row key.

While inserting data from azure storage table from powershell this is happening.

1

1 Answers

0
votes

Azure Storage tables require a partition key and row key. That is how the data structure is set up. If you want, you could give the same partition key for each entity, and use something like your subscriptionGuid as the row key.