json - 从json读取时发生Powershell错误:属性 'dateFormat'值 'YYYY-MM-DD' Not Acceptable

标签 json powershell azure-storage-blobs azure-stream-analytics azure-iot-hub

我正在运行一个Powershell(第5版)脚本,该脚本使用json模板在Azure IOT-HUB帐户中构建streamAnalytics作业。
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://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

关于json - 从json读取时发生Powershell错误:属性 'dateFormat'值 'YYYY-MM-DD' Not Acceptable ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44484296/

相关文章:

powershell - 为什么我的脚本无法运行?

regex - Azure容器名称RegEx

.net - 如何在 Windows Azure 存储上查询 Cloud Blob

javascript - 从 Reddit 的 API 中检索评论

java - 如何禁用 Jersey 的 JacksonJsonProvider 自动注册以便我使用自己的?

python - 将 JSON 值添加到列表中

powershell - 在 PowerShell 中,有没有办法处理 Send-MailMessage 资源?

c# - 将枚举序列化为字符串时,是否可以添加新的枚举成员而不破坏与 Newtonsoft json 的契约(Contract)?

powershell - 如何让 PowerShell 不将 # 视为注释的开头?

azure-sql-database - Azure Blob存储的事务访问