【发布时间】:2017-07-06 09:06:31
【问题描述】:
我正在尝试在 powershell 脚本中覆盖模板参数文件中的一些属性,然后将对象传递给 Test-AzureRmResourceGroupDeployment cmdlet 以对其进行测试。以下作品;
Test-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile 'template.json' -TemplateParameterFile 'parameters.json'
但是,当我加载参数并传递对象时,它不起作用;
$params = Get-Content 'parameters.json' | Out-String | ConvertFrom-Json | ConvertPSObjectToHashtable
Test-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile 'template.json' -TemplateParameterObject $params.parameters
ConvertPSObjectToHashtable 函数是我得到的一个 from here。
当我运行第二个命令时,出现以下错误;
Code : InvalidTemplate
Message : Deployment template validation failed: 'The provided value for the template parameter 'location' at line '7' and column '22' is not valid.'.
Details :
为什么不接受参数对象,我该如何解决?
【问题讨论】:
标签: powershell azure powershell-cmdlet