From 3fe41e7fe122e2fa175b213f088eee978b025f47 Mon Sep 17 00:00:00 2001 From: Nori Zhang Date: Tue, 12 Sep 2023 15:28:24 +0800 Subject: [PATCH] Fix Possible error when subscription is null in Get-AzRoleAssignment --- .../Resources/RoleAssignments/GetAzureRoleAssignmentCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/Resources/RoleAssignments/GetAzureRoleAssignmentCommand.cs b/src/Resources/Resources/RoleAssignments/GetAzureRoleAssignmentCommand.cs index a2a7e5613034..23880bef2da6 100644 --- a/src/Resources/Resources/RoleAssignments/GetAzureRoleAssignmentCommand.cs +++ b/src/Resources/Resources/RoleAssignments/GetAzureRoleAssignmentCommand.cs @@ -240,7 +240,7 @@ public override void ExecuteCmdlet() ResourceGroupName = ResourceGroupName, ResourceName = ResourceName, ResourceType = ResourceType, - Subscription = string.IsNullOrEmpty(ResourceGroupName) ? null : DefaultProfile.DefaultContext.Subscription.Id + Subscription = string.IsNullOrEmpty(ResourceGroupName) ? null : DefaultProfile.DefaultContext.Subscription?.Id?.ToString() }, ExpandPrincipalGroups = ExpandPrincipalGroups.IsPresent, IncludeClassicAdministrators = IncludeClassicAdministrators.IsPresent,