Change Azure resource tag values

Change Azure resource tag values

Q. How can I easily check the value of a specific tag for an Azure RM resource?

A. Tags are key-value pairs and can be accessed via the key name which means its very easy to view a value for a specific tag, e.g.

$resource.Tags["<key name>"]

for example:

$vm.Tags["dept"]

You could also enumerate them all, e.g.

foreach ($tagName in $resource.Tags.Keys)
{
    Write-Output "${tagName}, $($resource.Tags[$tagName])"

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish