I have installed PowerShell Version 7.4.6 and Bicep for Windows installer as well.
When I execute the command of New-AzResourceGroupDeployment
in the PowerShell 7.x, I'm getting below error:
New-AzResourceGroupDeployment -Name 'StAccDeployment' -TemplateParameterFile '.\CreateStorageAccount.bicep' -ResourceGroupName 'bicepworks' -Mode Incremental
Error:
New-AzResourceGroupDeployment: Cannot retrieve the dynamic parameters for the cmdlet.
One of the -TemplateFile, -TemplateUri, -TemplateSpecId or -TemplateObject parameters must be supplied
unless a .bicepparam file is supplied with parameter -TemplateParameterFile.
What I'm missing here?
You are confusing two file types here:
.bicep
) that contains the resources you want to deploy, which may need parameters. It should be provided to the cmdlet using -TemplateFile
.bicepparam
or .json
) which contains values for the parameters defined in the Bicep file that you want to deploy. It should be provided to the cmdlet using -TemplateParameterFile
.If your Bicep template does not require any parameters:
New-AzResourceGroupDeployment -Name 'StAccDeployment' `
-TemplateFile '.\CreateStorageAccount.bicep' `
-ResourceGroupName 'bicepworks' `
-Mode Incremental
If your Bicep template requires parameters:
New-AzResourceGroupDeployment -Name 'StAccDeployment' `
-TemplateFile '.\CreateStorageAccount.bicep' `
-TemplateParameterFile '.\templateParameterFileName.bicepparam' `
-ResourceGroupName 'bicepworks' `
-Mode Incremental