从 json 读取时出现电源外壳错误:属性'dateFormat'值'YYYY-MM-DD'是不可接受的



我正在运行一个powershell(版本5(脚本,该脚本使用json模板在Azure IOT-HUB帐户中构建streamAnalytics作业。流分析 json 文件将存储 blob 定义为输出,具有以下属性:

 "outputs":  [
{
    "Name":  "iotstreamingoutput",
    "Properties":  {
    "DataSource":  {
    "Properties":  {
      "Container":  "outputblob",
      "PathPattern":  "{date}/{time}",
      "DateFormat":  "YYYY-MM-DD",
      "TimeFormat":  "HH",
      "StorageAccounts":  [
          {
              "AccountKey":  "xxxxx"
              "AccountName":  "accountName"
          }
                      ]
     },
   "Type":  "Microsoft.Storage/Blob"
},
"Serialization":  {
      "Properties":  {
                         "Encoding":  "UTF8",
                         "Format":  "Array"
                     },
      "Type":  "Json"
              }
   }
 }
]

此 PowerShell 脚本运行以下命令:

New-AzureRmResourceGroupDeployment 
  -ResourceGroupName $IotHubResourceGroupName 
  -TemplateFile templateStreamAnalytics.json 
  -TemplateParameterFile parametersStreamAnalytics.json

但是当我运行脚本时,它会返回此错误:

*'StreamAnalyticsJob' failed with message '{
  "code": "BadRequest",
  "message": "**The JSON provided in the request body is invalid. Property 'dateFormat' value 'YYYY-MM-DD' is not
acceptable.",**
  "details": {
    "code": "400"

有人可以帮助我了解为什么会发生此错误吗?

您已经定义了分钟而不是月,请尝试使用"yyyy-MM-dd"。

参考 https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

最新更新