Removing all Azure AD / Entra AD assigned roles using PowerShell Microsoft Graph?

EnterpriseArchitect 6,061 Reputation points
2023-07-20T03:48:09.0333333+00:00

Using the PowerShell Microsoft Graph, what is the correct procedure to remove both Azure AD / Entra Assigned and Eligible Assignments from one single Azure AD user as the input?

Old methods: https://learn.microsoft.com/en-us/powershell/module/azuread/remove-azureaddirectoryrolemember?view=azureadps-2.0

What's the new way to achieve the same, as I am not sure how to use this https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.identity.directorymanagement/remove-mgdirectoryrolememberbyref?view=graph-powershell-1.0 or if it will be acting the same as the previous cmdlet?

Any help would be greatly appreciated.

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Harpreet Singh Matharoo 8,401 Reputation points Microsoft Employee Moderator
    2023-07-20T04:33:07.22+00:00

    Hello @EnterpriseArchitect

    Thank you for reaching out. "Remove-MgDirectoryRoleMemberByRef" is a Microsoft Graph PowerShell equivalent command for Azure AD PowerShell command "Remove-AzureADDirectoryRoleMember".

    The new command should work the same way and remove specified member from a directoryRole mentioned in the command parameters.

    I hope this helps and fixes your issue. Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.