Changing the Default domain for existing users

Anonymous
2016-07-07T19:25:57+00:00

Hello, 

I have about 200+ users that were imported from my federated domain. I see that all of them defaulted to the .ONMICROSOFT domain and not my company domain.

Is there a way to change them to the customer domain in bulk? My custom domainis already set as the default but I've had to go into individual users and manually make the change as needed. I need to know if there is a way I can do them all at once?

I want the users to be able to log in with their Windows credentials that they already know.

Thanks in advance

Microsoft 365 and Office | Subscription, account, billing | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2016-07-08T09:26:04+00:00

    Hi Norb,

    Here are the steps:

    1. Sign into the portal as an admin, go to the admin center, click Active Users > select all users whose domains you need to change > Bulk actions > Edit domains, then select the domain you want to be the default one.

    1. You can also change them in bulk by PowerShell

         a.  Install the Azure AD Module by referring to install the Azure AD Module.

         b.  In PowerShell, connect to Azure AD by running Connect-msolservice, then type in your credentials.

         c.  Export your existing users in a .csv file by running Get-MsolUser | Select-Object UserPrincipalName | Export-Csv c:\Users.csv.

    A .csv file will be created in disk C including only one column: UserPrincipalName.

         d.  Complete the file with another column: EmailAddress. EmailAddress should be the address you want to use.

         e.  Create a ps1 script as below:

           $Userstodatabase = import-csv c:\Users.csv

           foreach ($Record in $Userstodatabase)

           {

           $upn = $record.userprincipalname

           $email = $record.emailaddress

           Write-host Setting $upn to $email

           Set-MSOLUserPrincipalName -UserPrincipalName $upn -NewUserPrincipalName $email

           Write-Host ".."

           }

         f.  Run the script by PowerShell.

    Regards,

    Linda

    10 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2016-07-12T02:06:39+00:00

    Hi Norb,

    Have you successfully changed the default domain? Let us know the update at your convenience.

    Regards,

    Linda

    3 people found this answer helpful.
    0 comments No comments