Skip to content

InTheTechPit

For the Developers! This is how I did stuff.

  • Home
  • .Net
  • Asp.net
  • C#
  • Azure
  • React
  • Contact

deploy storage account with ARM template

September 4, 2021September 4, 2021 Pulkit Gulati

Deploy Storage account with ARM template Azure

Firstly, we need a code editor like VSCode to create and modify the ARM template. Also, install the ARM template extension for VSCode.

Create the following ARM template in the editor as below:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccounts_aztrial_name": {
            "defaultValue": "azstoragecli",
            "type": "String"
        }
    },
    "functions": [],
    "variables": {},
    "resources": [
        {
            "name": "[parameters('storageAccounts_aztrial_name')]",
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2019-06-01",
            "tags": {
                "displayName": "[parameters('storageAccounts_aztrial_name')]"
            },
            "location": "[resourceGroup().location]",
            "kind": "StorageV2",
            "sku": {
                "name": "Premium_LRS",
                "tier": "Premium"
            }
        }
    ],
    "outputs": {}
}

The above template creates a name Parameter which is used under resources. Also, I want to create this Storage account in the same Location as my Resource Group.

Now open Bash CLI in Azure Portal and create json file:

touch StorageAccount1.json

Open vim editor and paste the above json:

vim StorageAccount1.json

Press Esc and save and exit with :wq .

Now run the below command in the same Bash CLI session:

az group deployment create -g AutomateRGPG --template-file StorageAccount1.json

Once this executes, you’ll be able to see the Storage account in the Resource group in same location as provided in command above.

You can also run a Custom deployment in Azure Portal and save this json template in the Custom Template editor.

Using the above approaches, any other resource can be created in Azure.

Blog at WordPress.com.
  • Follow Following
    • InTheTechPit
    • Join 1,073 other followers
    • Already have a WordPress.com account? Log in now.
    • InTheTechPit
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...