简体   繁体   中英

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

I'm trying to create a Stream Analytics blob storage output using powershell. This is the command I'm using:

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

and the output.json file looks like this:

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

And I'm getting this error:

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.

What should be in the storageAccounts property?

What should be in the storageAccounts property?

We need to set storageAccounts property:

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

Property " Serialization " need to be included in the output json file.Please have a try to use output.json file as following. It works correctly for me.

{
   "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"
                        }

                  }
}

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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