Search code examples
powershellazure-resource-managerazure-rm-template

New-AzResourceGroupDeployment: Cannot retrieve the dynamic parameters for the cmdlet


Though I know the answer, I just thought I would drop this question here for anyone else that comes across this error message. There doesn't seem to be anything coming up in my search results.

When running an Azure Resource Manager Template with this command:

New-AzResourceGroupDeployment -WhatIf -ResourceGroupName my-rg -TemplateFile my-rg-tst-parameters.json -TemplateParameterFile .\my-rg-tst-parameters.json

I'm getting this error:

New-AzResourceGroupDeployment: Cannot retrieve the dynamic parameters for the cmdlet. Parameter type in parameters cannot be null or empty


Solution

  • The error in this case is caused because the command being run is passing the parameter file where it should be parsing the template file. The correct command would be:

    New-AzResourceGroupDeployment -WhatIf -ResourceGroupName my-rg -TemplateFile .\my-rg-template.json -TemplateParameterFile .\my-rg-tst-parameters.json