Users: 15,000+ | Page Views: 50,000+ | PPS: 2.5
TechDevOps.com
Explore Tools
{Experts in Microsoft SQL Server Operations, Performance, HA/DR, Data Migrations & Cloud Computing}



New-AzureRmResourceGroupDeployment - Error - InvalidTemplateDeployment
by BF (Senior MSSQL Operations - Enterprise, Cloud, Strategy)
2017-02-07









Visual Studio 2015 has a Cloud Project called Azure Resource Group. It allows developers to create resource in Microsoft Azure Cloud such as Virtual Machines, Storage Accounts, NICs, Load Balancers, Availability Sets and much more. This Azure Resource Group deployment project will contain artifacts needed to provision resources using Azure Resource Manager (ARM) that will create the needed environment for your Applications.










Visual Studio Deploy Error: InvalidTemplate


Recently, I was deploying this Visual Studio project to Azure that I had deployed successfully in the past to multiple Azure Subscriptions. The difference this time was we have a brand new Subscription






Solutions:

- Ensure the JSON API Versions are valid. See Powershell Code below on how to confirm this.
- Ensure the JSON has required Properties & Values.
- Ensure items like Storage Accounts, DNS Name, Load Balancer Names are unique.
- Ensure Powershell 3.0 or higher is installed locally.



Powershell Code:

Get-Module -ListAvailable | Where-Object{ $_.Name -eq 'Azure' }
#Azure ARM - 3.0 or above

Login-AzureRmAccount
#Authenticate

# Check valid API versions for Virtual Machines:
((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Compute).ResourceTypes | Where-Object ResourceTypeName -eq virtualmachines).ApiVersions

# Check valid API versions for Storage Accounts:
((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Storage).ResourceTypes | Where-Object ResourceTypeName -eq storageAccounts).ApiVersions



Visual Studio Deploy Success:

00:05:54 - [VERBOSE] Performing the operation "Creating Deployment" on target "RG1-MSSQL-XYZ ".
00:05:56 - [VERBOSE] 12:05:56 AM - Template is valid.
00:05:58 - [VERBOSE] 12:05:58 AM - Create template deployment 'XYZ-0208-0335'
...
Successfully deployed template 'templates\xyz.json' to resource group 'RG1-MSSQL-XYZ'.



Notes:

You can also use the Azure Portal to test Templates and pick from a list of Quickstart Templates:

Azure Portal..More Services..Search..Templates
Azure Portal..Edit template..Quickstart Templates



Resources:

Troubleshoot common Azure deployment errors with Azure Resource Manager

Define the order for deploying resources in Azure Resource Manager templates