使用Powershell为Stream Analytics创建blob存储输出时出错

时间:2017-02-07 10:42:48

标签: powershell azure azure-storage-blobs azure-powershell azure-stream-analytics

我正在尝试使用PowerShell创建Stream Analytics blob存储输出。 这是我正在使用的命令:

New-AzureRMStreamAnalyticsOutput -ResourceGroupName $ResourceGroupName -JobName $JobName –File soutput.json" -Force

并且output.json文件如下所示:

{
  "name":  "test",
  "properties":  {
    "datasource":  {
        "type":  "Microsoft.Storage/Blob",
            "properties":  {
                "storageAccounts":  ["testStorage"],
                "container":  "testContainer",
                "pathPattern":  "",
                "accountName":  "testStorage",
                "accountKey":  "storage-key"
            }
        }
    }
}

我收到了这个错误:

New-AzureRMStreamAnalyticsOutput : HTTP Status Code: BadRequest
Error Code: BadRequest
Error Message: The JSON provided in the request body is invalid. 
Error converting value "testStorage" to type 'Microsoft.Streaming.Service.Contracts.CSMResourceProvider.BlobConnectionInfo'. 
Path 'properties.storageAccounts[0]', line 8, position 106.

storageAccounts属性应该包含哪些内容?

1 个答案:

答案 0 :(得分:3)

  

storageAccounts属性应该包含哪些内容?

我们需要设置storageAccounts属性:

 "StorageAccounts": [
                     {
                         "AccountKey": "storagekey",
                          "AccountName": "storageaccount"
                     }
                    ]

属性“Serialization”需要包含在输出json文件中。请尝试使用output.json文件,如下所示。它适用于我。

{
   "Name": "S3PSAJobOutPut",
   "Properties": {
                    "DataSource": {
                    "Properties": {
                    "Container": "s3psaoutput",
                    "PathPattern": "",
                    "StorageAccounts": [
                     {
                         "AccountKey": "storagekey",
                          "AccountName": "storageaccount"
                     }
                            ]
                  },
                  "Type": "Microsoft.Storage/Blob"
                  },
                  "Serialization": {
                          "Properties": {
                            "Encoding": "UTF8",
                            "Format": "LineSeparated"
                          },
                          "Type": "Json"
                        }

                  }
}

enter image description here