SOLVED
Home

Pre-Register users using AlternateEmailAddresses field for Azure SSPR

%3CLINGO-SUB%20id%3D%22lingo-sub-271950%22%20slang%3D%22en-US%22%3EPre-Register%20users%20using%20AlternateEmailAddresses%20field%20for%20Azure%20SSPR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-271950%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Folks%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20recently%20implemented%20SSPR%20in%20Azure%20and%20I%20would%20like%20to%20pre-register%20everyone%20in%20the%20system.%20I%20would%20like%20to%20populate%20the%26nbsp%3B%3CSPAN%3EAlternateEmailAddresses%20field%20using%20the%20command%20below%20for%205000%20people.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESet-MsolUser%20-UserPrincipalName%20user%40domain.com%20-AlternateEmailAddresses%20%40(%22email%40domain.com%22)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20was%20wondering%20would%20anyone%20know%20how%20to%20script%20this%20in%20powershell%20using%20a%20csv%20file%3F%26nbsp%3B%20Any%20help%20would%20be%20appreciated.%20Maybe%20someone%20knows%20a%20better%20way%20of%20doing%20this%3F%20Again%2C%20thanks.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ERegards%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EDaithi%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-271950%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20AD%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-275164%22%20slang%3D%22en-US%22%3ERe%3A%20Pre-Register%20users%20using%20AlternateEmailAddresses%20field%20for%20Azure%20SSPR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-275164%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Vasil%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks%20for%20that%2C%20it%20worked%20perfectly.%20I%20was%20close%20to%20getting%20it%20but%20it%20would%20have%20taken%20me%20ages%20to%20get%20it.%20Thanks%20again%2C%20I%20really%20appreciate%20the%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDaithi%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-272146%22%20slang%3D%22en-US%22%3ERe%3A%20Pre-Register%20users%20using%20AlternateEmailAddresses%20field%20for%20Azure%20SSPR%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-272146%22%20slang%3D%22en-US%22%3E%3CP%3EAssuming%20you%20have%20a%20blabla.csv%20with%20columns%20UserPrincipalName%20to%20designate%20the%20user%20and%20AltEmail%20to%20designate%20the%20alternate%20email%20address%2C%20try%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EImport-CSV%20blabla.csv%20%7C%20%25%20%7B%20Set-MsolUser%20-UserPrincipalName%20%24_.UserPrincipalName%20-AlternateEmailAddresses%20%40(%24_.AltEmail)%20%7D%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Dave Carthy
New Contributor

Hi Folks,

 

I have recently implemented SSPR in Azure and I would like to pre-register everyone in the system. I would like to populate the AlternateEmailAddresses field using the command below for 5000 people.

 

Set-MsolUser -UserPrincipalName user@domain.com -AlternateEmailAddresses @("email@domain.com")

 

I was wondering would anyone know how to script this in powershell using a csv file?  Any help would be appreciated. Maybe someone knows a better way of doing this? Again, thanks.

 

Regards,

Daithi

 

 

2 Replies
Solution

Assuming you have a blabla.csv with columns UserPrincipalName to designate the user and AltEmail to designate the alternate email address, try something like this:

 

Import-CSV blabla.csv | % { Set-MsolUser -UserPrincipalName $_.UserPrincipalName -AlternateEmailAddresses @($_.AltEmail) }

Hi Vasil,

 

Many thanks for that, it worked perfectly. I was close to getting it but it would have taken me ages to get it. Thanks again, I really appreciate the help.

 

Daithi

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies