Azure Resource Manager(ARM) Templates Demo

In this blog we'll understand ARM templates by creating resources in azure through ARM templates

  1. Download Visual studio code

  2. Install ARM template extension by microsoft in VS code

  3. Create a folder and a file in that folder .json

  4. Search for the arm, we can see the arm template section select the fist one

  5. open the resources square bracket and tyep arm-storage

  6. code will get automatically added based on selection

  7. Change the configurations according to the requirement

  8. Now we will use azure cli to create the resource

  9. Click on new terminal

  10. check for azure cli installed and login to the portal

  11. check for the templates to create azure storage account and resource group and execute in the azure cli

  12. ARM template for creating az resource group

    az group create --name vscode --location 'Central US'

  13. ARM template for creating az storage account

    az deployment group create --resource-group vscode --template-file 01-storage-account.json

    -- make sure you are in the same working directory or folder in which json file is present.

  14. If we want to change the configurations according to requirements then we make use of parameters

    for ex: if we want to change the performance of storage account from standard to premium to standard , then we can use parameters instead of again writing the whole code

  15. In parameters we can define if the user wants to take the default value then they can use that... if they need other values then we can define that within the parameters

    default : standard

    [

    "standard"

    "premium"

    ]

  16. In the json code, enter the parameters, type new parameter, a code will be added, change it according to the requirement, give default and different values. see the screenshot for reference

  17. Give parameters a name and call it in the tier section at the bottom

Variables:

-- we can make use of variables if we want to create resources with the same name and if we want to repeat the same activity

After executing it will create another storage account with the variable name

similarly create the virtual machine as well in another json file