How add AppSettings and AuthSettings at ARM template
Today I’ll talk how can add AppSettings and AuthSettings at ARM template.
You should know that when trying export ARM template by the azure portal, some configurations not come together, goes just basic information.
How can add manually?
First, we need get this values dynamic and we can do it using power shell or the portal Resource (https://resources.azure.com/)
Here can get configs values without code or knowledge in power shell.
Or if enjoyed can use power shell and get the values using Azure CLI
like this example bellow,
Invoke-AzResourceAction -ResourceGroupName "RG-TESTE" -ResourceType Microsoft.Web/sites/config -ResourceName "MyAPP/appsettings" -Action list -ApiVersion 2020-12-01 -Force
Look, is important give attention to param ResourceName, here I passed the name and the config that I want get, appsettings.
Adding appSettings to ARM template
let’s see how can update the arm template easily adding appSettings
- Export the ARM template by the portal
- Open the file template.json in your favorite IDE
- search for siteConfig
4. Add appSettings property to this object.
Good job!
You get!, It’s a cool way to your add the appsettings to the ARM template.
Add AuthSettings to ARM template
- Get the JSON config value on the resource portal or by power shell
- Past just the property values on the properties in this code above and replace another params with right value
{"type": "Microsoft.Web/sites/config","apiVersion": "2022-03-01","name": "[concat(parameters('<YOUR PARAM SITE NAME HERE>'), '/authsettings')]","location": "<YOUR LOCATION HERE>","dependsOn": ["[resourceId('Microsoft.Web/sites', parameters('<YOUR PARAM SITE NAME HERE>'))]"],"properties": {<PAST THE PROPERTIES HERE>}}
3. Go to template.json and past it code in the resource properties
Good job!
This is a of way that you can add configuration to the ARM template.