The Connect-MgGraph cmdlet is used to initiate a connection to Microsoft Graph using Microsoft Graph PowerShell. This command authenticates the session and grants access to Microsoft Entra ID resources and other Microsoft 365 services.
Running the Connect-Graph cmdlet is the first step before executing any other Graph cmdlets, as it ensures that the session is authenticated and authorized based on the scopes provided.
Before running the Connect-MgGraph cmdlet, ensure the following:
Install-Module Microsoft.Graph -Scope CurrentUser
Run the following command to connect to Microsoft Graph:
Connect-MgGraph
Example 1: Connect with specific scopes
Connect-MgGraph -Scopes "User.Read.All", "Directory.Read.All"
Example 2: Connect to a specific tenant
Connect-MgGraph -TenantId "zkyy.com"
| Parameters | Description |
|---|---|
| -Scopes | This parameter can be used to specify one or more scopes. |
| -TenantId | This parameter can be used to specify the tenant ID or domain to connect to. |
| -ClientId | This parameter can be used to specify the client application ID for app-based authentication. |
| -UseDeviceAuthentication | This parameter can be used to enable device code flow for authentication. |
ADManager Plus is an IGA solution with capabilities to manage and report on hybrid Active Directory environments from a single, centralized console. Designed with IT admins in mind, ADManager Plus eliminates the need for complex PowerShell scripting by offering a GUI-driven interface for day-to-day administrative tasks, reporting, and automation.
ADManager Plus eliminates the need for manual PowerShell scripting and enables: