The Remove-MgDomain cmdlet in Microsoft Graph PowerShell allows IT administrators to remove a domain from a Microsoft Entra ID (formerly Azure AD) tenant. It helps maintain a clean tenant, prevents security risks, ensures compliance, resolves authentication issues, and avoids service conflicts in Microsoft 365.
Before using the Remove-MgDomain cmdlet, ensure the following:
Install-Module Microsoft.Graph -Scope CurrentUser
Run the following script to remove a domain:
Remove-MgDomain -DomainId "zky.com"
Example 1: Remove a domain from Microsoft Entra ID.
Remove-MgDomain -DomainId "zky.com"
| Parameters | Description |
|---|---|
| -DomainId | This parameter can be used to specify the domain you would like to remove. |
| -WhatIf | This parameter allows you to simulate the command without executing it. |
| -Confirm | This parameter asks for confirmation before executing the cmdlet. |
ManageEngine ADManager Plus is an identity governance and administration tool with Microsoft 365 management and reporting capability that streamlines administrative tasks by eliminating the need for complex PowerShell scripting. With its intuitive, script-free interface and advanced capabilities, it enables effortless management of objects across Active Directory, Microsoft 365, and Google Workspace platforms.