Saving Microsoft ARM Templates as JSON files on disk
If you are creating a brand new environment on Azure, you should be using Windows PowerShell and Resource Manager. Instead of creating and managing individual resources, use a template (resource model) to create a resource group that has the resources need to support your service. You can create your own templates or pick a template from the gallery.
If you’re starting off with the Azure Resource Manager (ARM), I recommend taking a look at what others have published. Then modify them to create a resource model that represents your service.
The following code will download the Azure Resource Manager (ARM) templates that are published and maintained by Microsoft.
Switch-AzureMode -Name AzureResourceManager New-Item -path 'C:\Azure\Templates\' -type directory -Force $microsoftTemplates = Get-AzureResourceGroupGalleryTemplate -Publisher 'Microsoft' foreach ($item in $microsoftTemplates) { $identity = $item.'Identity' Save-AzureResourceGroupGalleryTemplate -Identity $identity ` -Path C:\Azure\Templates\ ` -Force ` -Verbose }
NB: be sure that ‘C:\Azure\Templates\’ exists before running this script.
This list is growing fast. Microsoft is adding new features on a regular basis. And there’s no better way to learn, than to look at what’s already out there.
Next Steps
To learn more about using Windows PowerShell with Resource Manager:
- Azure Resource Manager Cmdlets: Learn to use the cmdlets in the AzureResourceManager module.
- Using Resource groups to manage your Azure resources: Learn how to create and manage resource groups in the Azure Management Portal.
- Using the Azure Cross-Platform Command-Line Interface with the Resource Manager: Learn how to create and manage resource groups with command-line tools that work on many operating system platforms.
This API is now deprecated. Replacement is not yet released but workaround scripts are available here: https://github.com/Azure/azure-powershell/issues/1064
LikeLike