Hari CR
Hari CR

Reputation: 43

How do I pass multiple parameter file in a power shell

I am trying to deploy an ARM template.

here are the template and parameters file path:

 [string]
 $templateFilePath = "C:\Users\Desktop\template_abc.json",

 [string]
 $parametersFilePath = "C:\Users\Desktop\parameters_xyz.json"
)

Deployment commands:

Write-Host "Starting deployment...";
if(Test-Path $parametersFilePath) {
    New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath -TemplateParameterFile $parametersFilePath;
} 

else {
    New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath;
}

I want to add one more parameter file to my deployment, like : parameters_lmn.json, how can I accommodate both xyz and lmn parameter file in a single deployment?

Upvotes: 2

Views: 1934

Answers (1)

EmFl
EmFl

Reputation: 43

You could use https://powersnippets.com/join-object/ to merge the two json object. You'll need to decide which parameter file overwrites the other in case both define the same parameter.

Upvotes: 3

Related Questions