Create new user via Microsoft Graph using PowerShell

cls # Load Active Directory Authentication Library (ADAL) Assemblies $adal = “${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.dll” $adalforms = “${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll” [System.Reflection.Assembly]::LoadFrom($adal) [System.Reflection.Assembly]::LoadFrom($adalforms) $cred = Get-Credential $mycred = new-object Microsoft.IdentityModel.Clients.ActiveDirectory.UserCredential($cred.UserName,$cred.Password) # Defining Azure AD tenant name, this is the name of your Azure Active Directory $adTenant = ”??????.onmicrosoft.com” $login = Add-AzureRmAccount -Credential $cred Get-AzureRmSubscription Select-AzureRmSubscription -SubscriptionID ‘??????‘ # Set…

0

user management using the AzureAD powershell module

cls $cred = Get-Credential #Connect to your AzureAD tenant Connect-AzureAD -Credential $cred # Get a user by UPN $user = Get-AzureADUser -ObjectId “user1@????.onmicrosoft.com” $user | fl # Update some properties $user = Set-AzureADUser -ObjectId $user.UserPrincipalName -Department “Azure Architecture” -Country “Turkey” # Get a user by UPN $user = Get-AzureADUser -ObjectId “user1@????.onmicrosoft.com” $user | fl

1