Q. I'm trying to delete all service principals in an Azure AD instance so I can delete the Azure AD instance but some cannot be deleted what do I do?
A. See if you actually can delete your intended targets.
There are certain service principals in Azure AD that cannot be deleted. If you try a command like the following:
Get-MSOLServicePrincipal | Remove-MSOLServicePrincipal
You may receive an error for certain service principals that will report they are invalid for deletion. While service principals cannot be deleted, they are actually whitelisted against the deletion task for an Azure AD instance. This means even though these service principals still exist, the deletion of the Azure AD instance will not be stopped.