Forum Discussion
yturaner
Dec 16, 2021Copper Contributor
update user properties from a csv file
Hello
Using Microsoft 365 Azure AD and need a script to update user properties from a csv file (attached file contains the fields needing updating)
How can I do this ?
- somnio0505Brass Contributor
Hi, yturaner
I just leave a simple script below, you need to change some variables for specify user and properties what you want to change.
$userData = Import-Csv "___________.csv"
foreach {$user in $userData)
{
$aadUser = Get-AzureADUser -Filter 'userPrincipalName eq "$user.userPrincipalName"'
Set-AzureADUser -ObjectId $aadUser.ObjectId -State $user.State}
Thank you