我正在运行一个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/