In this post, I’m going to show you how to connect to Azure AD using PowerShell.
I’ll also show you how to list all of the available commands from the AzureAD module.
Let’s get started.
Note: Your computer will need at least PowerShell version 5.1 to use the Azure AD module. Refer to the article update PowerShell version for instructions on upgrading PowerShell.
Step 1: Install Azure AD Module
Before you can connect to Azure AD with Powershell you first need to install the AzureAD module.
Open PowerShell on your local computer and enter the below command:
You may get a popup that says “PowerShellGet requires NuGET provider version “” or newer”
Click yes to continue.
You may also get a pop up that says “You are installing modules from an untrusted repository.”
Click Yes to continue.
The AzureAD module should now be installed.
You can verify that it is installed by running the below command:
Get-Module AzureAD -ListAvailable
If the module is installed you should see it listed like the screenshot below.
If you already have the AzureAD module installed you can update it with the below command:
Update-Module -Name AzureAD
Now that the module is installed and updated you can move to step 2.
Step 2: Connect to Azure AD Using PowerShell
To connect to Azure AD type the below command:
You will be prompted to sign in with your Azure AD credentials (MFA is supported).
When successfully authenticated it will display your account and TenantID.
You should now be connected to Azure AD via PowerShell.
Pretty easy right?
To get a list of all the AzureAD cmdlets, use the command:
get-command -Module AzureAD
We hope you found this tutorial helpful. And if so, you may be interested in these resources: