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