Deleting a User from O365 and AD
If you installed Azure AD Connect syncing users from on premise Active Directory you will be unable to delete user accounts from the Office portal. You can delete the user from your on-premises server. Upps, you already deleted user from on your on-premises AD. What you should do?
“Couldn’t delete this user because the account is synchronized with your on-premises servers. You can delete the user from your on-premises server”
If you delete user/group from your on-prem AD, and are using Azure AD sync, and it doesn’t get deleted from the online tenant, you can manually delete it this way.
You can download the Azure AD Powershell module using the following command
Install-Module -Name AzureRM -AllowClobber
Then “Install-Module Msonline” and “Install-Module AzureAD”
You can then connect to Office 365 using the following command
The Set-MsolDirSyncFeature cmdlet sets identity synchronization features for a tenant. We need to disable directory sync for a while.
Set-MsolDirSyncEnabled -EnableDirSync $false
Once this command has run, it takes minimum 5 minutes to propagate through Azure AD