39

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)

awl
  • 1,540
  • 1
  • 15
  • 18

8 Answers8

62

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."

Robert Newby
  • 621
  • 1
  • 5
  • 2
  • How can that be done with c#? it would be good to validate the JSON for things like missing parameters/values (catch typos, etc). – Snowy Nov 16 '16 at 18:30
  • 2
    In my case Activity log didn't have the error (some maintenance there?) but `-Debug` as in other answer helped. – Artyom Aug 06 '18 at 11:56
  • 2
    Thanks! This should be the accepted answer, this is the only thing that helped me. – Shay Nehmad Oct 15 '19 at 08:31
  • Thanks! I did this and I found out why I could not add a new Azure Function - "The requested app service plan cannot be created in the current resource group because it is hosting Linux apps. Please choose a different resource group or create a new one." – gordon613 Jan 12 '20 at 16:19
  • 1
    This is the only thing that helped me. Tried the accepted answer as well but no help. This should be the accepted answer. – Saurabh Rai Nov 06 '20 at 08:38
28

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
bmoore-msft
  • 8,376
  • 20
  • 22
  • 9
    When using `New-AzureRmResourceGroupDeployment`, the equivalent would be `-Debug`. I think. (at least, it helped me) – Iain Jul 18 '16 at 07:50
  • 2
    for others that ended up on this page like me, for the az cli the switch is not -vv but --debug. – JarroVGIT Apr 16 '20 at 10:02
20

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

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

nftw
  • 589
  • 4
  • 10
  • This worked for me, the inner exception provided the details I needed to troubleshoot my issue. – ShaneH Jan 17 '18 at 01:45
  • 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'` then the command `Get-AzureRmLog -CorrelationId $correlationID -DetailedOutput | grep -C 10 $correlationID | less` – cody.codes Oct 06 '18 at 01:56
2

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.

cody.codes
  • 1,384
  • 1
  • 18
  • 24
  • 1
    grep didn't work but the detailed error is in ```Properties``` thanks –  Dec 27 '18 at 19:13
1

I believe that tracking ID is for technical support for looking at their logs, not for the user. Regarding your exact question, you need to take a look at logs - reference.

Another good way to validate the template is to use Resource Explorer.

Alex Belotserkovskiy
  • 4,012
  • 1
  • 13
  • 10
1

Building on @nftw:

$deploymentGroupName = 'deploymentGroupName'
$correlationId = ((Get-AzureRMLog -ResourceGroup $deploymentGroupName)[0]).CorrelationId
$logentry = (Get-AzureRMLog -CorrelationId $correlationId -DetailedOutput)
#$logentry
$rawStatusMessage = $logentry.Properties
$status = $rawStatusMessage.Content.statusMessage | ConvertFrom-Json
$status.error.details
$status.error.details.details
OzBob
  • 4,227
  • 1
  • 39
  • 48
0

I was running in the same issue. Basically, I couldn't get any details passed "InvalidTemplateDeployment".

I added my ARM template in a Visual Studio: Azure Resource Group project template and tried to deploy it. I got verbose details in the Output tab. That helped me solve my problem.

In my case it was the name of the cluster, it can only be small letters and numbers.

0
az vm list [--only-show-errors]
           [--resource-group]
           [--show-details]
           [--subscription]
sanju
  • 1
  • 3
    While this code may solve the question, [including an explanation](https://meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Brian61354270 Apr 11 '20 at 17:19