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

  1. Log in to the Azure portal.

  2. One the left menu, select Virtual Machines.

  3. Select the virtual machine from the list.

  4. Select Export template.

  5. Select Download from the menu at the top and save the .zip file to your local computer.

  6. Open the .zip file and extract the files to a folder. The .zip file contains:

    • parameters.json
    • template.json

The template.json file is the template.

Download the template using PowerShell

You can also download the .json template file using the Export-AzResourceGroup cmdlet. You can use the -path parameter to provide the filename and path for the .json file. This example 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"

Next steps

To learn more about deploying resources using templates, see Resource Manager template walkthrough.