Thursday, August 23, 2018

Create Azure VM using ARM Template

We have explored how to create an Azure Virtual Machine using the Azure portal and understood how to get started with Azure PowerShell in previous two posts. As third step of the series this post we can learn how to create Azure Virtual Machine using ARM (Azure Resource Manager) template. The Azure Resource Manager (ARM) is the service used to provision resources in Azure subscription
  1. To create your first ARM template, go to the Azure portal as we have discussed in Create Azure Virtual Machine post.and follow the steps to create a VM (Virtual Machine) till the final step..
  2. In the final step you can find a link next to Create button named “Download template and parameters”. Click on that link to download template files.tempdown
  3. You will find template.json and parameters.json files with the other downloaded files. (deploy.ps1,deploy.sh, deployer.rb, DeploymentHelper.cs)
  4. You can give values for VM using parameters.json file. Following image shows a part of the parameter.json file.You can see we can give location value where we need the VM to be created, give name of the VM, set size of VM and more.parajson
  5. Open Azure PowerShell and login to Azure RM Account (Install Azure PowerShell and Execute Commands)
  6. Before creating a VM you have to create an Azure resource group first. You can find how to create a resource group in Install Azure PowerShell and Execute Commands post.
  7. We have prepared parameters.json file and have created a resource group. Now you can execute following command to create an Azure VM using the downloaded and modified template files. Provide suitable name as deployment name, name of existing resource group in Azure, file paths to template.json and parameters.json files.
    • New-AzureRmResourceGroupDeployment -Name myDeploment -ResourceGroup myResourceGroup -TemplateFile template.json file path –TemplateParameterFile parameters.json file path
  8. After executing the above command, the status of the provisioning of the VM and all relevant parameter details will be displayed as shown in the image below.Tempcreate
  9. Login to Azure portal and you would be able to see newly created VM available in VM list.VMs

No comments:

Post a Comment