Question:
I have created an ARM template to deploy a service with a set of application settings.
One of my parameters in the ARM template does not have a default value.
At present, when I run the deployment script using ISE I am asked “Supply values for the following parameters:” (a request for human input).
This is fine but this script will be automated. How do I pipe this dynamic variable into this field?
ARM:
1 2 3 4 5 6 7 8 9 |
"Paramters":{ "dynamicParam": { "type": "string", "metadata": { "description": "dont know this until deployment" } } } |
The deployment powershell is boiler plate.
Answer:
There are several ways to do that, easiest one is this:
1 2 |
New-AzureRmResourceGroupDeployment ... -dynamicParam value |
another one (which is cooler) is to create a hash table with the values of parameters you have and splat it against the cmdlet:
1 2 3 4 5 6 |
$params = @{ paramA = "test" paramB = "anotherTest" } New-AzureRmResourceGroupDeployment ... @params |
Another way is to preprocess the json parameters file and pass it to the deployment