Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I troubleshoot Azure ARM template validation errors?

I have made some small changes to an Azure ARM template file and now when I try to deploy or validate via the xplat cli I get this message.

error: InvalidTemplateDeployment : The template deployment 'fakedDeploymentName' is not valid according to the validation procedure. The tracking id is '\some kind of GUID here\'. See inner errors for details. Please see http://aka.ms/arm-deploy for usage details.

error: PreflightValidationCheckFailed : Preflight validation failed. Please refer to the details for the specific errors.

I would love to troubleshoot this problem, but I don't see any "inner errors" on the console. It even gives me a unique GUID each time, implying that I could use this GUID to look up a more informative message. Where can I view a more detailed error? (not looking for help on the real source of the error yet)

like image 616
awl Avatar asked Jun 06 '16 18:06

awl


People also ask

How do I test ARM templates locally?

No, there is no way to test ARM Template locally. Your best bet is Test-AzureRmResourceGroupDeployment Powershell cmdlet or just writing a script that will deploy the template and tell you if anything is wrong (basically like a unit\integration test).


4 Answers

Log into the azure portal portal.azure.com.

Open the Activity log

Find the record with Operation Name of Validate in the list of activities. It should have a red exclamation mark because it failed.

Click on it that record. Then click on the JSON tab at the bottom. Get reading and somewhere deep down in returned Json you might find an error in the statusMessage such as "The storage account named helloworld is already taken."

like image 113
Robert Newby Avatar answered Oct 13 '22 06:10

Robert Newby


Make sure you're running the latest version of the CLI, we're working on bubbling up the detailed error. If that's still not catching it, let us know https://github.com/Azure/azure-xplat-cli/issues

Then if the log isn't showing you the detail, run the deployment with the -vv switch, the detailed debug output (while verbose) will have all the error messages and you can usually sift through and find the specific failure.

azure group deployment create ... --debug 

Powershell:

New-AzResourceGroupDeployment ... -debug 
like image 37
bmoore-msft Avatar answered Oct 13 '22 05:10

bmoore-msft


Run the following PowerShell Azure cmdlet with the tracking ID supplied:

Get-AzureRMLog -CorrelationId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -DetailedOutput

like image 37
nftw Avatar answered Oct 13 '22 05:10

nftw


Building on nftw's answer...

To make it faster/easier to find the error issue I used grep and less with a variable as follows:

$correlationId ='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # store your correlation ID here
Get-AzureRmLog -CorrelationId $correlationID -DetailedOutput | grep -C 10 $correlationID | less

In my testing the error was close to the top of the output. You could use less and the forward-slash key / and search "error" to find the error even quicker.

like image 36
cody.codes Avatar answered Oct 13 '22 05:10

cody.codes