简体   繁体   中英

How to pass multiple parameters into an Azure RM Template Custom Script Extension

I am trying to pass multiple parameters to a Custom Script Extension using an ARM template, here is a snippet of the ARM template that currently works without issue:

{
            "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')]"
                    }
                }
            },

But whenever I add another parameter to the arguments section, the template validation fails. This is what I have tried to do:

                        "arguments": {
                            "value": "[parameters('param1')], [parameters('param2')]"
                        }

Please can somebody help?

Can you try to concat or format the parameters depending on what parameters you're using like this:

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

The Azure doc I referred to:

ARM Deployment Scripts

Concat function for ARM templates

Format function for ARM templates

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM