You may want to use a password in a template (let’s say user password of a VM or admin password of a SQL-server). Putting the password in your template, which is located in your source code repository, is not according to security guidelines.
One option to secure your strings would be to put them in KeyVault as a Secret and refer them from either paramters.json or in your main.json where it refer to a linked template.
First you need to set Azure Resource Manager for template deployment on checked within Access Policies of the keyvault where the template is refering to.
Deploying Templates
You could start a deployment right from the portal by adding a resource of type Template Deployment.
Another option would be using az CLI:
az deployment group create --resource-group newgrp1 --template-file main.json --parameters parameters.json
Or you could deploy it from your CD-pipeline locatedin Azure Devops.
Using Secured Secrets in Parameters.json
The following example refers to a secret called vmpassword within a keyvault called demovault10001 ie. located in newgrp1 resource group:
Similar to above example we can refer to a secured password by setting the keyvault id and the secret name. In the following example we use this to pass the adminPassword as a parameter to nested template.