Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Resources/Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-->

## Upcoming Release
* Fixed issue where RoleAssignment cmdlets did not properly handle insufficient MSGraph permissions [#28583]

## Version 8.1.0
* Added functionality for cmdlet `GetAzureResourceGroup`[#27865]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ public static PSRoleAssignment ToPSRoleAssignment(this RoleAssignment assignment
{
if (oe.IsAuthorizationDeniedException() || oe.IsNotFoundException())
{
adObject = new PSADObject() { Id = assignment.PrincipalId, Type = UnknownType};
// fall back to cached principal type from response,
// then finally fall back to "Unknown"
adObject = new PSADObject() { Id = assignment.PrincipalId, Type = assignment.PrincipalType ?? UnknownType};
}
//Swallow exceptions when displaying active directive object
}
Expand Down Expand Up @@ -197,7 +199,7 @@ public static IEnumerable<PSRoleAssignment> ToPSRoleAssignments(this IEnumerable
foreach (RoleAssignment assignment in assignments)
{
assignment.RoleDefinitionId = assignment.RoleDefinitionId.GuidFromFullyQualifiedId();
PSADObject adObject = adObjects.SingleOrDefault(o => o.Id == assignment.PrincipalId) ?? new PSADObject() { Id = assignment.PrincipalId, Type = UnknownType };
PSADObject adObject = adObjects.SingleOrDefault(o => o.Id == assignment.PrincipalId) ?? new PSADObject() { Id = assignment.PrincipalId, Type = assignment.PrincipalType ?? UnknownType };
PSRoleDefinition roleDefinition = roleDefinitions.SingleOrDefault(r => r.Id == assignment.RoleDefinitionId) ?? new PSRoleDefinition() { Id = assignment.RoleDefinitionId };
var psRoleAssignment = new PSRoleAssignment()
{
Expand Down