Azure resource manager is the modern deployment service for Azure resources. It is an IaaS helping to automate Azure resource management. The ARM service is responsible for creating, Updating, or Deleting Azure resources in your subscription.
You can create Azure resources in multiple ways like Azure Portal, Powershell, Azure CLI, Fluent SDK, or Azure Resource Manager called as ARM Template.
All resource management requests will use same pipeline for creating, deleting or updating resources, as shown in following picture.
Azure Resource Manager (ARM) is a deployment and resource management service. It is an IaaS helping to automate Azure resource management. The ARM service is responsible for creating, Updating, or Deleting Azure resources in your subscription.
The benefit of using ARM templates is that you have the definition and structure of all the resources deployed in the Azure environment. The same template can be reused to deploy resources to different Subscriptions, resource groups, or regions. ARM templates are handy for backup recovery plans and continuous deployments.
The ARM template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. You can declare the objects, types, and properties in the ARM template file. It contains Schema, ContentVersion, Parameters, variables, functions, resources, and outputs.
The basic ARM template looks like
{ "$schema": "https://schema.management.azure.com /schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "", "parameters": { }, "variables": { }, "functions": [ ], "resources": [ ], "outputs": { } }
You can provide values of resources like name, location, or tags while resource deployment is executing the template. It is not mandatory to have Parameters in the template.
"parameters": { "storageAccountName-dev": { "type": "string", "minLength": 3, "maxLength": 24, "metadata": { "description": "Storage account name for development environment." } } }
You can construct values of variables and use them in the template. It is very useful when you want to build complex value and use it in multiple locations.
{ "parameters": { "storageAccountName": { "type": "string", "minLength": 3, "maxLength": 24, "metadata": { "description": "Storage Account name." } }, "env": { "type": "string", "defaultValue": "test", "allowedValues": [ "test", "dev", "qa", "prod" ], "metadata": { "description": "Environment name." } } }, "variables": { "storageAccountName": "[concat( parameters('storageAccountName') , parameters('env') )]" }, "resources": [ { "name": "[variables('storageAccountName')]" } ] }
Functions are useful to avoid the repetition of a complex expression.
"functions": [ { "namespace": "GeeksStorage", "members": { "uniqueResourceName": { "parameters": [ { "name": "prefix", "type": "string" } ], "output": { "type": "string", "value": "[concat(toLower(parameters('prefix')), uniqueString(resourceGroup().id))]" } } } } ], "resources": [ { "name": "[GeeksStorage.uniqueResourceName('StorageAccountName')]", "type": "Microsoft.Storage/storageAccounts" } ]
In the resources section, you can define the resources with the required metadata.
{ "$schema": "https://schema.management.azure.com/ schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "resources": [ { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2019-04-01", "name": "GeeksStorageDemo", "location": "centralus", "sku": { "name": "Standard_LRS" }, "kind": "StorageV2" } ] }
The output section can return the result of deployment.
{ "$schema": "https://schema.management.azure.com/ schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "resources": [ ], "outputs": { "uniqueString": { "value": "[uniqueString(resourceGroup().id)]", "type": "string" } } }