If you write code to SQL Server then you might be interested in this: at the end of 2017 I wrote a tSQLt tdd training course which has helped over 300 people learn both tSQLt and how to apply TDD practices to their SQL Server T-SQL development, you can join the course at https://courses.agilesql.club. The course is free if you are happy to wait 10 weeks to complete it, with 1 lesson being made available per week - if you are in more of a hurry or you would like to help support the project you can purchase the course which makes it instantly available to you.
I have been using Octopus to deploy ARM templates for a while now and the default task that comes with Octopus to deploy doesn’t have any debugging information enabled and when you run this powershell:
If you don’t have debugging information enabled, the output of a failed deployment is basically “Deployment Failed, suck it up dude” or something along those lines.
If you want to find out why your deployment failed, the best thing to do is grab your template and parameter file and run:
Test-AzureRmResourceGroupDeployment -TemplateFile ./template.json -TemplateParametersFile ./parameters.json -resourceGroup RG-Group -Debug
When you run this, you will be prompted to run the commands - press “a” and then the template, parameters file and deployability are verified and either you are told everything passes, and you can deploy, or you will see the actual error rather than a generic error.
What do you mean the deployability?
Well, it is fairly easy to validate that a template is structurally valid, i.e. is the json well formed but what if you have a concat() on a couple of variables that then point to a non-existant resource? Test-AzureRmResourceGroupDeployment takes care of this, and it will:
- Parse the JSON structure
- Parse the template functions
- Validate references exist or will be created
- Validates things like VM sizes are available in the specific region chosen
- Checks the subscription quotas to make sure there is enough to actually deploy
This is useful, and although you don’t know for 100% a deploy will be successful it is normally pretty accurate.
You can also get the debug info by setting your “DebugPreference” to “continue” or using “-Debug” (or DebugPreference) with New-AzureRMResourceGroupDeployment, the test version feels safer though :)