Hi, I’m Makoto, a freelance engineer.
In this article, I’ll explain Azure Resource Manager.
It’s an important mechanism for understanding the behind-the-scenes workings of Azure resource management. It will also help you understand the benefits of expressing infrastructure as code. Please read to the end.
Let’s get started!
What is Azure Resource Manager?
Azure Resource Manager is a service for managing and deploying Azure resources. It’s often abbreviated as ARM.
ARM has the following mechanisms to efficiently manage multiple resources (see the linked articles for details):
- Manage resources in a hierarchical structure
- Prevent resource deletion (resource locks)
- Label resources (tags)
While it’s necessary to thoroughly understand these individual features, there aren’t many occasions where you’ll need to be aware of ARM itself.
In addition, ARM serves as the single point of contact for receiving requests to create, update, and delete Azure resources.
In Azure, you can manage resources not only through the GUI screen of the Azure portal but also through command-line tools such as Azure PowerShell and Azure CLI.
All of these requests go through ARM, which then authenticates with the Microsoft Entra ID, converts the requests into a form that ARM can interpret (ARM templates), and deploys the resources.
This mechanism ensures that all requests are processed through the same point of contact, resulting in consistent results and functionality even when different tools are used.
It’s as if emails sent in Japanese, Chinese, and Korean were translated into English, the common language of the world.
Key Points:
Azure Resource Manager provides a mechanism to maintain consistency across the Azure environment, even when deployed from different tools.
What are ARM templates?
The code that is converted into a form that ARM can interpret is called “ARM templates” and is expressed in JSON format.
For example, an ARM template is written like this:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"name": "azstart-vnet",
"type": "Microsoft.Network/VirtualNetworks",
"apiVersion": "2021-01-01",
"location": "japaneast",
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.1.0.0/16"
]
},
"subnets": [
{
"name": "default",
"properties": {
"addressPrefix": "10.1.0.0/24"
}
}
]
}
}
]
}
It may seem confusing at first, but for now, just try to get a feel for it. The AZ-900 exam doesn’t test you on syntax.
The JSON format tends to have many lines due to the use of curly braces and square brackets for parameters, but if you look closely, you can see the following information in the resources block:
Property | Value |
---|---|
Resource type (type) | Microsoft.Network/VirtualNetworks |
Name (name) | azstart-vnet |
Region (location) | japaneast |
Address space (addressPrefixes) | 10.1.0.0/16 |
Subnet name (name) | default |
Subnet address space (addressPrefix) | 10.1.0.0/24 |
This means that every parameter you enter on the Azure Portal screen is expressed in code.
Using code to manage and deploy infrastructure configurations, such as networks and servers, is called Infrastructure as Code (IaC).
Azure provides ARM templates and Bicep as IaC tools. Terraform is a well-known third-party tool.
Now, let’s return to ARM templates.
While you can write ARM templates from scratch, Azure Porta actually creates them automatically. Click on “View automation template” on the “Review + create” screen. (In this example, we’re trying to create a virtual network.)
This allows you to view or download the ARM template that describes the resource you’re creating.
Alternatively, you can review and download the template from the deployment completion screen after you create the resource.
ARM templates are useful when deploying multiple resources together, or when deploying the same set of resources to multiple environments.
To deploy using an ARM template, use “Deploy a custom template”.
Key Points:
ARM templates are JSON files that describe resource configurations, streamlining repetitive resource creation tasks.
Summary
In this article, we explained the mechanisms of Azure Resource Manager and ARM templates.
ARM templates can be intimidating at first, but once you create a template, you can reuse it, share it with your team, and manage versions. So as you become more familiar with Azure, give it a try.
For the AZ-900 exam preparation, remember these two points:
- Azure Resource Manager provides APIs for creating, updating, and deleting Azure resources, and provides a common platform for maintaining consistency across your Azure environment, even when deployed using different tools.
- ARM templates are useful when deploying multiple resources together, or when deploying the same set of resources to multiple environments.
See you next time!