This is a tool to change Google Apps primary domain and rename all users, using the Google API Go client package.
- Before you change your primary domain
- Short video that uses the APIs Explorer to change the primary domain
- Google APIs Developer console - to set up a project and download your client_secret.json data
- Google Directory API Go Quickstart
- Documentation for API Go package
- Set up your access to the Google API as described in the resources above
- Download the client_secret.json file from the developer console, place in the same directory as this project
- Build and run (or just run) the tool, passing the new and old domains as parameters
- Go to the URL displayed, which will perform the proper auth, paste token into console when prompted
- Confirm and off you go...
go run changeprimarydomain.go -new-domain my-new-primary-domain.com -old-domain my-old-promary-domain.com
go build changeprimarydomain.go
./changeprimarydomain -new-domain my-new-primary-domain.com -old-domain my-old-promary-domain.com
- Works on OS X and Linux, unknown if this will work properly on Windows
- Based on the Google Directory API Go Quickstart
- To delete the cached auth credentials, remove the
~/.credentials/changeprimarydomain-<new domain>.json
file- Example:
rm ~/.credentials/changeprimarydomain-my-new-primary-domain.com.json
- Example:
- The 'Before you change your primary domain' document does not mention anything about renaming groups, but this console app does rename and alias all groups attached to the account
- This console app can be run multiple times for the same new and old domains with no negative ramifications