使用 Powershell 为流分析创建 blob 存储输出时出错

Error when creating a blob storage output for Stream Analytics using Powershell

我正在尝试使用 powershell 创建流分析 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 中应该包含什么 属性?

What should be in the storageAccounts property?

我们需要设置 storageAccounts 属性:

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

属性 "Serialization" 需要包含在输出中 json file.Please 尝试使用 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"
                        }

                  }
}