The Remove-MsolDomain cmdlet in PowerShell deleted a domain from Microsoft Office 365. The domain being deleted must be empty.
The syntax to remove a domain from Azure Active Directory is given below.
Remove-MsolDomain
-DomainName <String>
[-Force]
[-TenantId <Guid>]
[<CommonParameters>]
In this article, we will discuss how to use the Remove-MsolDomain cmdlet in PowerShell to remove the domain from Azure Active Directory.
How to Remove a Domain from Office 365
To remove a domain from Office 365, use the Remove-MsolDomain cmdlet in PowerShell with the -DomainName
parameter. The -DomainName
parameter is used to specify the fully qualified domain name (FQDN) of the domain to remove.
Remove-MsolDomain -DomainName "shellgeeklab.com" -Force
This command attempts to delete a domain named “shellgeeklab.com” without prompting you for confirmation from Office 365. The domain being deleted must be empty. The remove domain operation will fail if there are any users or groups with email addresses in this domain.
Conclusion
I hope the above article on how to use the Remove-MsolDomain cmdlet in PowerShell to remove a domain from Azure Active Directory is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.