Azure Documentation

Azure Resource Manager (ARM) Documentation

Azure Resource Manager (ARM) is the deployment and management service for Azure. It provides a management layer that enables you to create, update, and delete resources in your Azure account. You can use familiar development tools for the same workflows to build and deploy your applications with a simple or complex orchestration.

What is ARM? ARM allows you to manage all your Azure resources as a single entity, simplifying deployment, configuration, and lifecycle management.

Key Concepts

Understanding these core concepts is crucial for effective Azure resource management:

ARM Templates

ARM templates are declarative JSON files that define your Azure infrastructure. They enable infrastructure as code (IaC) practices, ensuring consistency and repeatability.

Template Syntax

An ARM template has a JSON structure with specific sections:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": { ... },
    "variables": { ... },
    "resources": [ ... ],
    "outputs": { ... }
}

Parameters

Parameters allow you to pass values into your template during deployment, making them reusable and customizable.

"parameters": {
        "storageAccountType": {
            "type": "string",
            "defaultValue": "Standard_LRS",
            "allowedValues": [
                "Standard_LRS",
                "Standard_GRS",
                "Standard_RAGRS",
                "Premium_LRS"
            ],
            "metadata": {
                "description": "Specifies the replication type for the storage account."
            }
        }
    }

Variables

Variables are used to store reusable values within your template.

"variables": {
        "storageAccountName": "[concat(uniqueString(resourceGroup().id), 'storage')]",
        "location": "[resourceGroup().location]"
    }

Resources

The resources section defines the Azure resources to be deployed.

"resources": [
        {
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2021-04-01",
            "name": "[variables('storageAccountName')]",
            "location": "[variables('location')]",
            "sku": {
                "name": "[parameters('storageAccountType')]"
            },
            "kind": "StorageV2"
        }
    ]

Outputs

Outputs return values from your deployment, such as connection strings or IP addresses.

"outputs": {
        "storageAccountName": {
            "type": "string",
            "value": "[variables('storageAccountName')]"
        }
    }

Deployments

You can deploy ARM templates using various methods:

Important: Ensure your template is validated before deployment to catch syntax errors.

ARM REST API

The Azure Resource Manager REST API allows programmatic interaction with Azure resources. You can use it to create, retrieve, update, and delete resources.

Example: Creating a resource group:

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}?api-version=2021-04-01
Content-Type: application/json

{
    "location": "eastus",
    "tags": {
        "environment": "dev"
    }
}

Azure CLI Commands

The Azure CLI provides a powerful command-line interface for managing Azure resources.

SDKs

Azure SDKs are available for various programming languages (Python, .NET, Java, Node.js, Go) to interact with ARM programmatically.

Refer to the official Azure SDK documentation for specific examples.