Using Security Groups to Specify Domain

Copper Contributor

Hi,
I am wondering if there is a way to set this up but here is what I need to do:

Contoso.com - Default Domain Name

Contoso.org - Secondary Domain Name

A standard user should have contoso.com domain name, but I would like for that domain to change to contoso.org somain name on joining a security group.

So if any user is added to the security group the user logon domain name will change to contoso.org.

If possible would also like joining the security group remove the contoso.com domain name from the user.

Both domains are under the same directory and the same tenant in Office365.

You used to be able to do this is active directory and exchange management shell, but I cant find the feature or the instructions to do it.

 

TIA

2 Replies
This have to be done by powershell and running that script on a scheduled basis on the scope of the security group!

Some info about changing upn:

https://www.morgantechspace.com/2018/03/how-to-change-userprincipalname-of-office-365-user-powershel...

You also need to remove the old domains

Btw: are you syncing these users with adconnect?
The users are through AzureAD and Office365 only. I might be implementing and on-site server but this is a long way off at the moment. So is it the UPN I would have to setup to be changed? Could you possibly do an example for me please using the example domain names? TIA