Install the Microsoft Entra PowerShell module
Important
Microsoft Entra PowerShell cmdlets are currently in preview and might change. We recommend using these cmdlets for testing and development purposes only, and not in production applications at this time.
The Microsoft Entra PowerShell module is available in two modules, which can be installed independently:
- Microsoft.Graph.Entra - the General Availability or
v1.0
version of Microsoft Entra PowerShell. It points to Microsoft Graph v1.0 and Microsoft Graph PowerShell SDK v1.0 resources. - Microsoft.Graph.Entra.Beta - the
Beta
version of Microsoft Entra PowerShell. It points to Microsoft Graph beta and Microsoft Graph PowerShell SDK beta resources.
A supported version of PowerShell version 7 or higher is the recommended version of PowerShell for use with the Microsoft Entra PowerShell module on all platforms including Windows, Linux, and macOS.
Install the Microsoft Entra PowerShell module on Windows
The recommended installation method and PowerShell version for the module:
- Install from the PowerShell Gallery
- Use with PowerShell version 5.1+ or version 7+.
Prerequisites on Windows
Run the following command from PowerShell to determine your PowerShell version:
$PSVersionTable.PSVersion
Determine if you have the module installed:
Get-Module -Name Microsoft.Graph.Entra -ListAvailable
- Install a supported version of PowerShell version 7 or higher
Set the PowerShell execution policy to remote signed or less restrictive
Check the PowerShell execution policy:
Get-ExecutionPolicy -List
Set the PowerShell execution policy to remote signed:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
For more information about execution policies, see about_Execution_Policies.
Installation
Use the Install-Module cmdlet to install the module:
Install-Module -Name Microsoft.Graph.Entra -Repository PSGallery -Scope CurrentUser -AllowPrerelease -Force
Optionally, you can change the scope of the installation using the Scope parameter. This operation requires admin permissions.
Install-Module -Name Microsoft.Graph.Entra -Repository PSGallery -Scope AllUsers -AllowPrerelease
To install the Beta
module, run the following command.
Install-Module -Name Microsoft.Graph.Entra.Beta -Repository PSGallery -AllowPrerelease
Tip
In PowerShell 5.1, you might see the error: "Function {cmdlet-name} cannot be created because function capacity 4096 has been exceeded." To fix this, increase the function limit by running the following command, then try importing the module again.
$MaximumFunctionCount = 32768
Install Microsoft Entra PowerShell on Linux
This article explains how to install the module on Linux.
Prerequisites on Linux
Install a supported version of PowerShell version 7 or higher
Install Microsoft Graph PowerShell SDK module dependencies if not installed.
Installation on Linux
Open the Terminal or other shell host application and run pwsh
to start PowerShell.
Use the Install-Module cmdlet to install the module:
Install-Module -Name Microsoft.Graph.Entra -AllowPrerelease -Repository PSGallery -Force
Install Microsoft Entra PowerShell on macOS
This article explains how to install the module from the PowerShell Gallery on macOS.
Prerequisites on macOS
- Install a supported version of PowerShell version 7 or higher
Installation on macOS
Open the Terminal or other shell host application and run pwsh
to start PowerShell.
Use the Install-Module cmdlet to install the Microsoft Entra PowerShell module:
Install-Module -Name Microsoft.Graph.Entra -AllowPrerelease -Repository PSGallery -Force
Verify installation
After the installation is completed, you can verify the installed version with the following command.
Get-InstalledModule -Name Microsoft.Graph.Entra
To verify the installed submodules and their versions, run:
Get-InstalledModule
The version in the output should match the latest version published on the PowerShell Gallery. Now you're ready to use the module.
Troubleshoot installation issues
Error | Cause | Workaround |
---|---|---|
Install-Module: A parameter can't be found that matches parameter name AllowPrerelease. | You're using an older version of Install-Module. | To upgrade, follow this guide. The issue applies to Windows platform only. |
Dependent module 'module-name' isn't installed on this computer. To use the current module 'Microsoft.Graph.Entra,' ensure that its dependent module 'module-name' is installed. | Microsoft Entra PowerShell dependencies aren't installed | To install, use this script |
Cmdlets already exist on the system | Add -AllowClobber parameter: Install-Module -Name Microsoft.Graph.Entra -AllowPrerelease -Repository PSGallery -Force -AllowClobber |
|
The following commands are already available on this system: 'Enable-EntraAzureADAlias,Get-EntraUnsupportedCommand,Test-EntraScript' | There's a conflict when either beta or v1.0 is already installed |
To resolve the issue, uninstall the offending module version. |
For solutions to other common installation and other general issues, see Troubleshoot module installation problems.
Sign in
To start managing your Microsoft Entra resources with the Microsoft Entra PowerShell module, launch a PowerShell session and run Connect-Entra to sign in to Microsoft Entra ID:
Connect-Entra -Scopes 'User.Read.All'
Get-EntraUser -Filter "userPrincipalName eq 'SawyerM@contoso.com'"
Use your Microsoft Entra sign-in credentials to log into the sign-in window that opens.
You need to repeat this step for every new PowerShell session you start.
For more information on other authentication scenarios, see more authentication scenarios.
Update the module
Use Update-Module to update to the latest version of the Microsoft Entra PowerShell.
Update-Module -Name Microsoft.Graph.Entra -AllowPrerelease
Updating the Microsoft Entra PowerShell module using Update-Module
doesn't remove old versions of the module from your system.
Uninstall the module
To remove the module, run the command:
Uninstall-Module -Name Microsoft.Graph.Entra -AllVersions
To remove the beta
module, run the command:
Uninstall-Module -Name Microsoft.Graph.Entra.Beta -AllVersions
Next steps
- To learn more about managing Entra resources with the Microsoft Entra PowerShell module, see Get started article.