Sunday, August 8, 2021

Azure Active Directory User(s) Creation using Powershell

Goal: 



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

Requirements: 

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 "Vuser5@vemula4uhotmail.onmicrosoft.com"









No comments:

Post a Comment