Azure / Azure/azure-powershell

Get-AzVM modifies ISO 8601 tag values whereas Get-AzResource returns the raw ARM value

Open
#30,036 1 comment 1 reaction 2 assignees Claimed by @a0x1ab View on GitHub
act-observability-squad bug Compute customer-reported
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description

When a tag is set on a VM with an ISO 8601 formatted datetime, the tag value is serialised and converted back to a string by Get-AzVM, however the portal and Get-AzResource faithfully return the value which was set.

### Issue script & Debug output

```PowerShell
$expiryTime = (Get-Date).ToUniversalTime().AddHours(24)
$tagValue = $expiryTime.ToString('o')
Update-AzTag -ResourceId $vm.id -Tag @{test = $tagValue} -Operation Merge
(Get-AzVM -ResourceId $vm.id).Tags['test']
# returns 08/20/2026 06:59:42
(Get-AzResource -ResourceId $vm.id).Tags['test']
# returns 2026-08-20T06:59:42.4821687Z
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 7.6.5
PSEdition Core
GitCommitId 7.6.5
OS Microsoft Windows 10.0.20348
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

### Module versions

```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 5.5.2 Az.Accounts {Add-AzEnvironmen…
Script 11.8.0 Az.Compute {Add-AzGalleryInV…
Script 6.0.0 Az.DesktopVirtualization {Disconnect-AzWvd…
Script 10.1.0 Az.Resources {Export-AzResourc…
```

### Error output

```PowerShell

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.