How to disconnect from a Microsoft Graph PowerShell session

When you've signed in to your Microsoft Entra ID tenant with the Microsoft Graph PowerShell cmdlet Connect-MgGraph , it stores a cached token so you don't have to repeat the process. You might want to disconnect from the session to switch between different tenants or accounts, offboard users, or clear cached credentials on shared machines. To accomplish this, you'll need the Disconnect-MgGraph cmdlet. This will terminate your session and disconnect you from the Graph service.

Using the Disconnect-MgGraph cmdlet to disconnect a Graph session

Run the following cmdlet in Microsoft Graph PowerShell:

Disconnect-MgGraph

Limitations of using Microsoft Graph PowerShell to manage Microsoft Entra ID

  • Scripts require strong technical prowess, and admins often spend a lot of time honing their skills and debugging errors.
  • Even an insignificant error, such as a missed colon or space, could lead to a series of errors.
  • Sufficient permissions are required in Microsoft Entra ID in order to execute certain scripts.

How ADManager Plus can help you manage Microsoft Entra ID

ADManager Plus, an identity governance and administration solution with comprehensive Microsoft Entra ID management and reporting capabilities, simplifies complex admin tasks from a single, user-friendly console:

  • Manage your Active Directory (AD), Microsoft Entra ID, and Google Workspace environments from a single, user-friendly console.
  • Automate and orchestrate user provisioning, deprovisioning, license management, and many other administrative tasks across various platforms.
  • Delegate administrative tasks to technicians without elevating their native privileges.
  • Keep tabs on the delegated activities with preconfigured reports and smart workflows.
  • Monitor your IT environment with more than 200 pre-packaged reports.
  • Disaster-proof your organization with AD, Microsoft Entra ID, and Google Workspace backup and recovery.

Perform script-free Microsoft Entra ID management and reporting with ADManager Plus

 
  • Using the Disconnect-MgGraph cmdlet to end a Graph session
  • Limitations of using Microsoft Graph PowerShell
  • How ADManager Plus can help you manage Entra ID
The one-stop solution to Active Directory Management and Reporting
Email Download Link