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.
The ‘copy’ property is an Azure ARM template feature that allows you to iterate (for each) loop over a resource to create multiple copies of it. You can combine it with an ‘array of objects’ custom parameter to easily duplicate resources with your supplied values. However there are a couple of snags you might run into so I figured it’s worth a write up with an example.
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>’“.
Azure Resource Manager (ARM) templates have a nice set of built-in functions that allow you to develop complex expressions. These expressions can help a static deployment template file become more scalable and flexible for different scenarios. This article is a quick rundown on my new favorite tip for debugging a template expression that you just can’t get working.