Add new guest user to azure powershell command line

To add a new guest user to Azure using PowerShell, you can use the following command:

New-AzADUser -DisplayName "New Guest User" -UserPrincipalName "newguestuser@<tenant_name>.onmicrosoft.com" -MailNickname "newguestuser" -AccountEnabled $true -MailEnabled $true -UsageLocation "US" -Force

Replace <tenant_name> with the name of your Azure Active Directory (AAD) tenant.

Here's a breakdown of the parameters:

Once you run this command, the new guest user will be created in your Azure AD tenant. Note that guest users are not assigned to any Azure AD groups by default, so you may need to add them to a group manually if required.

To verify that the user has been created, you can use the following command:

Get-AzADUser -UserPrincipalName "newguestuser@<tenant_name>.onmicrosoft.com"

This will display information about the new user, including their display name, UPN, and account status.