Donald Duck
Donald Duck

Reputation: 39

Template Validation Error - Error: Code=InvalidTemplate; Message=Deployment template validation failed:

I am having a bit of trouble deploying the template below:

azuredeploy.json file

One of the error message that has thrown:

'The template resource '[concat('nsg-create',copyIndex())]' at line '344' and column '9' is invalid. The api-version '2016-07-01' used to deploy the template does not support 'ResourceGroup' property. Please use api-version '2017-05-10' or later to deploy the template. Please see https://aka.ms/arm-template/#resources for usage details.'.

Code that have been used to deploy.

 Context "Template Validation" {

    It "Template $here\azuredeploy.json and parameter file  passes validation" -TestCases $ParameterFileTestCases {
        Param( $ParameterFile )
        Update-Module -Name AzureRM -Force
        $output = New-AzureRmResourceGroupDeployment -ResourceGroupName $TempValidationRG -Force -Mode Complete -TemplateFile "$here\azuredeploy.json" -TemplateParameterFile "$here\$ParameterFile"  -ErrorAction Stop 5>&1
        $output.ProvisioningState | Should -Be "Succeeded"
    }
}

I have tried changing the API version, however, that still gave me the same error. I do not understand how to solve this issue. I am trying to test the template through pester.

The output of Get-Module AzureRM* -ListAvailable : AzureRM list

Upvotes: 1

Views: 960

Answers (1)

4c74356b41
4c74356b41

Reputation: 72191

You need to use another api-version. Try 2017-05-10 this one.

Also, try updating the Azure Powershell to latest version.

Upvotes: 1

Related Questions