Others

Install and Connect the Azure AD PowerShell Module

Khadija KhanKhadija Khan Nov 20, 2026 868 views

Question details

The user needs to install and connect the appropriate PowerShell module for Azure Active Directory administration.

Install and Connect the Azure AD PowerShell Module
Product
Microsoft Entra ID and PowerShell
Device & OS
not provided
Scenario
Follow older Azure AD administration instructions or connect to the directory using a supported PowerShell module.
Observed behavior
The separate Microsoft Azure Active Directory PowerShell window shown in older instructions may not appear, and AzureAD and MSOnline use different commands.
Before you start

Open a PowerShell terminal and check which module your script requires. For new work, use Microsoft Graph PowerShell and confirm that your account has the permissions needed for the intended directory task.

Solution 1Recommended

Install and connect Microsoft Graph PowerShell

Use the supported Microsoft Graph module for new Microsoft Entra ID administration scripts.

Microsoft Graph PowerShell replaces many AzureAD and MSOnline tasks, but legacy commands do not necessarily have identical Graph equivalents.

1
Open PowerShell

Open a PowerShell terminal from your device's application menu. A separate Azure AD PowerShell window is not required.

2
Install the module

Run Install-Module Microsoft.Graph -Scope CurrentUser and accept the repository prompt if you trust its source.

3
Connect to Microsoft Graph

Run Connect-MgGraph -Scopes "User.Read" and sign in when prompted. Use the permissions required by your actual task; some permissions require administrator consent.

4
Check the connection

Run Get-MgContext to view the signed-in account, tenant, and granted scopes.

Install and connect Microsoft Graph PowerShell
Migrating an older script: Review Microsoft's current migration documentation to find Graph equivalents and required permissions for each AzureAD or MSOnline command.
Free Microsoft Office alternative

Document PowerShell Procedures with WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility for an easy move from existing documents. Use it to document PowerShell procedures; it does not install modules or manage Microsoft Entra ID.

Document Azure AD and Microsoft Graph PowerShell procedures in WPS WriterOpen and edit Microsoft Word DOCX filesUse a familiar interface to work with existing Office documentsAccess a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why is there no separate Azure AD PowerShell window?

Older instructions may show a dedicated window, but you can run PowerShell module commands in a regular PowerShell terminal.

What is the difference between Connect-AzureAD and Connect-MsolService?

Connect-AzureAD belongs to the legacy AzureAD module, while Connect-MsolService belongs to the legacy MSOnline module. Both modules are retired; use Microsoft Graph PowerShell for supported tasks.

How can I confirm that Microsoft Graph is connected?

After running Connect-MgGraph, run Get-MgContext to check the account, tenant, and granted scopes.

Can I run Restore-MsolUser with the AzureAD module?

No. Restore-MsolUser is an MSOnline command. Check Microsoft's migration documentation for the supported Microsoft Graph approach and its required permissions.

Why might Microsoft Graph ask for administrator consent?

Some permission scopes require administrator approval. Select the scopes needed for your task and ask a tenant administrator to grant consent when required.