Downloading the template for a VM

  1. Home
  2. Downloading the template for a VM

Return to AZ-104 Tutorial

Here you will learn how to download the template for a VM. When you create a VM in Azure using the portal or PowerShell, a Resource Manager template is automatically created for you. You can use this template to quickly duplicate a deployment. The template contains information about all of the resources in a resource group. For a virtual machine, this means the template contains everything that is created in support of the VM in that resource group, including the networking resources.

Download the template using the portal

Follow the below-mentioned steps in order to download the template using the portal:

  • First of all, Log in to the Azure portal.
  • Now, one the left menu, select Virtual Machines.
  • Further, select the virtual machine from the list.
  • Now, select the Export template.
  • Moving on, select Download from the menu at the top and save the .zip file to your local computer.
  • After this, open the .zip file and extract the files to a folder. The .zip file will contain:
    • parameters.json
    • template.json
Practice Test for AZ-104

The template.json file is the template.

Downloading the template using PowerShell

Also, you can also download the .json template file utilising the Export-AzResourceGroup cmdlet. Furthermore, you can use the -path parameter to offer the filename and path for the .json file. This sample shows how to download the template for the resource group named myResourceGroup to the C:\users\public\downloads folder on your local computer.

Export-AzResourceGroup -ResourceGroupName "myResourceGroup" -Path "C:\users\public\downloads"

Reference: Microsoft Documentation

Return to AZ-104 Tutorial

Menu