Infrastructure as Code (IaC)
I am sure you have noticed by now that some projects have a weird infra/ directoy with some *.json files and a README.md.
Currently, we are using ARM templates with plans to migrate to Terraform with the AzAPI Terraform provider.
Schemas
The schemas used are the following:
azuredeploy.json: schemas/2019-04-01/deploymentTemplate.jsonparameters.**.json: schemas/2019-04-01/deploymentParameters.json
Notice we use the
2019-04-01schema for both.
Structure
- <Project-name>/
|- <Project-name>.csproj
|- infra/
| |- azuredeploy.json
| |- parameters.dev.json
| |- parameters.prod.json
| |- ... <immediate dependencies>
|- ... <the project's source code>
Parameters
Regarding the parameters' files, the naming convention is simple:
parameters.(<project-name>.)<environment>.json
E.g.
parameters.dev.jsonparameters.talos.dev.json
Usage
-
Make sure you are logged in to the correct tenant/subscription.
az login -
Go to the project's
infra/directory inside of a terminal.cd <Project's path> -
Deploy the script.
az deployment group create --resource-group <resource-group> --template-file infra/azuredeploy.json --parameters 'infra/parameters.<environment>.json'