- 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 change the Azure tag value using PowerShell?
To change the azure value using PowerShell we need to use the Update-AZTag command with the merge property.
Example
For example, we have the Azure VM TestMachine2k16 and we have its tags as shown below.
PS C:\> $vm = Get-AzVM -VMName TestMachine2k16 PS C:\> $vm | Select -ExpandProperty Tags
Output
Key Value --- ----- Owner Chirag For Ansible Patching_Day Sunday Application SecretTag
We need to change the Patching_Day from Sunday to Wednesday. We will use the below command.
Example
$tag = @{Patching_Day='Wednesday'} Update-AzTag -Tag $tag -ResourceId $vm.Id -Operation Merge -Verbose
Output
Name Value ============ ========= Patching_Day Wednesday For Ansible Application SecretTag Owner Chirag
There is also property Replace available in Update-AZTag but please be cautious while using the Replace parameter because once you apply it, the current tag will be changed but other tags will be erased.
Example
Update-AzTag -Tag $tag -ResourceId $vm.Id -Operation Replace -Verbose
Output
Properties : Name Value ============ ========= Patching_Day Wednesday
- Related Articles
- How to add the tag of Azure VM using PowerShell?
- How to add the new tag to Azure VM using PowerShell?
- How to delete the specific tag of Azure VM using PowerShell?
- How to apply a tag to the azure resource group using PowerShell?
- How to change the size of the Azure VM using PowerShell?
- How to change Azure Subscription in PowerShell?
- How to list the Azure VMs using Azure CLI in 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 connect to the Azure subscription using Azure CLI in PowerShell?
- How to Export the Azure VMs using PowerShell?
- How to get the Azure resource group using Azure CLI in PowerShell?

Advertisements