Install the Microsoft Entra PowerShell module
The Microsoft Entra PowerShell module is split into two modules, each with submodules that can be installed separately. The two main modules are:
- Microsoft.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.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 Windows PowerShell 5.1+ or PowerShell 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.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
When installing the module, you can choose to install the entire module or a specific submodule. The following examples show how to install the entire module for both v1.0
and Beta
.
Use the Install-Module cmdlet to install the module.
Install-Module -Name Microsoft.Entra -Repository PSGallery -Scope CurrentUser -Force -AllowClobber
Optionally, you can change the scope of the installation using the Scope parameter. This operation requires admin permissions.
Install-Module -Name Microsoft.Entra -Repository PSGallery -Scope AllUsers -Force -AllowClobber
Install specific submodules
Installing specific modules is ideal for automation scenarios such as using Azure Functions and Azure Automation.
Run the following command to list all Microsoft.Entra
GA/v1.0 modules in the PowerShell Gallery:
Find-Module -Name "Microsoft.Entra*" -Repository PSGallery |
Where-Object { $_.Name -notmatch "beta" }
This command lists all Microsoft Entra PowerShell GA/v1.0
modules in the PowerShell Gallery.
For example, to install the Users
module, run the following command:
Install-Module -Name Microsoft.Entra.Users -Repository PSGallery -Force -AllowClobber
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
When installing the module, you can choose to install the entire module or a specific submodule. The following example shows how to install the entire module.
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.Entra -Repository PSGallery -Scope CurrentUser -Force -AllowClobber
Optionally, you can change the scope of the installation using the Scope parameter. This operation requires admin permissions.
Install-Module -Name Microsoft.Entra -Repository PSGallery -Scope AllUsers -Force -AllowClobber
Install specific submodules on Linux
Installing specific modules is ideal for automation scenarios such as using Azure Functions and Azure Automation.
Run the following command to list all Microsoft.Entra
GA/v1.0 modules in the PowerShell Gallery:
Find-Module -Name "Microsoft.Entra*" -Repository PSGallery |
Where-Object { $_.Name -notmatch "beta" }
This command lists all Microsoft Entra PowerShell GA/v1.0
modules in the PowerShell Gallery.
For example, to install the Users
module, run the following command:
Install-Module -Name Microsoft.Entra.Users -Repository PSGallery -Force -AllowClobber
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
When installing the module, you can choose to install the entire module or a specific submodule. The following example shows how to install the entire module.
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.Entra -Repository PSGallery -Scope CurrentUser -Force -AllowClobber
Optionally, you can change the scope of the installation using the Scope parameter. This operation requires admin permissions.
Install-Module -Name Microsoft.Entra -Repository PSGallery -Scope AllUsers -Force -AllowClobber
Install specific submodules on macOS
Installing specific modules is ideal for automation scenarios such as using Azure Functions and Azure Automation.
Run the following command to list all Microsoft.Entra
GA/v1.0 modules in the PowerShell Gallery:
Find-Module -Name "Microsoft.Entra*" -Repository PSGallery |
Where-Object { $_.Name -notmatch "beta" }
This command lists all Microsoft Entra PowerShell GA/v1.0
modules in the PowerShell Gallery.
For example, to install the Users
module, run the following command:
Install-Module -Name Microsoft.Entra.Users -Repository PSGallery -Force -AllowClobber
Verify installation
After the installation is completed, you can verify the installed submodules and their version with the following command.
Get-InstalledModule -Name Microsoft.Entra* |
Where-Object { $_.Name -notmatch "Beta" }
To verify if a specific submodule for example, Users
is installed, run:
Get-InstalledModule -Name Microsoft.Entra.Users
The output version should match the latest version on the PowerShell Gallery. You're now 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.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.Entra -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.Entra -Force
To update a specific submodule, such as Users
, run:
Update-Module -Name Microsoft.Entra.Users -Force
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.Entra -AllVersions -Force
To uninstall a specific submodule, such as Users
, run:
Uninstall-Module -Name Microsoft.Entra.Users -AllVersions -Force
To uninstall all the submodules, run:
$InstalledSubModules = Get-InstalledModule -Name Microsoft.Entra.* |
Where-Object { $_.Name -notmatch "Beta" }
foreach ($module in $InstalledSubModules) {
Write-Host "Checking for submodule: $($module.Name)" -ForegroundColor Yellow -BackgroundColor DarkBlue
Uninstall-Module -Name $module.Name -Force -ErrorAction Stop
Write-Host "Successfully uninstalled submodule: $($module.Name)" -ForegroundColor Green
}
Next steps
- To learn more about navigating the Microsoft Entra PowerShell module, see the Navigate the module article.