Google Workspace Swap Alias with Primary

885 views
Skip to first unread message

Stephen Bennett

unread,
Jun 6, 2022, 7:49:31 PM6/6/22
to GAM for Google Workspace
Hello All,

I have to swap an alias with a primary

What steps would you take to Swap an Alias with a Primary.

Is there any impact to rd party SSO Apps in the new domain name (previously the alias)

Regards
Stephen 


Kim Nilsson

unread,
Jun 7, 2022, 5:55:21 AM6/7/22
to GAM for Google Workspace
Yes, some SSO apps expect the email address to be the same, while others only really work with the backend unique Google ID.

However, afaik, the alias can't be switched to be primary.
Only a secondary domain can be switched to primary.

This should mean that you need to remove the alias domain, and re-add it as a secondary domain.
Then make the secondary => primary switch, followed by adding the new primary domain to all users.

Stephen Bennett

unread,
Jun 7, 2022, 7:21:07 PM6/7/22
to GAM for Google Workspace
Thanks heaps for your time 

Stephen Bennett

unread,
Jun 13, 2022, 7:32:40 PM6/13/22
to GAM for Google Workspace
The document  you referenced is good but I am uncertain of the last bit, the script is below and the final bit I highlighted.

Scripting - Domain Alias PromotionGAMADV-XTD3

# Get all user usernames and aliases
user@cloudshell$ gam print users > users.csv
user@cloudshell$ gam print aliases > alias.csv
user@cloudshell$ gam print groups > groups.csv


# Make a list to transition user emails which were aliases to the new secondary domain status

Open users.csv in Sheets, and add new column header newEmail
Duplicate the username column (primaryEmail) into newEmail and replace @primary-domain.com with @alias-domain.com

Download and Save as newdomain.csv


# Make a list to transition group emails which were aliases to the new secondary domain status

# Delete the domain alias
user@cloudshell$ gam delete domainalias domain.com

# Create the domain as a secondary domain
user@cloudshell$ gam create domain domain.com

# Validate the domain if necessary. It may validate automatically as in testing
# Get Domain Verification details
user@cloudshell$ gam create verify domain.com


Go to your DNS provider and use verification details from the previous step


# After waiting briefly, try to verify the new domain

user@cloudshell$ gam update verify domain.com TXT

# Add the new secondary domain addresses as aliases to the primary
user@cloudshell$ gam csv newdomain.csv gam create alias ~newEmail user ~primaryEmail

user@cloudshell$ gam csv groups.csv gam create alias ~alias group ~groupEmail

#Add back user alias addresses
user@cloudshell$ gam csv alias.csv gam create alias ~aliasEmail1 user ~username
user@cloudshell$ gam csv alias.csv gam create alias ~aliasEmail2 user ~username


What does the Add Back user Alias do? 

Stephen Bennett

unread,
Jun 13, 2022, 7:35:53 PM6/13/22
to GAM for Google Workspace
So i think i need another step to change  the new secondary to be primary not leave it as a secondary alias of the primary 

Kim Nilsson

unread,
Jun 14, 2022, 2:59:46 AM6/14/22
to Google Apps Manager
Haha, yes, that step is actually not in the doc! 

https://support.google.com/a/answer/7009324
Reply all
Reply to author
Forward
0 new messages