If you are looking to perform Azure ad task using PowerShell then you need to know How to Connect to Azure Ad using PowerShell.
We will first have to install the Azure ad module on the PowerShell, following which it will allow to connect to Azure ad.
In this blog, we will get to know all the steps that is required to connect to Azure ad using PowerShell.
Steps to Connect to Azure Ad PowerShell:
Search and run the windows PowerShell on your windows computer, As an administrator:
If its opened correctly as admin, it should look as shown in the below image:
Once opened correctly, we will set the execution policy to remote signed, this will allow us to install and run the script on the PowerShell.
Run the command: Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
If prompted to install, type A and hit enter.
After the execution policy is set we will install the Azure ad PowerShell module by running the command:
Install-Module AzureAD -Force
The above command will force the installation of latest version of azure ad on your PowerShell.
We will then import the Azure Ad module, for that run the command:
Once the module is installed, you should be able to run the command to connect to Azure ad, to connect run the following command:
It will prompt to login with the admin account which has the respective Admin center access.
After you have signed in, you should see a message like this:
You should be able to run Azure ad module commands in the PowerShell which is now connect to azure ad:
Do let me know if you have any question. you can share the same in the comment section.