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
- Log in to the Azure portal.
- One the left menu, select Virtual Machines.
- Select the virtual machine from the list.
- Select Automation script.
- Select Download from the menu at the top and save the .zip file to your local computer.
Open the .zip file and extract the files to a folder. The .zip file contains:
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"
To learn more about deploying resources using templates, see Resource Manager template walkthrough.
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.