Azure bicep deployment error "New-AzResourceGroupDeployment: The deployment validation failed"

Anders Wong 6 Reputation points
2022-08-26T00:07:29.2+00:00

I am starting my learning for bicep and following the Azure Bicep learning modules. When I was trying out the exercise of (https://learn.microsoft.com/en-gb/learn/modules/build-first-bicep-template/8-exercise-refactor-template-modules?pivots=powershell). It didn't work and threw me an error when I run the command "New-AzResourceGroupDeployment -TemplateFile main.bicep -environmentType nonprod", see error as below:

New-AzResourceGroupDeployment: 10:15:18 PM - Error: Code=InvalidTemplateDeployment; Message=The template deployment 'main' is not valid according to the validation procedure. The tracking id is '4572273f-8839-4ca3-88bb-e092743a4b5f'. See inner errors for details.

New-AzResourceGroupDeployment: 10:15:18 PM - Error: Code=; Message=Object reference not set to an instance of an object.

New-AzResourceGroupDeployment: The deployment validation failed

Before hitting the error, the previous exercise were running fine without any issue. I am sure that I have established the connection successfully via powershell terminal with connect-AzAccount and set the active subscription correctly and I was able to see the subscription, learning resource group information in portal.azure.com/#home and able to see the output of running "Get-azsubscription" from my powershell terminal on my laptop.

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,368 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Anders Wong 6 Reputation points
    2022-08-30T01:05:14.26+00:00

    Problem solved now


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.