SharePoint Online: Delete User Profile using PowerShell

Requirement: Delete User Profile in SharePoint Online using PowerShell

How to Delete a User Profile in SharePoint Online?
SharePoint Online user profiles gets deleted when a User account is deleted or disabled in Active Directory. To delete user profile in in SharePoint Online, do the following:
  • Sign in to https://admin.microsoft.com as a Global Admin or SharePoint Online Admin. 
  • In the left pane, under Admin centers, select SharePoint.
  • In the left pane of the classic SharePoint admin center, select user profiles.
  • Go to User profiles > Manage User Profiles > Search for your user
  • Select the user and click on "Delete" link to delete the user profile in SharePoint Online.
    sharepoint online delete user profile powershell

Deleting user profile in CSOM is not implemented so far, as per: https://docs.microsoft.com/en-us/sharepoint/dev/general-development/work-with-user-profiles-in-sharepoint

SharePoint Online: Delete User Profile using PowerShell
Open SharePoint Online Management Shell and run the below script to delete a user profile from SharePoint Online.
#Connect to SharePoint Online
Connect-SPOService -Url https://thecrescenttech-admin.sharepoint.com

#Remove User Profile
Remove-SPOUserProfile -LoginName Ajay@thecrescenttech.com
This PowerShell deletes user profile in SharePoint Online. Make sure the user account is already deleted in Azure Active Directory, prior to remove the user profile.
SharePoint Online: Delete User Profile using PowerShell SharePoint Online: Delete User Profile using PowerShell Reviewed by Salaudeen Rajack on July 15, 2018 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.