![](/img/trans.png)
[英]Trying to inject powershell commands in to Azure RM VMs via JSON template Custom Extension
[英]How to pass multiple parameters into an Azure RM Template Custom Script Extension
我正在嘗試使用 ARM 模板將多個參數傳遞給自定義腳本擴展,這是 ARM 模板的片段,目前可以正常工作:
{
"name": "Microsoft.CustomScriptExtension-20210604105657",
"apiVersion": "2015-01-01",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "incremental",
"templateLink": {
"uri": "https://catalogartifact.azureedge.net/publicartifactsmigration/Microsoft.CustomScriptExtension-arm.2.0.56/Artifacts/MainTemplate.json"
},
"parameters": {
"vmName": {
"value": "real-vm-name"
},
"location": {
"value": "uksouth"
},
"fileUris": {
"value": "https://realwebsite/script.ps1"
},
"arguments": {
"value": "[parameters('param1')]"
}
}
},
但是,每當我向 arguments 部分添加另一個參數時,模板驗證都會失敗。 這是我試圖做的:
"arguments": {
"value": "[parameters('param1')], [parameters('param2')]"
}
請問有人可以幫忙嗎?
您可以嘗試根據您使用的參數來連接或格式化參數,如下所示:
"value": "[concat(parameters('param1'), parameters('param2'))]"
"value": "[format(parameters('param1'), parameters('param2'))]"
我提到的 Azure 文檔:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.