如何将多个参数传递到 Azure RM 模板自定义脚本扩展

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": {
                            "value": "[parameters('param1')], [parameters('param2')]"
                        }

有人可以帮忙吗?

您能否尝试根据您使用的参数来连接或格式化参数,如下所示:

 "value": "[concat(parameters('param1'), parameters('param2'))]"
 "value": "[format(parameters('param1'), parameters('param2'))]"

我参考的 Azure 文档:

ARM Deployment Scripts

Concat function for ARM templates

Format function for ARM templates