“InvalidTemplateDeployment” error while deploying ARM Template

I was working on a PowerShell script today to deploy a service fabric cluster using ARM template and came across a weird error –

The template deployment ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ is not valid according to the validation procedure. The tracking id is ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’. See inner errors for details. Please see https://aka.ms/arm-deploy for usage details.

 

It was clear that my ARM template had validation errors. But, looking at the error message above, I had got no clue what could be wrong with my template. After doing a bit of troubleshooting, I figured out how to find the error with my template.

I went straight to the Activity Log for my Resource Group in which I was deploying the cluster to and looked for  the last “Validate Deployment” operation which has failed.

1

Upon Expanding the Json, I verified the same error that I have received while executing my PowerShell script –

2

I clicked on the JSON tab and scrolled down till the “properties” field –

3

Looking at the status message, I figured out the storage account name I was passing in my template was invalid – either it had unsupported characters or it had more than 24 characters –

5.JPG

Fixing the storage account name an retrying the deployment worked for me!