Microsoft Entra PowerShell modules

The new Microsoft Entra PowerShell modules are available, replacing the deprecated AzureAD modules. This blog post will highlight the installation, changes, and features.

What is Microsoft Entra PowerShell

“The Microsoft Entra PowerShell module is a command-line tool that allows administrators to manage and automate Microsoft Entra resources programmatically. This includes efficiently managing users, groups, applications, service principals, policies, and more. The module builds upon and is part of the Microsoft Graph PowerShell SDK. It’s fully interoperable with all cmdlets in the Microsoft Graph PowerShell SDK, enabling you to perform complex operations with simple, well-documented commands. The module also offers a backward compatibility option to streamline migration from the retiring AzureAD PowerShell module. Microsoft Entra PowerShell works with Windows PowerShell 5.1 and PowerShell 7+. For the best experience on Windows, Linux, and macOS, we recommend using PowerShell 7 or later.”

Source: https://learn.microsoft.com/en-us/powershell/entra-powershell/overview?view=entra-powershell

Benefits of Microsoft Entra PowerShell

Microsoft Entra PowerShell provides the following benefits:

  • Focus on usability: Microsoft Entra PowerShell offers human-readable parameters, deliberate parameter set specification, inline documentation, and core PowerShell fundamentals like pipelining.
  • Backward compatibility with Azure AD PowerShell module: Microsoft Entra PowerShell simplifies migration from the retiring Azure AD PowerShell module.
  • Open source: Microsoft Entra PowerShell module is open source, enabling community collaboration to enhance PowerShell and share innovations. You can explore Microsoft’s customizations and adapt them to your needs.

Source: https://learn.microsoft.com/en-us/powershell/entra-powershell/overview?view=entra-powershell#benefits-of-microsoft-entra-powershell

How to install it

Windows

If you have met the prerequisites, PowerShell 5.1+ or PowerShell 7+, then you can install it by running: (Change -Scope CurrentUser to -Scope AllUsers if you have admin privileges to install it for the whole system)

v1.0

Install-Module -Name Microsoft.Entra -Repository PSGallery -Scope CurrentUser -Force -AllowClobber

Beta

Install-Module -Name Microsoft.Entra.Beta -Repository PSGallery -Scope CurrentUser -Force -AllowClobber 

Linux

If you have met the prerequisites, PowerShell v7 and the Microsoft Graph Modules (Check https://learn.microsoft.com/en-us/powershell/entra-powershell/troubleshooting?view=entra-powershell&tabs=both#missing-dependencies), then you can install it from within PowerShell v7 by running: (Change -Scope CurrentUser to -Scope AllUsers if you have admin privileges to install it for the whole system)

v1.0

Install-Module -Name Microsoft.Entra -Repository PSGallery -Scope CurrentUser -Force -AllowClobber

Beta

Install-Module -Name Microsoft.Entra.Beta -Repository PSGallery -Scope CurrentUser -Force -AllowClobber 

macOS

If you have met the prerequisites, PowerShell v7, then you can install it from within PowerShell v7 by running: (Change -Scope CurrentUser to -Scope AllUsers if you have admin privileges to install it for the whole system)

v1.0

Install-Module -Name Microsoft.Entra -Repository PSGallery -Scope CurrentUser -Force -AllowClobber

Beta

Install-Module -Name Microsoft.Entra.Beta -Repository PSGallery -Scope CurrentUser -Force -AllowClobber

Migrate from Azure AD PowerShell module

The new modules are over 98% compatible with the old AzureAD/AzureADPreview modules. Using the Enable-EntraAzureADAlias command, you only need to update one or two lines in your existing scripts, making migration to Microsoft Entra PowerShell quick and effortless. See the Migration guide for more information on migrating from the legacy modules to Microsoft Entra PowerShell.

Sign in to Entra ID

To use the Microsoft Entra modules, you must sign in to your tenant first, of course 🙂 You can do that by running: (The Scope is User.Read.All in this example, change accordingly for the purpose you want to use)

PS C:\Users\HarmVeenstra> Connect-Entra -Scopes 'User.Read.All'
Welcome to Microsoft Graph!

Connected via delegated access using 14d82eec-204b-4c2f-b7e8-296a70dab67e
Readme: https://aka.ms/graph/sdk/powershell
SDK Docs: https://aka.ms/graph/sdk/powershell/docs
API Docs: https://aka.ms/graph/docs

NOTE: You can use the -NoWelcome parameter to suppress this message.

Find available commands

To get a complete overview of the available command, you can run “Get-Command -Module Microsoft.Entra*” which will give you a (Long!) overview:

1188 in total (v1.0 and Beta) 🙂

Best practices

I will discover and create my own best practices for the Microsoft Entra Modules, but Microsoft has a nice and detailed document for that: https://learn.microsoft.com/en-us/powershell/entra-powershell/entra-powershell-best-practices?view=entra-powershell.

Testing current script compatibility

The Test-EntraScript cmdlet verifies if a script with Azure AD PowerShell commands works with the Microsoft Entra PowerShell module. If there are compatibility issues, it lists them, including the line number, issue type, incompatible command, and the specific code snippet. (Source: https://learn.microsoft.com/en-us/powershell/entra-powershell/migration-guide?view=entra-powershell#test-compatibility-with-test-entrascript-command )

Known issues

Please check this link for any known issues. Current issues / possible workarounds are:

Learn the basics

Microsoft released seven detailed how-to guides at this moment:

FAQ

A list of FAQs can be found here: https://learn.microsoft.com/en-us/powershell/entra-powershell/entra-powershell-faqs?view=entra-powershell.

Troubleshooting

Microsoft has a detailed article on troubleshooting common errors: https://learn.microsoft.com/en-us/powershell/entra-powershell/troubleshooting?view=entra-powershell&tabs=v1.

Version History

Details about the versions can be found here: https://learn.microsoft.com/en-us/powershell/entra-powershell/whats-new-docs?view=entra-powershell&pivots=module-version-history. (Not up-to-date yet, missing information for v1.0.0 and v1.0.1?)

Wrapping up

And that’s the end of the first look at the new Microsoft Entra PowerShell modules 🙂 Major improvement. Check my blogs for Entra scripts in the future to see them in action. Have a lovely weekend!

8 thoughts on “Microsoft Entra PowerShell modules

  1. I am a retired home user with no corporate or enterprise concerns. However, I do use PowerShell so will Entra PowerShell be of benefit to me?

      1. Thanks, Harm; I was tempted because of the “human-readable parameters, deliberate parameter set specification, inline documentation, and core PowerShell fundamentals like pipelining” remark, but other than OneDrive, I don’t use the cloud environment all that much.

  2. How come after I installed the Microsoft.Entra module when I run Get-Command -Module Microsoft.Entra it comes back blank? Isn’t Microsoft.Entra the same as Microsoft.Graph?

Leave a Reply to Harm VeenstraCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.