To create a storage account in Azure using ARM templates, you can use the Azure Resource Manager (ARM) template deployment feature in the Azure portal. The process includes the following steps:

  1. Create an ARM template in JSON format that defines the storage account resource you want to create. You can use an existing template from Azure Quickstart Templates as a starting point, or create your own from scratch.
  • Here is an example of an ARM template in JSON format that creates a storage account resource:
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountName": {
            "type": "string",
            "metadata": {
                "description": "The name of the storage account to create."
            }
        },
        "storageAccountType": {
            "type": "string",
            "defaultValue": "Standard_LRS",
            "allowedValues": [
                "Standard_LRS",
                "Standard_GRS",
                "Standard_RAGRS",
                "Standard_ZRS",
                "Premium_LRS"
            ],
            "metadata": {
                "description": "The type of replication for the storage account."
            }
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "The location where the storage account will be created."
            }
        }
    },
    "variables": {
        "storageAccountId": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
    },
    "resources": [
        {
            "type": "Microsoft.Storage/storageAccounts",
            "name": "[parameters('storageAccountName')]",
            "location": "[parameters('location')]",
            "apiVersion": "2019-06-01",
            "sku": {
                "name": "[parameters('storageAccountType')]"
            },
            "kind": "StorageV2",
            "properties": {}
        }
    ],
    "outputs": {
        "storageAccountId": {
            "type": "string",
            "value": "[variables('storageAccountId')]"
        }
    }
}
  1. In the Azure portal, navigate to the “Resource groups” menu and select the resource group that you want to deploy the storage account to.
  2. Click the “+ Deploy a new resource” button, and select “Template deployment”
  3. In the “Basics” tab, select “Build your own template in the editor” and paste in the JSON code for your ARM template.
  4. In the “Review + create” tab, review the details of your deployment, and then click the “Deploy” button to deploy the storage account using the ARM template.
  5. Once the deployment is complete, you can navigate to the “Storage accounts” menu in the Azure portal to verify that the storage account has been created and is in a “Running” state.

It’s also possible to deploy ARM Templates through Azure CLI or Azure PowerShell, both options allow for automating the deployment process.

LET’S KEEP IN TOUCH!

We’d love to keep you updated with our latest blog and webinars 😎


0 Comments

Leave a Reply

Avatar placeholder
en_USEnglish