Skip to content

Instantly share code, notes, and snippets.

@darrenjrobinson
Last active December 1, 2018 22:13
Show Gist options
  • Save darrenjrobinson/95cb755720abdb88e84acc667499a969 to your computer and use it in GitHub Desktop.
Save darrenjrobinson/95cb755720abdb88e84acc667499a969 to your computer and use it in GitHub Desktop.
Goodbye Set-MsolUser, Hello Set-AzureADUser & Azure Graph API. Associated blog post is located here https://blog.darrenjrobinson.com/goodbye-set-msoluser-hello-set-azureaduser-azure-graph-api/
# Import the Module to your PowerShell Session
Import-Module AzureADPreview
#Connect to your AzureAD tenant
Connect-AzureAD
# Get a user by UPN
$user = Get-AzureADUser -ObjectId "skollegger@live.darrenjrobinson.info"
$user
# Update the user
$user = Set-AzureADUser -ObjectId $user.UserPrincipalName -Department "Diagnostics" -Country "AU"
$user = Get-AzureADUser -ObjectId "skollegger@live.darrenjrobinson.info"
$user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment