Skip to content

DateTime attributes for Key Vault resources display UTC #10584

@heaths

Description

@heaths

Description

Get-AzKeyVaultSecret and other cmdlets returning Key Vault resources return raw DateTime properties that are in UTC. This differs from the az CLI that converts to local time.

Steps to reproduce

  1. Create or use a Key Vault in which you have secret/set access.
  2. Run the following:
Set-AzKeyVaultSecret -VaultName example-keyvault -Name test -SecretValue (ConvertTo-SecureString -String 'test' -AsPlainText -Force)                                                                                                          
Vault Name   : example-keyvault
Name         : test
Version      : 0a1b2177d4ec4e94b44f4239232474c3
Id           : https://example-keyvault.vault.azure.net:443/secrets/test/0a1b2177d4ec4e94b44f4239232474c3
Enabled      : True
Expires      :
Not Before   :
Created      : 11/20/2019 6:08:55 PM
Updated      : 11/20/2019 6:08:55 PM
Content Type :
Tags

Notice the Created and Updated times. These are UTC, while my local system time was 10:08 AM.

I recommend either converting the DateTime values to local time (should contain correct time zone info), and back (for anything serialized), similar to the az CLI for a common developer experience.

Environment data


Name                           Value
----                           -----
PSVersion                      6.2.3
PSEdition                      Core
GitCommitId                    6.2.3
OS                             Microsoft Windows 10.0.18362 
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     2.8.0      Az                                  Core,Desk 
Script     1.3.1      Az.KeyVault                         Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertif…

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions