Sometimes we need to delete an object from Azure AD which is synced with the local AD but despite moving the object (user, group or a contact) to a non-synced OU, which is technically equivalent to asking Azure AD to delete the object, the deletion does not take place. As the objects are synced from local AD so we cannot delete the object directly using the Office Admin portal
https://portal.office.com/adminportal/home
So one of the obvious choice in this particular case is to stop the sync from local AD to Azure AD. We can stop the sync using this command
Set-MsolDirSyncEnabled –EnableDirSync $false
Although it can take up to 72 hours as per Microsoft documentation, but usually it takes less. In my case I disabled sync before leaving from work around 5 pm in the evening and next morning at 9 am I was able to delete the object using the Office Admin portal. Once that is done we can re-enable the sync.
Set-MsolDirSyncEnabled –EnableDirSync $true
To check the status of the sync this command is used:
(Get-MSOLCompanyInformation).DirectorySynchronizationEnabled