I have an ARM template to deploy/update the full Azure infrastructure for my application. Our build server should run the template, and add/update/delete resources that are add/changed/deleted. To make this work, I have chosen for the "Complete" deployment mode.
To test the ARM template, I have to following power shell script:
param(
$tenantId = "",
$subscriptionId = ""
)
Clear-Host
Login-AzureRmAccount -TenantId $tenantId -SubscriptionId $subscriptionId
New-AzureRmResourceGroupDeployment `
-Name "x" `
-ResourceGroupName "rg-test" `
-TemplateFile $PSScriptRoot/resource-template.json `
-TemplateParameterFile $PSScriptRoot/parameters-test.json `
-Mode Complete
This powershell script is only used to test the template, because a vsts release step will be responsible for the execution of the ARM template into the resource group.
We want to use 1 template to deploy everything (to keep it simple, just a Web Service plan and a web app service), but we have resources that doesn't need to be deployed in some environments. Different environments will use different pricing plans, and some of them will need a Deployment Slot, others won't (to save costs).
I have read about the nested templates, and at first it seemed to solve my problem... but it doesn't. I cannot use the nested templates in a "Complete deployment".
Does anyone know another way, to flag if a resource needs to be deployed or not, is not the "nested-template"-approach and works for the full deployment type?