Azure Resource Manager(ARM) Templates Demo
In this blog we'll understand ARM templates by creating resources in azure through ARM templates
Download Visual studio code
Install ARM template extension by microsoft in VS code
Create a folder and a file in that folder .json
Search for the arm, we can see the arm template section select the fist one
open the resources square bracket and tyep arm-storage
code will get automatically added based on selection
Change the configurations according to the requirement
Now we will use azure cli to create the resource
Click on new terminal
check for azure cli installed and login to the portal
check for the templates to create azure storage account and resource group and execute in the azure cli
ARM template for creating az resource group
az group create --name vscode --location 'Central US'
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.
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
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"
]
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
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