Last updated on December 5, 2024
Azure Resource Manager Cheat Sheet
-
Azure Resource Manager is a service that allows you to create, update, and delete resources in your Azure account.
-
Enables you to manage access control, locks, and tags for your resources after they have been deployed.
Features
-
All requests are authenticated and authorized by ARM before being routed to the appropriate Azure service.
-
Manage infrastructure using declarative templates and deploy it in a repeatable manner.
-
Deploy, manage, and monitor all resources as a group.
-
Tag resources to logically organize all the resources in your subscription.
-
You can check the costs for a group of resources sharing the same tag.
-
Define the dependencies between resources, so they’re deployed in the correct order.
Resource groups
-
A container that holds related resources.
-
You can create a resource group using the Azure Portal, PowerShell, CLI, or an ARM template.
-
Each resource can only exist in a single resource group.
-
You can add or remove resources to any resource group at any time.
-
Allows you to move a resource from one resource group to another.
-
Resources from multiple regions can be in one resource group.
-
You can give users access to a resource group.
-
Resources can interact with other resources in different resource groups.
-
A resource group has a location or region, as it stores metadata about the resources.
-
When you delete a resource group, it also deletes all of its resources.
ARM templates
-
The template is a JSON file with declarative syntax that defines the properties and configuration of your resources. It is divided into the following sections:
-
Parameters – values that allow the same template to be used in multiple environments.
-
Variables – values that can be reused in templates.
-
User-defined functions – customized functions to simplify the template.
-
Resources – define the resources to be deployed.
-
Outputs – values from deployed resources.
-
-
When a template is deployed, ARM converts it into REST API operations.
-
You can specify an apiVersion so that you can reuse the template without worrying about breaking changes introduced in later versions.
-
To make sure your template adheres to suggested best practices, use an ARM template toolkit (arm-ttk).
-
Before deploying the template, you can preview changes using the what-if operation.
-
To deploy a template, you can use the following:
-
Azure Portal
-
Azure CLI
-
Azure Cloud Shell
-
PowerShell
-
REST API
-
Button in GitHub repository
-
-
An application can be defined in a single template or divided into a purpose-specific template (modular files). You can also create a parent template that links all the nested templates.
-
You can share the template using template specs and manage access using role-based access control (RBAC).
-
Link template – a different template file linked from the primary template.
-
Nested template – an embedded template syntax within the main template.
-
-
You can also get the template of an existing resource group by exporting it.
-
With Azure Pipelines, you can continuously build and deploy ARM template projects.
Bicep
Bicep is a domain-specific language (DSL) for declaratively deploying Azure resources. It enhances the authoring experience compared to JSON-based ARM templates while ensuring compatibility with ARM. Bicep compiles down to standard ARM templates for deployment.
Features of Bicep
- Bicep offers a cleaner, more concise syntax than JSON-based ARM templates, making it easier to write and maintain.
- Bicep allows you to define reusable modules, helping to break down large deployments into manageable pieces.
- Unlike tools like Terraform, Bicep doesn’t require managing a separate state file; it directly compiles to ARM templates, which Azure tracks.
- Bicep is fully compatible with ARM templates and leverages ARM’s APIs for resource deployment and management.
Structure of a Bicep Template
- Modules – Reusable components that encapsulate resources and logic.
- Parameters – Allow input values to be passed into the template.
- Resources – Define the Azure resources to be deployed.
Azure Resource Manager Pricing
-
You are only charged for the resources deployed by the ARM template.
Azure Resource Manager Cheat Sheet References:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/overview
https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/overview
https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/overview?tabs=bicep