Skip to content

Instantly share code, notes, and snippets.

@ericphan
Last active July 14, 2022 11:01
Show Gist options
  • Select an option

  • Save ericphan/318fa577e9fa37a6738b4db935d30d29 to your computer and use it in GitHub Desktop.

Select an option

Save ericphan/318fa577e9fa37a6738b4db935d30d29 to your computer and use it in GitHub Desktop.
Import-Module AzureAD
Connect-AzureAD
$adGroupId = "<Azure AD Group Id here>"
$users = Get-AzureADGroupMember -ObjectId $adGroupId
foreach ($u in $users)
{
Write-Host $u.DisplayName
Set-AzureADUser -ObjectId $u.Mail -Department "<New Value to update here>"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment