SOLVED

Bulk update Azure AD with user attributes from CSV

%3CLINGO-SUB%20id%3D%22lingo-sub-1374479%22%20slang%3D%22en-US%22%3EBulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1374479%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20looking%20for%20a%20way%20to%20update%20user%20attributes%20(OfficePhone%20and%20Department)%20for%20about%20500%20users%20from%20a%20CSV%20to%20AzureAD%20using%20a%20powershell.%20Does%20anyone%20know%20of%20a%20script%20that%20I%20could%20use%3F%20I%20am%20new%20here%20and%20if%20I%20have%20not%20given%20enough%20information%2C%20please%20let%20me%20know.%20I%20tried%20using%20Set-AzureADUser%20piping%20records%20using%20a%20foreach%20statement%20from%20a%20csv%20that%20I%20imported%2C%20but%20it%20was%20throwing%20up%20errors.%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EJacob%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1374479%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Active%20Directory%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1375024%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1375024%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F384798%22%20target%3D%22_blank%22%3E%40jebujohn%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3BHello%20Jacob%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%26nbsp%3B%20CSV%20has%20to%20look%20something%20like%20this%3A%3C%2FP%3E%3CP%3EUserPrincipalName%3BDepartment%3BTelephoneNumber%3CBR%20%2F%3Emanfreddelaat%40domain.nl%3BIT%3B0135113333%3CBR%20%2F%3Emanfred%40domain.nl%3BIT%3B0622222222%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20Powershell%20code%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%23%20Connect%20to%20AzureAD%0AConnect-AzureAD%0A%0A%23%20Get%20CSV%20content%0A%24CSVrecords%20%3D%20Import-Csv%20C%3A%5CTemp%5CTest.csv%20-Delimiter%20%22%3B%22%0A%0A%23%20Create%20arrays%20for%20skipped%20and%20failed%20users%0A%24SkippedUsers%20%3D%20%40()%0A%24FailedUsers%20%3D%20%40()%0A%0A%23%20Loop%20trough%20CSV%20records%0Aforeach%20(%24CSVrecord%20in%20%24CSVrecords)%20%7B%0A%20%20%20%20%24upn%20%3D%20%24CSVrecord.UserPrincipalName%0A%20%20%20%20%24user%20%3D%20Get-AzureADUser%20-Filter%20%22userPrincipalName%20eq%20'%24upn'%22%20%20%0A%20%20%20%20if%20(%24user)%20%7B%0A%20%20%20%20%20%20%20%20try%7B%0A%20%20%20%20%20%20%20%20%24user%20%7C%20Set-AzureADUser%20-Department%20%24CSVrecord.Department%20-TelephoneNumber%20%24CSVrecord.TelephoneNumber%0A%20%20%20%20%20%20%20%20%7D%20catch%20%7B%0A%20%20%20%20%20%20%20%20%24FailedUsers%20%2B%3D%20%24upn%0A%20%20%20%20%20%20%20%20Write-Warning%20%22%24upn%20user%20found%2C%20but%20FAILED%20to%20update.%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20else%20%7B%0A%20%20%20%20%20%20%20%20Write-Warning%20%22%24upn%20not%20found%2C%20skipped%22%0A%20%20%20%20%20%20%20%20%24SkippedUsers%20%2B%3D%20%24upn%0A%20%20%20%20%7D%0A%7D%0A%0A%23%20Array%20skipped%20users%0A%23%20%24SkippedUsers%0A%0A%23%20Array%20failed%20users%0A%23%20%24FailedUsers%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGood%20luck!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKind%20Regards%2C%20Manfred%20de%20Laat%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1375708%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1375708%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWorked%20like%20a%20charm.%20Lovely%20to%20learn%20from%20you!%3C%2FP%3E%3CP%3EKeep%20safe%20and%20stay%20blessed%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1400336%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1400336%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F384798%22%20target%3D%22_blank%22%3E%40jebujohn%3C%2FA%3EYou're%20welcome!%20Take%20care!%26nbsp%3B%3CIMG%20class%3D%22lia-deferred-image%20lia-image-emoji%22%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Fhtml%2Fimages%2Femoticons%2Fstareyes_40x40.gif%22%20alt%3D%22%3Astareyes%3A%22%20title%3D%22%3Astareyes%3A%22%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1410775%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1410775%22%20slang%3D%22en-US%22%3E%3CP%3EDear%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3E%2C%3C%2FP%3E%3CP%3EIn%20the%20same%20scenario%20if%20I%20wanted%20to%20add%20-EmployeeID%20from%20a%20csv%2C%20would%20it%20be%20possible%20to%20use%20a%20similar%20script.%20-EmployeeID%20seems%20to%20be%20an%20azureaduserextension.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJacob%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1411302%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1411302%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F230300%22%20target%3D%22_blank%22%3E%40Jacob%20John%3C%2FA%3E%26nbsp%3BJust%20add%20this%20line%20below%20line%2017%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24user%20%7C%20Set-AzureADUserExtension%20%20-ExtensionName%20%22employeeId%22%20-ExtensionValue%20%24CSVrecord.employeeId%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EAnd%20make%20sure%20you%20add%20the%20%22employeeId%22%20records%20are%20present%20in%20your%20CSV%20file.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGood%20Luck!%3C%2FP%3E%3CP%3EGrtz%2C%20Manfred%20de%20Laat%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1411324%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1411324%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20worked%20like%20a%20charm.%3C%2FP%3E%3CP%3EThanks.%20Stay%20safe.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJacob%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1513804%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1513804%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20sharing%20script%20here%20to%20update%20user%20details.%20But%2C%20I%20would%20draw%20your%26nbsp%3B%20attention%20that%20script%20is%20working%20with%20only%20one%20user%20details%2C%20when%20I%20do%20it%20with%20more%20than%20one%26nbsp%3B%20row%2C%20its%20giving%20the%20following%20warning%20and%20finally%20users%20details%20not%20updated.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Kamlesh360_0-1594366854520.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F204550i364468D887287D88%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Kamlesh360_0-1594366854520.png%22%20alt%3D%22Kamlesh360_0-1594366854520.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20the%20CSV%20file%20content%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Kamlesh360_1-1594366962678.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F204551i093121D413F38B81%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Kamlesh360_1-1594366962678.png%22%20alt%3D%22Kamlesh360_1-1594366962678.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20help%20me%20to%20resolve%20this%20issue%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1563563%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1563563%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3E%26nbsp%3BThank%20you%20for%20the%20script%2C%20i%20have%20two%20questions%2C%3C%2FP%3E%3CP%3EWe%20update%20the%20AD%20attributes%20based%20on%20the%20EmployeeId%2C%20can%20the%20script%20be%20run%20by%20the%20EmployeeID%20instead%20of%20the%20upn%2C%20if%20yes%2C%20please%20how%3F%3C%2FP%3E%3CP%3Eis%20the%20powershell%20script%20handle%20about%205k%20users%20or%20it's%20limited%20to%20a%20number%20of%20users%20only%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethank%20you%20in%20advance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDaniel.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1647786%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1647786%22%20slang%3D%22en-US%22%3E%3CP%3EHi...%20thanks%20fr%20your%20script%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eits%20not%20adding%20for%20guest%20user%3C%2FP%3E%3CP%3Eanything%20in%20need%20to%20do%20for%20guest%20user%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1647979%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1647979%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F715795%22%20target%3D%22_blank%22%3E%40Srini1987%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20UPN%20of%20a%20guest%20users%20is%20a%20bit%20different%20from%20normal%20users.%20Make%20sure%20you%20can%20map%20them%20from%20your%20csv%20file.%20Should%20look%20like%20this%3A%26nbsp%3B%3CEM%3Em.delaat_mycompany.nl%23EXT%23%40yourTenantname.onmicrosoft.com%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGood%20luck!%3C%2FP%3E%3CP%3EManfred%20de%20Laat%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1812058%22%20slang%3D%22en-US%22%3EHi%2C%20i%20am%20traying%20to%20make%20bulk%20settings%20for%20guest%20users.%20B...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1812058%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3EHi%2C%20i%20am%20traying%20to%20make%20bulk%20settings%20for%20guest%20users.%20But%20i%20receive%20the%20following%20error%20message%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Dusankovacevic_0-1603453108353.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F228706i63567265C4E07584%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Dusankovacevic_0-1603453108353.png%22%20alt%3D%22Dusankovacevic_0-1603453108353.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EGet-AzureADUser%20%3A%20Error%20occurred%20while%20executing%20GetUsers%3CBR%20%2F%3ECode%3A%20Request_UnsupportedQuery%3CBR%20%2F%3EMessage%3A%20Unsupported%20or%20invalid%20query%20filter%20clause%20specified%20for%20property%20'userPrincipalName'%20of%20resource%20'User'.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20checked%20a%20script%20many%20times%20and%20everything%20seems%20good%2C%20also%20i%20changed%20proper%20UPN%20for%20%22Guest%20user%22%20in%20my%20CSV%20file.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advanced%20for%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1931047%22%20slang%3D%22en-US%22%3ERe%3A%20Hi%2C%20i%20am%20traying%20to%20make%20bulk%20settings%20for%20guest%20users.%20B...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1931047%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F843486%22%20target%3D%22_blank%22%3E%40DK_Belgrade%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20getting%20the%20same%20issue%20-%20did%20you%20get%20it%20working%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1932520%22%20slang%3D%22en-US%22%3ERe%3A%20Hi%2C%20i%20am%20traying%20to%20make%20bulk%20settings%20for%20guest%20users.%20B...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1932520%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F253189%22%20target%3D%22_blank%22%3E%40jpcaid%3C%2FA%3E%26nbsp%3Band%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F843486%22%20target%3D%22_blank%22%3E%40DK_Belgrade%3C%2FA%3E%26nbsp%3B%2C%20I%20am%20very%20busy%20at%20the%20moment%20guys.%20But%20I%20will%20have%20a%20look%20at%20this%20in%20the%20next%20couple%20of%20days.%20Grtz%2C%20Manfred%20de%20Laat%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1934528%22%20slang%3D%22en-US%22%3ERe%3A%20Hi%2C%20i%20am%20traying%20to%20make%20bulk%20settings%20for%20guest%20users.%20B...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1934528%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20need%20to%20change%20line%205%20to%3C%2FP%3E%3CPRE%3E%24CSVrecords%20%3D%20Import-Csv%20C%3A%5CTemp%5CTest.csv%3C%2FPRE%3E%3CP%3E%26nbsp%3BThen%20the%20script%20should%20work.%20(You%20do%20not%20need%20to%20delimit%20the%20%22%3B%22)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1935080%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1935080%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20having%20trouble%20bulk%20updating%20the%20Manager%20field.%26nbsp%3B%20Would%20I%20be%20able%20to%20use%20this%20script%20to%20bulk%20update%20the%20managers%20property%20for%20the%20individual%20users%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1935384%22%20slang%3D%22en-US%22%3ERe%3A%20Hi%2C%20i%20am%20traying%20to%20make%20bulk%20settings%20for%20guest%20users.%20B...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1935384%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F882773%22%20target%3D%22_blank%22%3E%40wllrkn%3C%2FA%3E%26nbsp%3B%20Thanks%20for%20your%20feedback%26nbsp%3B%20-%20I%20made%20the%20changes.%3C%2FP%3E%3CP%3EI%20also%20noticed%20spaces%20in%20my%20CSV%20file%20and%20i%20also%20removed%20fields%20not%20needed.%26nbsp%3B%3C%2FP%3E%3CP%3ECheers%20buddy%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1935406%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1935406%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F883066%22%20target%3D%22_blank%22%3E%40sunJeezy%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3Emaybe%20-%20i%20just%20managed%20to%20do%20job%20title%20and%20department%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20changed%20the%20highlighted%20line%20below%20so%20maybe%20you%20can%20add%26nbsp%3B%3CSTRONG%3E-Manager%20%24CSVrecord.Manager%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EMake%20sure%20there%20are%20no%20spaces%20in%20your%20CVS.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%24user%20%3D%20Get-AzureADUser%20-Filter%20%22userPrincipalName%20eq%20'%24upn'%22%3CBR%20%2F%3Eif%20(%24user)%20%7B%3CBR%20%2F%3Etry%7B%3CBR%20%2F%3E%3CSTRONG%3E%24user%20%7C%20Set-AzureADUser%20-Department%20%24CSVrecord.Department%20-jobTitle%20%24CSVrecord.jobTitle%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1935661%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1935661%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ecan%20you%20please%20advice%20how%20i%20can%20change%20the%20manager%20in%20bulk%20for%20all%20employees%3F%26nbsp%3B%3C%2FP%3E%3CP%3Ethere%20is%20just%20one%20manager%20account%20and%20130%20employees%2C%20all%20of%20them%20need%20to%20have%20this%20manager%20in%20Azure%20AD%20in%20order%20for%20a%20flow%20to%20work.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethanks%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1935753%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1935753%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faddsadministration%2Fset-aduser%3Fview%3Dwin10-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faddsadministration%2Fset-aduser%3Fview%3Dwin10-ps%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHere%20a%20full%20list%20of%20attributes%20for%20the%20Set-ADUser%20command.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1935848%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1935848%22%20slang%3D%22en-US%22%3Ei%20think%20you%20can%20use%20this%3CBR%20%2F%3E%24user%20%7C%20Set-AzureADUser%20Manager%20%24CSVrecord.Manager%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936360%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936360%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F882773%22%20target%3D%22_blank%22%3E%40wllrkn%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20use%20Set-ADUser%20in%20the%20Azure%20AD%20Powershell%20console%3F%26nbsp%3B%20We%20are%20running%20Azure%20AD%20and%20do%20not%20have%20an%20on-premise%20AD%20server.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks-%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936362%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936362%22%20slang%3D%22en-US%22%3E%3CP%3Eyea%20i%20did%20this%20on%20azure%20ad%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936419%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936419%22%20slang%3D%22en-US%22%3EI%20just%20tried%20loading%20up%20powershell%20and%20typing%2C%3CBR%20%2F%3E%3CBR%20%2F%3EConnect-AzureAD%3CBR%20%2F%3EGet-ADUser%3CBR%20%2F%3E%3CBR%20%2F%3EReceived%20the%20following%20error%3A%3CBR%20%2F%3E%3CBR%20%2F%3EGet-ADUser%20%3A%20The%20term%20'Get-ADUser'%20is%20not%20recognized%20as%20the%20name%20of%20a%20cmdlet%2C%20function%2C%20script%20file%2C%20or%20operable%3CBR%20%2F%3Eprogram.%20Check%20the%20spelling%20of%20the%20name%2C%20or%20if%20a%20path%20was%20included%2C%20verify%20that%20the%20path%20is%20correct%20and%20try%20again.%3CBR%20%2F%3EAt%20line%3A1%20char%3A1%3CBR%20%2F%3E%2B%20Get-ADUser%3CBR%20%2F%3E%2B%20~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20ObjectNotFound%3A%20(Get-ADUser%3AString)%20%5B%5D%2C%20CommandNotFoundException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20CommandNotFoundException%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936421%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936421%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F883066%22%20target%3D%22_blank%22%3E%40sunJeezy%3C%2FA%3E%26nbsp%3Blets%20see%20the%20whole%20script%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936440%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936440%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F715795%22%20target%3D%22_blank%22%3E%40Srini1987%3C%2FA%3EI%20have%20been%20looking%20into%20similar%20functionality%20this%20evening%20and%20have%20achieved%20with%20the%20following%20changes%20to%20the%20really%20useful%20code%20already%20included.%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20-objectId%20can%20be%20populated%20from%20the%20id%20field%20in%20the%20Azure%20Active%20Directory%20Export%20users%20CSV.%3CBR%20%2F%3E%3CBR%20%2F%3Eforeach%20(%24CSVrecord%20in%20%24CSVrecords)%20%7B%3CBR%20%2F%3E%24ObjectID%20%3D%20%24CSVrecord.ObjectID%3CBR%20%2F%3E%24user%20%3D%20Get-AzureADUser%20-ObjectID%20%22%24ObjectID%22%3CBR%20%2F%3Eif%20(%24user)%20%7B%3CBR%20%2F%3Etry%7B%3CBR%20%2F%3E%24user%20%7C%20Set-AzureADUser%20-Department%20%24CSVrecord.Department%20-TelephoneNumber%20%24CSVrecord.TelephoneNumber%3CBR%20%2F%3E%7D%20catch%20%7B%3CBR%20%2F%3E%24FailedUsers%20%2B%3D%20%24ObjectID%3CBR%20%2F%3EWrite-Warning%20%22%24ObjectID%20user%20found%2C%20but%20FAILED%20to%20update.%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3Eelse%20%7B%3CBR%20%2F%3E%24SkippedUsers%20%2B%3D%20%24ObjectID%3CBR%20%2F%3EWrite-Warning%20%22%24ObjectID%20not%20found%2C%20skipped%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936458%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936458%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20Azure_manager.csv%20file%20contains%20userprincipalname%3Bmanager%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3E%23%26nbsp%3BConnect%26nbsp%3Bto%26nbsp%3BAzureAD%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EConnect-AzureAD%3C%2FSPAN%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23%26nbsp%3BGet%26nbsp%3BCSV%26nbsp%3Bcontent%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%24CSVrecords%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EImport-Csv%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BC%3A%5CUsers%5Ck4rna%5CDesktop%5Cazureinfocorrection%5Cazure_manager.csv%26nbsp%3B-Delimiter%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%3B%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23%26nbsp%3BCreate%26nbsp%3Barrays%26nbsp%3Bfor%26nbsp%3Bskipped%26nbsp%3Band%26nbsp%3Bfailed%26nbsp%3Busers%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%24SkippedUsers%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%40%3C%2FSPAN%3E%3CSPAN%3E()%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%24FailedUsers%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%40%3C%2FSPAN%3E%3CSPAN%3E()%3C%2FSPAN%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23%26nbsp%3BLoop%26nbsp%3Btrough%26nbsp%3BCSV%26nbsp%3Brecords%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eforeach%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B(%3C%2FSPAN%3E%3CSPAN%3E%24CSVrecord%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ein%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24CSVrecords%3C%2FSPAN%3E%3CSPAN%3E)%26nbsp%3B%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24upn%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24CSVrecord%3C%2FSPAN%3E%3CSPAN%3E.UserPrincipalName%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24user%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EGet-AzureADUser%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B-Filter%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22userPrincipalName%26nbsp%3Beq%26nbsp%3B'%3C%2FSPAN%3E%3CSPAN%3E%24upn%3C%2FSPAN%3E%3CSPAN%3E'%22%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eif%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B(%3C%2FSPAN%3E%3CSPAN%3E%24user%3C%2FSPAN%3E%3CSPAN%3E)%26nbsp%3B%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Etry%3C%2FSPAN%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24user%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ESet-AzureADUser%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B-Manager%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24CSVrecord%3C%2FSPAN%3E%3CSPAN%3E.Manager%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CSPAN%3E%7D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ecatch%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24FailedUsers%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%2B%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24upn%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EWrite-Warning%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3CSPAN%3E%24upn%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Buser%26nbsp%3Bfound%2C%26nbsp%3Bbut%26nbsp%3BFAILED%26nbsp%3Bto%26nbsp%3Bupdate.%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eelse%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EWrite-Warning%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3CSPAN%3E%24upn%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bnot%26nbsp%3Bfound%2C%26nbsp%3Bskipped%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24SkippedUsers%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%2B%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24upn%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23%26nbsp%3BArray%26nbsp%3Bskipped%26nbsp%3Busers%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%23%26nbsp%3B%24SkippedUsers%3C%2FSPAN%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23%26nbsp%3BArray%26nbsp%3Bfailed%26nbsp%3Busers%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%23%26nbsp%3B%24FailedUsers%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936479%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936479%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F883066%22%20target%3D%22_blank%22%3E%40sunJeezy%3C%2FA%3EYou%20need%20to%20install%20the%20AzureModule%20(install-module%20azuread)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936535%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936535%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F883066%22%20target%3D%22_blank%22%3E%40sunJeezy%3C%2FA%3E%26nbsp%3Bcopy%20my%20script%20posted%20above%20and%20edit%20it%20to%20suit%20you.%3C%2FP%3E%3CP%3Ealso%20make%20sure%20there%20is%20no%20spaces%20in%20your%20CSV%20file%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1936576%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1936576%22%20slang%3D%22en-US%22%3EThere%20are%20no%20spaces%20in%20the%20CSV.%20I've%20modified%20the%20script%20a%20bunch%20of%20times%20in%20order%20to%20update%20all%20the%20fields%20for%20my%201500%20users%2C%20which%20worked%20flawlessly.%20The%20manager%20piece%20is%20what%20I%20am%20having%20a%20challenge%20with.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20already%20have%20the%20AzureAD%20module%20installed.%20I've%20already%20updated%20all%20the%20other%20fields%20with%20no%20issues.%3CBR%20%2F%3E%3CBR%20%2F%3EGoing%20back%20to%20the%20documentation%20for%20Set-AzureADUser%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazuread%2Fset-azureaduser%3Fview%3Dazureadps-2.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazuread%2Fset-azureaduser%3Fview%3Dazureadps-2.0%3C%2FA%3E)%20I%20do%20not%20see%20%22Manager%22%20listed%20as%20a%20parameter.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1937148%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1937148%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F883066%22%20target%3D%22_blank%22%3E%40sunJeezy%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20appropriate%20command%20is%20set-azureadusermanager%3C%2FP%3E%3CP%3Eyou%20will%20need%20the%20azureAD%20objectid%20of%20the%20manager%2C%20which%20we%20will%20have%20to%20first%20call.%20So%20this%20script%20will%20not%20work%20as%20is.%3C%2FP%3E%3CP%3E%24user%3D%24CSVrecord.UserPrinicipalName%3C%2FP%3E%3CP%3E%24Manager%3D%20%24CSVrecord.Manager%3C%2FP%3E%3CP%3E%24ManagerObj%3DGet-AzureADUser%20-Objectid%20%24Manager%3C%2FP%3E%3CP%3E%3CSPAN%3ESet-AzureADUserManager%20-ObjectId%20%24User%20-RefObjectId%20%24ManagerObj.ObjectId%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIn%20your%20specific%20instance%2C%20it%20may%20be%20simple%20to%20populate%20the%20csv%20with%20the%20objectid%20of%20the%20single%20manager%20or%20the%20script%20with%20the%20objectid%20as%20only%20one%20manager%20exists.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1969447%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1969447%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPS%20Code%20turns%20%22unsupported%20or%20invalid%20query%20filter%20clause%20specified%20for%20property%20userprincipalname%22%20on%20my%20environment.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20trying%20change%20jobtitle%20and%20mobile%20attributes%20and%20edited%2017th%20line%20to%20%22Set-AzureADUser%20-JobTitle%20%24CSVrecord.JobTitle%20-Mobile%20%24CSVrecord.Mobile%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDo%20you%20have%20any%20suggestions%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1973458%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1973458%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F253189%22%20target%3D%22_blank%22%3E%40jpcaid%3C%2FA%3E%26nbsp%3BIf%20you%20can't%20use%20spaces%20in%20the%20.csv%2C%20how%20do%20you%20handle%20things%20like%20Job%20titles%20or%20department%20names%20that%20have%20spaces%20in%20them%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1975229%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1975229%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F896658%22%20target%3D%22_blank%22%3E%40leewegener%3C%2FA%3E%26nbsp%3Bthats%20fine%20-%20i%20mean%20after%20the%20%22%2C%22%20or%20at%20the%20end%20of%20the%20line%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1993014%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1993014%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F895433%22%20target%3D%22_blank%22%3E%40cevatcekli%3C%2FA%3E%26nbsp%3BPlease%20include%20the%20script%20you%20try%20to%20run%20together%20with%20your%20csv%20(example%20data).%20Also%20make%20sure%20you%20are%20using%20the%20latest%20module.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%20%23%20Get%20My%20Module%20verion%0A%20Get-Module%20AzureAD%20%7C%20Select%20Version%0A%0A%20%23%20Get%20latest%20PSGallery%20version%0A%20Find-Module%20AzureAd%20%7C%20Select%20Version%0A%0A%20%23%20Update%20Module%0A%20Get-Module%20AzureAD%20%7C%20Update-Module%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2000723%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2000723%22%20slang%3D%22en-US%22%3E%3CP%3EHaving%20the%20same%20issue%20as%20%40cevatcakli%20even%20after%20including%20the%20module%20update%20lines%3CBR%20%2F%3EError%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EGet-AzureADUser%20%3A%20Error%20occurred%20while%20executing%20GetUsers%0ACode%3A%20Request_UnsupportedQuery%0AMessage%3A%20Unsupported%20or%20invalid%20query%20filter%20clause%20specified%20for%20property%20'userPrincipalName'%20of%20resource%20'User'.%0ARequestId%3A%205cfe785f-7d53-4fcd-b74e-b411d1b5db09%0ADateTimeStamp%3A%20Fri%2C%2018%20Dec%202020%2009%3A32%3A43%20GMT%0AHttpStatusCode%3A%20BadRequest%0AHttpStatusDescription%3A%20Bad%20Request%0AHttpResponseStatus%3A%20Completed%0AAt%20line%3A23%20char%3A13%0A%2B%20%24user%20%3D%20Get-AzureADUser%20-Filter%20%22userPrincipalName%20eq%20'%24upn'%22%0A%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5BGet-AzureADUser%5D%2C%20ApiException%0A%2B%20FullyQualifiedErrorId%20%3A%20Microsoft.Open.AzureAD16.Client.ApiException%2CMicrosoft.Open.AzureAD16.PowerShell.GetUser%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2012134%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2012134%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F412431%22%20target%3D%22_blank%22%3E%40Manfred101%3C%2FA%3Ei%20have%20modified%20your%20script%20as%20per%20my%20need%20but%20somehow%20its%20throwing%20errors%2C%20with%20first%20four%20field%20its%20working%20perfect%20but%20as%20i%20added%20another%20entries%20it%20says%20the%20%22WARNING%3A%20xyz%40abc.org%20user%20found%2C%20but%20FAILED%20to%20update.%20please%20note%20i%20have%20changed%20the%20delimiter%20as%20per%20my%20regional%20settings.%20any%20help%20regarding%20this%20would%20be%20appreciated.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%23%20Connect%20to%20AzureAD%0AConnect-AzureAD%0A%0A%23%20Get%20CSV%20content%0A%24CSVrecords%20%3D%20Import-Csv%20C%3A%5CUsers%5Cneofreedom%5CDesktop%5CTest.csv%20-Delimiter%20%22%2C%22%0A%0A%23%20Create%20arrays%20for%20skipped%20and%20failed%20users%0A%24SkippedUsers%20%3D%20%40()%0A%24FailedUsers%20%3D%20%40()%0A%0A%23%20Loop%20trough%20CSV%20records%0Aforeach%20(%24CSVrecord%20in%20%24CSVrecords)%20%7B%0A%20%20%20%20%24upn%20%3D%20%24CSVrecord.UserPrincipalName%0A%20%20%20%20%24user%20%3D%20Get-AzureADUser%20-Filter%20%22userPrincipalName%20eq%20'%24upn'%22%20%20%0A%20%20%20%20if%20(%24user)%20%7B%0A%20%20%20%20%20%20%20%20try%7B%0A%20%20%20%20%20%20%20%20%24user%20%7C%20Set-AzureADUser%20-jobTitle%20%24CSVrecord.jobTitle%20-Department%20%24CSVrecord.Department%20-state%20%24CSVrecord.state%20-country%20%24CSVrecord.country%20-officeLocation%20%24CSVrecord.officeLocation%20-city%20%24CSVrecord.city%20-postalCode%20%24CSVrecord.postalCode%20-TelephoneNumber%20%24CSVrecord.TelephoneNumber%20-mobilePhone%20%24CSVrecord.mobilePhone%0A%20%20%20%20%20%20%20%20%24FailedUsers%20%2B%3D%20%24upn%0A%20%20%20%20%20%20%20%20Write-Warning%20%22%24upn%20user%20found%2C%20but%20FAILED%20to%20update.%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20else%20%7B%0A%20%20%20%20%20%20%20%20Write-Warning%20%22%24upn%20not%20found%2C%20skipped%22%0A%20%20%20%20%20%20%20%20%24SkippedUsers%20%2B%3D%20%24upn%0A%20%20%20%20%7D%0A%7D%0A%0A%23%20Array%20skipped%20users%0A%23%20%24SkippedUsers%0A%0A%23%20Array%20failed%20users%0A%23%20%24FailedUsers%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2030420%22%20slang%3D%22en-US%22%3ERe%3A%20Bulk%20update%20Azure%20AD%20with%20user%20attributes%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2030420%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F910238%22%20target%3D%22_blank%22%3E%40mesuhaib%3C%2FA%3E%26nbsp%3Bthis%20script%20is%20not%20going%20to%20work.%20On%20line%2016%20you%20are%20starting%20a%20try%7B%7D%20block%2C%20but%20you%20are%20missing%20the%20catch%20%7B%7D%20part.%20A%20try%20always%20needs%20a%20catch!%20Check%20out%20this%20video%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DsmGXaPlW9j0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E(295)%20Using%20Try%2FCatch%20Blocks%20In%20PowerShell%20-%20YouTube%3C%2FA%3E%26nbsp%3B.%20You%20need%20to%20resolve%20that.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhene%20you%20ar%20done%20fixing%20the%20try%20block%2C%20you%20can%20troubleshoot%20line%2017%20by%20commenting%20out%20the%20options%20one-by-one%3A%20(see%20below%2C%20in%20this%20line%20you%20only%20set%20the%20jobtitle%20and%20department%20value.%20Try%20to%20find%20where%20things%20are%20going%20wrong)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24user%20%7C%20Set-AzureADUser%20-jobTitle%20%24CSVrecord.jobTitle%20-Department%20%24CSVrecord.Department%20%23-state%20%24CSVrecord.state%20-country%20%24CSVrecord.country%20-officeLocation%20%24CSVrecord.officeLocation%20-city%20%24CSVrecord.city%20-postalCode%20%24CSVrecord.postalCode%20-TelephoneNumber%20%24CSVrecord.TelephoneNumber%20-mobilePhone%20%24CSVrecord.mobilePhone%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGood%20luck!%3C%2FP%3E%3CP%3EGrtz%2C%20Manfred%20de%20Laat%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I am looking for a way to update user attributes (OfficePhone and Department) for about 500 users from a CSV to AzureAD using a powershell. Does anyone know of a script that I could use? I am new here and if I have not given enough information, please let me know. I tried using Set-AzureADUser piping records using a foreach statement from a csv that I imported, but it was throwing up errors. 

Thanks!

Jacob

37 Replies
Best Response confirmed by jebujohn (New Contributor)
Solution

@jebujohn 

 Hello Jacob,

 

Your  CSV has to look something like this:

UserPrincipalName;Department;TelephoneNumber
manfreddelaat@domain.nl;IT;0135113333
manfred@domain.nl;IT;0622222222

 

Your Powershell code:

 

# Connect to AzureAD
Connect-AzureAD

# Get CSV content
$CSVrecords = Import-Csv C:\Temp\Test.csv -Delimiter ";"

# Create arrays for skipped and failed users
$SkippedUsers = @()
$FailedUsers = @()

# Loop trough CSV records
foreach ($CSVrecord in $CSVrecords) {
    $upn = $CSVrecord.UserPrincipalName
    $user = Get-AzureADUser -Filter "userPrincipalName eq '$upn'"  
    if ($user) {
        try{
        $user | Set-AzureADUser -Department $CSVrecord.Department -TelephoneNumber $CSVrecord.TelephoneNumber
        } catch {
        $FailedUsers += $upn
        Write-Warning "$upn user found, but FAILED to update."
        }
    }
    else {
        Write-Warning "$upn not found, skipped"
        $SkippedUsers += $upn
    }
}

# Array skipped users
# $SkippedUsers

# Array failed users
# $FailedUsers

 

 

Good luck!

 

Kind Regards, Manfred de Laat

Thanks @Manfred101 

Worked like a charm. Lovely to learn from you!

Keep safe and stay blessed

@jebujohnYou're welcome! Take care! :stareyes:

Dear @Manfred101,

In the same scenario if I wanted to add -EmployeeID from a csv, would it be possible to use a similar script. -EmployeeID seems to be an azureaduserextension.

 

Jacob

@Jacob John Just add this line below line 17:

$user | Set-AzureADUserExtension  -ExtensionName "employeeId" -ExtensionValue $CSVrecord.employeeId

And make sure you add the "employeeId" records are present in your CSV file.

 

Good Luck!

Grtz, Manfred de Laat 

Thanks @Manfred101 

It worked like a charm.

Thanks. Stay safe.

 

Jacob

@Manfred101 

 

Thanks for sharing script here to update user details. But, I would draw your  attention that script is working with only one user details, when I do it with more than one  row, its giving the following warning and finally users details not updated.

Kamlesh360_0-1594366854520.png

 

Here is the CSV file content:

Kamlesh360_1-1594366962678.png

 

Can you help me to resolve this issue?

@Manfred101 Thank you for the script, i have two questions,

We update the AD attributes based on the EmployeeId, can the script be run by the EmployeeID instead of the upn, if yes, please how?

is the powershell script handle about 5k users or it's limited to a number of users only?

 

thank you in advance.

 

Daniel.

 

 

Hi... thanks fr your script

 

its not adding for guest user

anything in need to do for guest user

 

@Manfred101 

@Srini1987 

 

The UPN of a guest users is a bit different from normal users. Make sure you can map them from your csv file. Should look like this: m.delaat_mycompany.nl#EXT#@yourTenantname.onmicrosoft.com

 

Good luck!

Manfred de Laat

@Manfred101Hi, i am traying to make bulk settings for guest users. But i receive the following error message 

Dusankovacevic_0-1603453108353.png

Get-AzureADUser : Error occurred while executing GetUsers
Code: Request_UnsupportedQuery
Message: Unsupported or invalid query filter clause specified for property 'userPrincipalName' of resource 'User'.

 

I checked a script many times and everything seems good, also i changed proper UPN for "Guest user" in my CSV file.

 

Thanks in advanced for help.

@DK_Belgrade 

I am getting the same issue - did you get it working?

@jpcaid and @DK_Belgrade , I am very busy at the moment guys. But I will have a look at this in the next couple of days. Grtz, Manfred de Laat

You need to change line 5 to

$CSVrecords = Import-Csv C:\Temp\Test.csv

 Then the script should work. (You do not need to delimit the ";")

@Manfred101 

 

I'm having trouble bulk updating the Manager field.  Would I be able to use this script to bulk update the managers property for the individual users?

 

Thanks-

 

@wllrkn  Thanks for your feedback  - I made the changes.

I also noticed spaces in my CSV file and i also removed fields not needed. 

Cheers buddy 

@sunJeezy 

maybe - i just managed to do job title and department 

 

I changed the highlighted line below so maybe you can add -Manager $CSVrecord.Manager

Make sure there are no spaces in your CVS.


$user = Get-AzureADUser -Filter "userPrincipalName eq '$upn'"
if ($user) {
try{
$user | Set-AzureADUser -Department $CSVrecord.Department -jobTitle $CSVrecord.jobTitle

@Manfred101

 

can you please advice how i can change the manager in bulk for all employees? 

there is just one manager account and 130 employees, all of them need to have this manager in Azure AD in order for a flow to work. 

 

thanks