テンプレートパラメータファイルのいくつかのプロパティをpowershellスクリプトでオーバーライドし、そのオブジェクトをTest-AzureRmResourceGroupDeployment
コマンドレットに渡してテストしようとしています。以下の作品。Test-AzureRmResourceGroupDeploymentはTemplateParameterFileでは使用できますが、TemplateParameterObjectでは使用できません
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を得たものです。
2番目のコマンドを実行すると、次のエラーが発生します。
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 :
なぜパラメータオブジェクトを受け入れないのですか?どのように修正しますか?
ああ。ヒントをありがとう。残念ながら、 '-TemplateParameterObject'はあまりよく書かれていません。キーボルトの秘密への参照として渡されるパスワードには、あなたの提案が機能しない可能性があります。私はいつも試してみることができます。 – Steztric