The Remove-MgUser cmdlet in PowerShell removes a user from Microsoft Graph.
To use the Remove-MgUser cmdlet, you must first connect to your Microsoft 365 tenant using the
Connect-MGraph cmdlet. Once you are connected, you can use the Remove-MgUser cmdlet to remove a user.
Connect-MgGraph -Scopes User.ReadWrite.All
The syntax to delete a user from the Azure AD is given below.
Remove-MgUser -UserId <String> -InputObject <IUsersIdentity> [-IfMatch <String>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
In this article, we will discuss how to use the Remove-MgUser cmdlet in PowerShell to remove a user from Microsoft Graph.
How to Remove a User from Azure AD
To remove a user from Azure AD, run the following command.
Remove-MgUser -UserId 'dd838304-2d3c-4b57-968a-999d9df040a8'
This command removes a user.
I hope the above article on how to use the Remove-MgUser cmdlet in PowerShell to delete a user from Microsoft Graph is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.