az resource tag

We can also use Azure CLI to create or apply Azure tags. Let’s discuss how to use the az resource tag Azure CLI command.

az resource tag

This Azure CLI command can help you tag a resource in Azure.

Syntax of az resource tag

az resource tag --tags
                [--ids]
                [--name]
                [--resource-group]
                [--resource-type]

Az resource tag Examples

Example-1

You can use the below script to add virtual machine with the key ‘vmlist’ and value ‘vm1’.

az resource tag --tags vmlist=newvms -g MYVMrsg -n TSINFOVM --resource-type "Microsoft.Compute/virtualMachines"

After executing the above command, I got the expected output, as shown in the screenshot below.

az resource tag

Example-2:

Use the below Azure CLI scripts to overwrite the tags on a resource

az resource tag --tags 'TSinfo=HR' 'Technology=Android' -g newresgroup -n DemoStorage --resource-type "Microsoft.Storage/storageAccounts"

You may also like following the articles below

Conclusion

This article discussed how to use the az resource tag Azure CLI command.