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 🙂