 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- 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
Advertisements
 