ARM-Tool for resource management in Azure

Introduction

Aayushi Katkamwar
Globant
6 min readDec 30, 2020

--

Flexibility and configuration are the need in today’s era of technology and the same applies when we talk about the cloud. Is not that a cool thing if you could utilize an existing template and you do not need to put on extra efforts to run a system. That is where the ARM template comes into the picture.
ARM is a reusable component-based tool to manage and deploy resources in Azure.

What is the ARM (Azure Resource Manager) template?

Using the ARM template you could deploy several resources together in a single unit and that the deployments are idempotent. Here, the user declares the type of resource, what name to use, and which properties it should have.
ARM Template gives flexibility to declare the objects, types, names and properties in JSON file and attached into source control.

Component of ARM template

An ARM template could be defined in two ways
1. Contents of an entire resource group.
2. One or more resources from the resource group.
While deploying the template user can choose “complete” or “incremental” mode.

  1. Resource: A manageable item that is available through Azure. Virtual machines, storage accounts, web apps, databases, and virtual networks are examples of resources. Resource groups, subscriptions, management groups, and tags are also examples of resources.
  2. Resource Provider: A service that supplies Azure resources. For example, a common resource provider is “Microsoft.Compute”, which supplies the virtual machine resource. “Microsoft.Storage” is another common resource provider.
  3. Resource Group: A container that holds related resources for an Azure solution. The resource group includes those resources that you want to manage as a group. You decide which resources belong in a resource group based on what makes the most sense for your organization.
  4. Resource Manager Template: A JavaScript Object Notation (JSON) file that defines one or more resources to deploy to a resource group, subscription. The template can be used to deploy the resources consistently and repeatedly.

The benefits of using Azure Resource Manager

  • Manage your infrastructure through declarative templates rather than scripts.
  • Deploy, manage and monitor all the resources for your solution as a group rather than handling these resources individually.
  • Redeploy your solution throughout the development lifecycle and have confidence your resources are deployed in a consistent state.
  • Define the dependencies between resources so they’re deployed in the correct order.
  • Apply access control to all services because Azure role-based access control is natively integrated into the management platform.
  • Apply tags to resources to logically organize all the resources in your subscription.
  • Clarify your organization’s billing by viewing costs for a group of resources sharing the same tag.

ARM Flow (Architecture)

  1. When a user sends a request from any of the Azure tools, APIs, or SDKs, the Resource Manager receives the request.
  2. It authenticates and authorizes the request.
  3. Resource Manager sends the request to the Azure service which takes the requested action.

Because all requests are handled through the same API, you see consistent results and capabilities in all the different tools.

The below image shows the role Azure Resource Manager plays in handling Azure requests.

(Image courtesy from Microsoft) ARM flow

All capabilities that are available in the portal are also available through PowerShell, Azure CLI, REST APIs, and client SDKs. Functionality initially released through APIs will be represented in the portal within 180 days of the initial release.

How to create ARM template (steps)

(Image courtesy from Microsoft)

Create a template using the portal

  1. In a web browser, go to the Azure portal and sign in.
  2. From the Azure portal menu, select Create a resource.

3. Select Storage =>Storage account.

After clicking the Storage Account you need to provide a resource group name if you don’t have and Storage Account name that you want.

4. Select Review + Create button for next step

5. Click Review + create on the bottom of the screen. It will create the Resource group with the Storage Account

6. Select the Resource Group which you have created and select the storage account for which you need to create the ARM template.

7. Click on Export Template

8. Click On the Download button. Zip file will be downloaded. It will give you an auto-generated template with parameters.

9. Open the downloaded zip file and save “template.json” to your computer.

10. Select the Parameter tab to see the values you provided for the parameters. Write down these values, you need them when you deploy the template.

Edit and deploy the template

Azure Portal is used to perform basic template deployment. You can use a portal tool called Template Deployment.

Azure requires a unique name for each Azure Service. Your deployment could fail if you entered a storage account name that already exists. To skip this issue, you can modify the template to use a template function call “uniquestring()” to generate a unique storage account name.

  1. On the Azure Portal, in the search box, search for deploy and select Deploy a custom template from suggestions.

2. Select option Build your own template in the editor.

3. Select the Load file and then follow the instructions to load “template.json” you downloaded in the last section or you can directly copy the template and paste in the editor.

4. Click on the Save button

5. Select the subscription and resource group where you want to deploy the ARM template. Then click on Review + Create Button

6. Once the validation passed successfully then click on the Create button for deployment.

7. On the next screen it will show you the deployment status

8. Click on Go to a resource group, it will show you all the resources that are being deployed on the given resource group

In this way, you will get all the resources deployed on your selected subscription.

Conclusion

By using the ARM template you can deploy and manage your Azure resources in a simple manner. As its reusable nature, one can create the template at once and the same template can be used multiple times which can save time and effort.

For More Information: https://docs.microsoft.com/en-us/azure/azure-resource-manager

--

--

Aayushi Katkamwar
Globant
0 Followers

Dot Net Full Stack Developer @ Globant India