From 2a5ad3bac0d7d747adf18023255576e148d503ac Mon Sep 17 00:00:00 2001 From: NanxiangLiu <33285578+Nickcandy@users.noreply.github.com> Date: Wed, 25 May 2022 19:34:09 +0800 Subject: [PATCH] change logic of 'createtime' and 'changetime' for get-azresource (#18293) * add createtime and changetime for get-azresource * add changelog for change --- .../ResourceManager/SdkModels/Resources/PSResource.cs | 5 ++--- src/Resources/Resources/ChangeLog.md | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Resources/ResourceManager/SdkModels/Resources/PSResource.cs b/src/Resources/ResourceManager/SdkModels/Resources/PSResource.cs index dea27a95ff7f..99b963ed653c 100644 --- a/src/Resources/ResourceManager/SdkModels/Resources/PSResource.cs +++ b/src/Resources/ResourceManager/SdkModels/Resources/PSResource.cs @@ -149,9 +149,8 @@ public PSResource(Resource resource): this( TagsHelper.GetTagsDictionary(TagsHelper.GetTagsHashtable(resource.Tags)) ) { - this.CreatedTime = resource.CreatedTime; - this.ChangedTime = resource.ChangedTime; - + if ( resource.Properties["creationTime"] == null) { this.CreatedTime = null;} else {this.CreatedTime = Convert.ToDateTime(resource.Properties["creationTime"]);} + if ( resource.Properties["lastModifiedTime"] == null) { this.ChangedTime = null;} else {this.ChangedTime = Convert.ToDateTime(resource.Properties["lastModifiedTime"]);} this.SubscriptionId = string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetSubscriptionId(resource.Id); this.ResourceGroupName = string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetResourceGroupName(resource.Id); this.ExtensionResourceName = string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetExtensionResourceName(resource.Id); diff --git a/src/Resources/Resources/ChangeLog.md b/src/Resources/Resources/ChangeLog.md index 09f6195bd895..f2d5452c05a1 100644 --- a/src/Resources/Resources/ChangeLog.md +++ b/src/Resources/Resources/ChangeLog.md @@ -19,6 +19,7 @@ --> ## Upcoming Release +* Fixed logic of `createtime` and `ChangedTime` in `Get-AzResource --ExpandProperties`. [#18206] ## Version 6.0.0 * Added cmdlet for Application federated identity credential