# Disable Microsoft 365 / Entra ID Federation with PowerShell

1. [Install the Microsoft Graph PowerShell](https://docs.coltscomputer.services/books/windows/page/connect-to-microsoft-365-with-microsoft-graph-powershell "Connect to Microsoft 365 with Microsoft Graph PowerShell").
2. Set the Execution Policy to Remote Signed:

<kbd>Set-ExecutionPolicy RemoteSigned</kbd>

3. Connect to your Microsoft 365 / Entra ID tenant:

<kbd>Connect-MGGraph -Scopes "Domain.ReadWrite.All", "Directory.AccessAsUser.All", "Organization.ReadWrite.All", "Directory.ReadWrite.All"</kbd>

4. Enter your Office 365 Global Administrator Credentials.
5. Consent and Accept the requested scopes.
6. Verify the domain is federated:

<kbd>Get-MgDomain -DomainId “&lt;YourO365Domain.com&gt;”</kbd>

7. Change Federation Authentication from **federated** to **managed**:

<kbd>Update-MgDomain –DomainId “&lt;YourO365Domain.com&gt;” -AuthenticationType Managed</kbd>

8. To check Federation status:

<kbd>Get-MgDomain -DomainId “&lt;YourO365Domain.com&gt;”</kbd>

9. Disconnect Microsoft Graph:

<kbd>Disconnect-MGGraph</kbd>