How to troubleshoot Azure Resource Manager (ARM) template validation errors

Deploying Azure Resource Manager (ARM) templates with the Azure PowerShell command New-AzureRmResourceGroupDeployment can fail for a variety of reasons. One of the more confusing situations can occur when handling template validation errors (Code=InvalidTemplateDeployment). This is because sometimes additional context is missing from the Exception and you have to lookup more information into order to troubleshoot the issue. In this post we will take a closer look at this particular error and how to resolve it.

Continue reading

Quick Tip: Windows PowerShell execution policy handling for x64 and x86 processes

Windows PowerShell’s execution policy is well known feature that helps prevent users from accidentally running malicious scripts. I hit an interesting situation recently where Get-ExecutionPolicy showed that I was allowed to run scripts, but in practice I still couldn’t execute scripts from a .NET application’s hosted runspace. What was the problem? The execution policy settings differed across x64 and x86 processes. Since this problem isn’t covered in the official documentation I figured it deserved a quick write-up.

Continue reading

SQL Server database publishing with the ‘generate smart defaults’ option

If you’ve ever run a database package (.dacpac) publish against a SQL Server or Azure SQL database, chances are good that you have run into the following error when changing the schema for a table that contains data:

SQL72014: .Net SqlClient Data Provider: Msg 50000, Level 16, State 127, Line 6 Rows were detected. 
The schema update is terminating because data loss might occur.
Continue reading

How to troubleshoot New-AzureRmResourceGroupDeployment ‘parameter cannot be found’ errors

Scenario: You have an Azure RM deployment template JSON file. You initiate a deployment with the New-AzureRmResourceGroupDeployment PowerShell cmdlet and pass in some custom parameters. You immediately hit this all too common error: “New-AzureRmResourceGroupDeployment : A parameter cannot be found that matches parameter name ‘<myParameter>’“.

Continue reading