Search code examples
azurepowershellazure-resource-managerazure-deployment

Azure Tag for Azure Depolyment not working


I am trying to create a Azure deployment with Tag parameter to put tag on the deployment using command New-AzResourceGroupDeployment like -

 New-AzResourceGroupDeployment -ResourceGroupName "demo" -TemplateFile "D:\Templates\storage.json" -Tag @{"CreatedFrom"="PS"; "Env"="Dev";}

but facing this issue -

New-AzResourceGroupDeployment : A parameter cannot be found that matches parameter name 'Tag'.
At line:1 char:102
+ ... Name "demo" -TemplateFile "D:\Templates\storage.json" -Tag @{"Crea ...
+                                                              ~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-AzResourceGroupDeployment], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.N
   ewAzureResourceGroupDeploymentCmdlet

According to the documentation we can put tag parameter with New-AzResourceGroupDeployment command but its not working for me.

Any help on what I am doing wrong here would be much appreciated!

enter image description here


Solution

  • The command works fine here. Make sure you have the latest version of the commands.

    https://learn.microsoft.com/en-us/powershell/azure/new-azureps-module-az?view=azps-6.1.0