Blog

How to Automate Storage Provisioning in Azure Deployment

Cloud deployments at scale demand streamlined processes and automation tools in place for quick provisioning and ongoing management of resources. For organizations with significant data estate and having multiple storage volumes in their Azure deployment, manual provisioning and configuration of storage is not a scalable solution.

Azure offers multiple tools to automate the storage deployment process, helping customers quickly deploy large number of resources while ensuring uniformity across environments. This blog will focus on the automation options available for storage deployment in Azure and provide a step-by-step walkthrough of the process, one that will greatly benefit users of Cloud Volumes ONTAP for Azure.

Why Are Storage Automation Tools Necessary?

In dynamic and rapidly changing cloud-based application environments, speed is of the essence. The faster you can deploy, the easier it is to ensure that infrastructure deployments aren’t a bottleneck for the next new application feature to be made available to customers.

For applications handling sensitive customer data, storage segregation should be done between environments to prevent unauthorized access and data leakage. Thus, a need arises for quick deployment and configuration of storage resources to different environments multiple times during the application lifecycle, and implementing the right automation tools becomes a very crucial part of the process. Though the cloud abstracts and simplifies the storage deployment and configuration process when compared to on-premises storage deployment, performing multiple manual deployments could lead to errors and configuration mismatches affecting your environment’s stability.

Azure Storage Automation Tools

In Azure deployment, customers can choose from multiple Azure automation tools to overcome these challenges associated with storage provisioning and management:

ARM templates:  In ARM templates, the properties of resources are defined in a declarative JSON format, and used for deploying new resources or updating existing ones. ARM templates can be used to deploy multiple resources using the same template, automatically addressing the dependency between components. It aids the infrastructure-as-code (IAC) cloud deployment models, as the configurations are stored in JSON format files, and can be checked in to code repositories, versioned, and managed much like your application code.

Azure PowerShell: For Windows PowerShell aficionados, the Azure PowerShell command line tool allows Azure resources to be created and managed from the familiar PowerShell command line. It is built on .Net standard and can be run from Windows, Linux, and macOS machines. Organizations heavily dependent on PowerShell scripts for infrastructure automation can extent the same processes and tools in cloud using Azure PowerShell            

Azure CLI:  Azure CLI is another command line tool that can be used in Windows, Linux, and macOS platforms to manage Azure resources. For example, the CLI commands can be integrated with Bash scripts for end-to-end management of Azure resources from a Linux platform. It is also supported in Windows subsystem for Linux, can be run from docker containers, or used directly from Azure CloudShell, the web based shell tool for managing Azure.

Azure DevOps: Setting up CI/CD pipelines for IAC deployment of Azure resources can be done using Azure DevOps. All of the above options (i.e., ARM templates, Azure PowerShell, and Azure CLI) can be leveraged in these pipelines for an end-to-end automation experience. While ARM templates offer immutable infrastructure configuration, Azure PowerShell and CLI offer the flexibility of integrating Azure resource management to existing automation tools and processes, if the organization chooses to do so.

Automating Azure Storage Deployment Using ARM Templates


The basic construct of an Azure ARM template is as follows: {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "",
"apiProfile": "",
"parameters": { },
"variables": { },
"functions": [ ],
"resources": [ ],
"outputs": { }
}

  • Schema: Points to the schema corresponding to the template version.

The following schema can be used for resource group deployments:
https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#
For subscription deployments use the following schema:

https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#

  • contentVersion: Used to track version of the template.
  • apiProfile: Denotes version of API for all resource providers in a template. If it is not used, “apiVersion” property should be explicitly defined for all resources in the template.
  • Parameters: Used to pass values at run time of the template.
  • Variables: JSON components in the template, that are used to simply template expressions or form values based on parameters.
  • Functions: Reusable user-defined functions used to simplify complex expressions in a template.
  • Resources: Defines the Azure resources to be created or deployed.
  • Outputs: Deployment outcomes.

Note: Except for schema, contentVersion, and resources, all other elements are optional in an ARM template.

The steps for deploying an Azure storage template using an Azure ARM template are as follows:


1. A sample ARM template for deploying an Azure Storage account is given below. Save the file in a .json format, say azuredeploy.json. {
   "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
   "contentVersion": "1.0.0.0",
   "parameters": {
     "storageAccountType": {
       "type": "string",
       "defaultValue": "Standard_LRS",
       "allowedValues": [
         "Standard_LRS",
         "Standard_GRS",
         "Standard_ZRS",
         "Premium_LRS"
      ],
      "metadata": {
         "description": "Storage Account type"
      }
    },
    "location": {
      "type": "string",
      "defaultValue":"[resourceGroup().location]",
      "metadata": {
        "description": "Location for all resources."
      }
    },
    "storageAccessTier": {
      "type": "string",
      "defaultValue": "hot",
      "metadata": {
        "description": "Access tier of storage"
      }
    }
  },
  "variables": {
    "storageAccountName": "[concat('store',
uniquestring(resourceGroup().id))]"
  },
  "resources": [
    {
      "type": "Microsoft.Storage/storageAccounts",
      "name": "[variables('storageAccountName')]",
      "location": "[parameters('location')]",
      "apiVersion": "2019-04-01",
      "sku": {
        "name": "[parameters('storageAccountType')]"
      },
      "kind": "StorageV2",
      "properties": {
        "accessTier": "[parameters('storageAccessTier')]"
      }
    }
  ],
  "outputs": {
    "storageAccountName": {
      "type": "string",
      "value": "[variables('storageAccountName')]"
    }
  }
}

Some of the important elements of the template that will be used during the storage deployment are:


  • storageAccountType: Configure the redundancy setting of the storage. The options can be limited to standard and premium LRS, GRS and ZRS.
  • location: denotes the location where the storage will be deployed.
  • storageAccessTier: This option is used to set the access tier of the storage from between Hot and Cool tiers.
  • storageAccountName: This variable defines the name of storage account. In this template, the built-in “uniquestring” function of ARM template is leveraged to create a unique name for the storage account.

2. Provide inputs to the json as a parameter file, again in .json format. For example, azuredeploy.parameters.json. The following file can be used as parameter file for the ARM template. {
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "storageAccountType": {
      "value": "Standard_LRS"
    },
    "location": {
      "value": "eastus"
    },
    "storageAccessTier": {
      "value": "hot"
    }
  }
}

3. In this automation example, the ARM template will be deployed using Azure CLI. As the initial step login to target Azure subscription using the following command. Log in to the web browser and enter the code to complete the login process: #az login

Automation example


4. Create the resource group for deploying the storage by providing the name and location of the resource group: #az group create --name <resource-group-name> --location <resource-group-location>

Create Group


5. Create storage account using the following command: #az group deployment create -g <resource-group-name> --template-file <location of the template> --parameters <location of the parameter template>
Once the execution is completed successfully, provisioning status will be shown as Succeeded in the output

Succeeded in utput

Extract an ARM Template from an Existing Deployment

ARM templates can be extracted from the existing deployments and used as baseline for deployment from portal or automation scripts to ensure consistency of environment.

1. Open the resource group from the Azure portal and browse to settings->Export template.

Export template

2. Once the template is loaded, you can download it, save it to a template directory or initiate another deployment using the template.

Loaded template

Enhance Your Azure Storage Benefits Using Cloud Volumes ONTAP

For large scale storage deployments, efficient storage management is as important as automation. Cloud Volumes ONTAP helps optimize the Azure storage usage by bringing the trusted NetApp storage management capabilities to Azure. It offers block-level storage service for your VMs and file share service for applications over NFS, SMB/CIFS and iSCSI protocols

Cloud Volumes ONTAP helps to minimize storage usage through NetApp storage efficiency features like thin provisioning, deduplication and compression. It can be deployed in a highly available architecture so that applications always have access to the underlying storage without disruptions. It also offers additional value-added features like NetApp Snapshot™, SnapMirror® data replication, FlexClone® data cloning, and more.

If you’re looking into Azure deployment, don’t miss this chance to sign up for a 30-day free trial to understand how your organization can benefit the enterprise class cloud storage features offered by Cloud Volumes ONTAP.

-