- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to add the new tag to Azure VM using PowerShell?
To add the new tag of Azure VM using PowerShell, we need to use the New-AZTag command. Please note: If you have already tags applied to the VM, you need to use the Update-AZTag command to merge with the available Azure Tags otherwise all the previous applied.
For example, We have the below VM called TestMachine2k12 and after signing to the Azure account we need VMs resource ID to apply the tag to the VM.
We will use a tag in the HastTable format so we will have its Key and a Value. We need to apply the below new tag.
Example
$tag = @{Owner='Chirag'}
To apply the new tag,
New-AzTag -Tag $tag -ResourceId $vm.Id -Verbose
Output
If there are multiple tags, you can separate them by a comma.
Example
PS C:\> $tag = @{Owner='Chirag';Patching_Day='Sunday'} PS C:\> New-AzTag -Tag $tag -ResourceId $vm.Id -Verbose
Output
Please note − In this operation earlier tag(s) were erased by the current tags.
- Related Articles
- How to add the tag of Azure VM using PowerShell?
- How to delete the specific tag of Azure VM using PowerShell?
- How to deallocate the Azure VM using Azure CLI in PowerShell?
- How to start the Azure VM using Azure CLI in PowerShell?
- How to stop the Azure VM using Azure CLI in PowerShell?
- How to restart the Azure VM using Azure CLI in PowerShell?
- How to resize the Azure VM using Azure CLI in PowerShell?
- How to Export the azure VM tags using PowerShell?
- How to get the Azure VM Size using Azure CLI in PowerShell?
- How to get the Azure VM username using Azure CLI in PowerShell?
- How to list the azure VM extensions using Azure CLI in PowerShell?
- How to get the Azure VM available sizes using PowerShell?
- How to get the installed Azure VM extension using PowerShell?
- How to enable the Azure VM accelerated settings using PowerShell?
- How to disable the Azure VM accelerated settings using PowerShell?

Advertisements