Skip to content

Commit

Permalink
Fix exception in Get-AzResource with ApiVersion (Azure#24041)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnykarlsson authored Jan 26, 2024
1 parent d6b7b40 commit 7c22677
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@ public PSResource(Resource<JToken> resource): this(
TagsHelper.GetTagsDictionary(TagsHelper.GetTagsHashtable(resource.Tags))
)
{
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"]);}
if (resource.Properties != null)
{
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);
Expand Down
1 change: 1 addition & 0 deletions src/Resources/Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

## Upcoming Release
* Updated Bicep build logic to use --stdout flag instead of creating a temporary file on disk.
* Fixed exception when `-ApiVersion` is specified for `Get-AzResource`, affected by some resource types.

## Version 6.14.0
* Fixed ABAC condition not included in role definition payload. Get-AzRoleDefinition will now contain ABAC Condition and ConditionVersion info when applicable.
Expand Down

0 comments on commit 7c22677

Please sign in to comment.