Sunday, August 8, 2021

Azure Active Directory User(s) Creation using Powershell


In this lab, you will learn how to create an Azure Active Directory user id(s) using Azure Powershell.


User should be part of Global Administration or User Administration Role.

Create AAD User(s) using Powershell:

Creation of user accounts using PowerShell on your local machine requires the following. However, you can also use Azure Powershell in Cloudshell step 1 is not required.

1) Azure Active Directory PowerShell Modules, here is the command that is required to install AAD PowerShell modules on your machine.

 Install-Module AzureAD

2)Authentication to Azure Active Directory. Once installation of AAD PS modules is done run the following command for authentication.

 $AzureAdCred = Get-Credential
 Connect-AzureAD -Credential $AzureAdCred

In this demonstration, we will see creation users using Azure Cloudshell.

Log in to Azure portal and connect to Cloudshell as shown below.


Make sure you are connected to PowerShell within the Cloudshell, If not switch from Bash to Powershell.

Below are the commands for the creation of user Vuser5

$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile $PasswordProfile.Password = "Test@123"

New-AzureADUser -AccountEnabled $True -DisplayName "Vuser5" -PasswordProfile $PasswordProfile -MailNickName "Vuser5" -UserPrincipalName ""

No comments:

Post a Comment