Pre-Register users using AlternateEmailAddresses field for Azure SSPR

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 -AlternateEmailAddresses @("")


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.






2 Replies
best response confirmed by Dave Carthy (New Contributor)

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.