Skip to main content

Disable Microsoft 365 / Entra ID Federation with PowerShell

  1. Install the Microsoft Graph PowerShell.
  2. Set the Execution Policy to Remote Signed:

Set-ExecutionPolicy RemoteSigned

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

Connect-MGGraph -Scopes "Domain.ReadWrite.All", "Directory.AccessAsUser.All", "Organization.ReadWrite.All", "Directory.ReadWrite.All"

  1. Enter your Office 365 Global Administrator Credentials.
  2. Consent and Accept the requested scopes.
  3. Verify the domain is federated:

Get-MgDomain -DomainId “<YourO365Domain.com>”

  1. Change Federation Authentication from federated to managed:

Update-MgDomain –DomainId “<YourO365Domain.com>” -AuthenticationType Managed

  1. To check Federation status:

Get-MgDomain -DomainId “<YourO365Domain.com>”

  1. Disconnect Microsoft Graph:

Disconnect-MGGraph