Automate deployment of resources using ARM templates or Bicep
📘Microsoft Certified: Azure Administrator Associate (AZ-104)
1. What Does “Deploy Resources Using ARM or Bicep” Mean?
When you deploy using ARM or Bicep, you use a file that defines:
- What resources to create
- What their settings should be
- Which locations to use
- Names, SKU sizes, tags, networking options, etc.
You do not click through the Azure portal manually.
Deployment becomes:
✔ repeatable
✔ error-free
✔ consistent across environments
✔ version-controlled
2. Deployment Models in Azure
Azure offers several deployment scopes using ARM/Bicep:
| Scope | What you can deploy | Notes |
|---|---|---|
| Resource Group | Most Azure resources (VM, storage, VNet, NIC, etc.) | Most common deployment scope |
| Subscription | Policies, role assignments, resource groups | Uses az deployment sub create |
| Management Group | Policies, role assignments, multiple subscriptions | For large organizations |
| Tenant | Identity & Azure AD–related resources | Least common |
3. Deploy Using ARM Templates
ARM templates use JSON syntax. They include sections such as:
$schemacontentVersionparametersvariablesresourcesoutputs
3.1 Ways to Deploy an ARM Template
a) Azure Portal
- Upload or paste the template into the “Deploy a custom template” page.
- Provide parameter values.
- Deploy into a resource group or subscription.
b) Azure CLI
Most frequently tested on AZ-104.
Deploy to a resource group
az deployment group create \
--resource-group MyRG \
--template-file template.json \
--parameters parameters.json
Important exam notes:
- Use
az deployment group createfor resource-group deployments. - If using parameter files: use
--parameters @parameters.json.
c) Azure PowerShell
New-AzResourceGroupDeployment `
-ResourceGroupName MyRG `
-TemplateFile template.json `
-TemplateParameterFile parameters.json
PowerShell command begins with:
New-AzResourceGroupDeployment → must remember for exam.
4. Deploy Using Bicep Files
Bicep is a higher-level language that simplifies ARM.
A Bicep file is clean and readable, for example:
resource stg 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'stgaccount01'
location: resourceGroup().location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
}
4.1 Deploy Bicep with Azure CLI
az deployment group create \
--resource-group MyRG \
--template-file main.bicep \
--parameters storageName=stgaccount01
4.2 Deploy Bicep with PowerShell
New-AzResourceGroupDeployment `
-ResourceGroupName MyRG `
-TemplateFile main.bicep `
-storageName stgaccount01
Same commands as ARM template deployments—Azure automatically converts Bicep to ARM internally.
5. Deployment Parameters
Parameters allow templates to be reusable.
You can pass parameters in 3 ways:
- Parameter file (.json)
--parameters @myparams.json - Inline parameters
--parameters vmSize=Standard_B2s - Interactive prompts (only in portal)
Exam-important details:
- Parameters reduce hardcoding.
- Parameter files must be JSON.
- Use secure parameters for secrets:
"adminPassword": { "type": "securestring" }
6. Deployment Modes (Exam Important!)
When deploying via ARM/Bicep, you choose mode:
1. Incremental Mode (default)
- Only adds or updates resources defined in the template
- Does not delete resources that are not in the template
2. Complete Mode
- Adds or updates resources in the template
- Deletes any resources in the resource group not present in the template
Azure CLI example:
az deployment group create \
--resource-group MyRG \
--template-file main.bicep \
--mode Complete
Exam Tip:
If you see “remove resources not in the template,” the correct answer is Complete mode.
7. Deployment Scopes & Commands (Must Memorize)
| Scope | Azure CLI Command |
|---|---|
| Resource Group | az deployment group create |
| Subscription | az deployment sub create |
| Management Group | az deployment mg create |
| Tenant | az deployment tenant create |
PowerShell equivalents:
| Scope | PowerShell Command |
|---|---|
| Resource Group | New-AzResourceGroupDeployment |
| Subscription | New-AzDeployment |
| Management Group | New-AzManagementGroupDeployment |
| Tenant | New-AzTenantDeployment |
These mappings are highly testable.
8. Use of Template Specs (Azure Service)
Template Specs let you store ARM/Bicep templates inside Azure so teams can reuse them.
Upload Template Spec
az ts create \
--name WebAppSpec \
--resource-group InfraRG \
--location eastus \
--version 1.0 \
--template-file main.bicep
Deploy from Template Spec
az deployment group create \
--resource-group AppRG \
--template-spec "/subscriptions/xxx/resourceGroups/InfraRG/providers/Microsoft.Resources/templateSpecs/WebAppSpec/versions/1.0"
Exam relevance:
- Template Specs help store reusable templates securely.
- Ideal when many teams deploy with standard company templates.
9. Linked and Nested Templates
ARM supports linking multiple templates together for modular design.
- Linked template → stored externally; referenced by a URL.
- Nested template → included inside the parent template.
These are used to break large deployments into smaller pieces.
You must know:
- A
templateLinkproperty is required for linked templates. - Nested templates use the
Microsoft.Resources/deploymentsresource type.
10. Validating and Previewing Deployments
Before deploying, you can validate the template:
Azure CLI
az deployment group validate \
--resource-group MyRG \
--template-file main.bicep
PowerShell
Test-AzResourceGroupDeployment `
-ResourceGroupName MyRG `
-TemplateFile main.bicep
Validation checks syntax and parameter correctness.
11. Deployment Outputs
Outputs return values after deployment—for example:
output storageEndpoint string = stg.properties.primaryEndpoints.blob
Outputs are useful for automation pipelines.
12. Key AZ-104 Exam Tips for This Topic
✔ Know how to deploy ARM and Bicep files using CLI and PowerShell
✔ Understand the difference between Incremental vs. Complete mode
✔ Remember deployment scopes and correct commands
✔ Understand parameters, variables, outputs
✔ Know that Bicep automatically compiles to ARM
✔ Know how to validate deployments
✔ Know template specs and when they’re used
✔ Understand linked and nested templates
Conclusion
Deploying resources using ARM templates or Bicep is a core part of the AZ-104 exam.
You must understand how templates work, how to deploy them, and how to manage deployments at various scopes. Mastering these concepts ensures you can automate Azure resource creation accurately and efficiently.
