Migrate to OpenWorkspace
After deployment, the setup wizard asks where you’re migrating from and prints two commands with your workspace address and source details filled in. Run the preview first. The second command applies the import after you sign in as a workspace administrator. You can also run these commands independently.
Choose a source
| Source | Command | What carries over |
|---|---|---|
| Microsoft 365 / Entra ID | import idp entra |
Members, email aliases, groups, membership, OIDC registrations and SAML enterprise apps with identifiable endpoints |
| Okta | import idp okta |
Active users, groups, membership and supported OIDC and SAML apps |
| Keycloak | import idp keycloak |
Realm users, groups, membership and supported OIDC and SAML clients |
| Google Workspace | import people |
Users, aliases, groups, membership and optional group posting and inbox settings |
| Directory CSV | import idp csv |
Users, groups and membership |
| SAML service provider metadata | import idp saml |
One app’s SAML settings, including apps currently using Google as their IdP |
| Google Takeout or mbox | import mbox |
Mail from local files |
| IMAP | import imap |
Mail from Gmail, Microsoft 365, Fastmail and other IMAP servers |
| OpenWorkspace snapshot | import backup |
Workspace and module data. See Backups. |
Cutover steps
- Open the deployed workspace and create its first administrator with a passkey.
- Preview the directory import. Check the users, team memberships, SSO endpoints
and skipped entries, then apply it. Give each person their individual link
from
openworkspace-invitations.csvthrough a channel they can already access. Use--invites <file>to choose a different output file for each import. - Review each imported app in Administration → Single sign-on apps. All imported apps start disabled, with no access teams. Set its access teams, claims and signing requirements. For SAML, give the service provider the new IdP metadata and certificate. For OIDC, configure its new issuer and client ID and rotate the secret for a confidential client. Enable the app when ready and test sign-in with an assigned user.
- For a mail migration, keep the old mailboxes accessible through the DNS
switch. Import them with
import mboxorimport imap. Repeat the import to pick up late deliveries. See Mail domains.
Directory imports invite active people with addresses on the workspace’s mail
domains. They flatten nested groups into team memberships. Groups without a
mail address become teams without a mailbox. Their initial team handle comes
from the group name, for example engineering for Engineering. These are one-time imports.
Running one again can add missing members. For OIDC clients with the same
name in an export, the importer adds their source IDs to distinguish them.
Imported OIDC names include the source client ID. Rerunning the import skips matching names and SAML entity IDs. Recreate administrator roles, MFA enrollment, identity
policies, custom claims and app assignments in the destination as needed.
If the workspace rejects an app’s settings, the CLI reports the reason and
continues with the directory and remaining apps. Both the dry run and the
import return a nonzero exit code for rejected settings. Correct the app and
rerun the command to finish the import.
Passwords, passkeys and client secrets stay with the source.
Microsoft 365 / Entra ID
In the Entra admin center, register a single-tenant app and enable Allow public
client flows under Authentication. Grant tenant admin consent for the delegated
Microsoft Graph permissions User.Read.All, GroupMember.Read.All,
Member.Read.Hidden (for hidden memberships) and Application.Read.All. Use an
administrator account that can read the directory and its memberships. The CLI
shows Microsoft’s device sign-in instructions. Use your directory ID and
application ID from the registration’s Overview page.
bunx @open-workspace/create import idp entra --tenant "$TENANT_ID" --client-id "$CLIENT_ID" \
--workspace https://workspace.acme.com --dry-runThe importer reads tenant-owned OIDC app registrations and SAML enterprise
apps. For Microsoft 365 groups it reads allowExternalSenders and sets each new
mailing list to accept mail from anyone or only from the workspace. If Graph
cannot return that setting, the CLI reports the group so you can retry. Other
mail-enabled Entra groups use workspace-only posting. Review Exchange moderation
and sender-specific restrictions before switching mail delivery.
Browser origins come from the redirect URLs registered on Entra’s
single-page application platform. It skips guest users, mixed public/confidential clients and SAML apps
with ambiguous identifiers or reply URLs. For those SAML apps, supply SP
metadata separately. Microsoft device sign-in
Okta
Create an API token using an Okta administrator account with read access to
users, groups, group members and apps. Enter it at the hidden CLI prompt, or
set OKTA_API_TOKEN. Supply your organization’s HTTPS origin.
bunx @open-workspace/create import idp okta --org https://acme.okta.com \
--workspace https://workspace.acme.com --dry-runOIDC client type, redirect URIs and post-logout redirect URIs carry over. For browser apps, the preview also lists the browser origins derived from their redirect URIs. SAML apps need an unambiguous audience and ACS URL. For catalog apps whose endpoints Okta omits, use the app’s SP metadata. Okta API tokens
Keycloak
Use Keycloak’s server-side export for one realm, including its users. The Admin Console’s partial export omits users. Follow the server guide before running the export, and keep the resulting file private. Keycloak import and export
bin/kc.sh export --realm acme --file /tmp/acme-realm.json
bunx @open-workspace/create import idp keycloak --file /tmp/acme-realm.json \
--workspace https://workspace.acme.com --dry-runThe importer reads groups by realm path and imports sign-in clients with
concrete endpoints. It skips Keycloak’s built-in clients and wildcard OIDC
redirect URIs. For OIDC clients it copies explicit HTTPS browser origins and
HTTP loopback origins from webOrigins. A + entry adds the browser origins
of the resolved login redirect URLs. The dry run lists saved origins and
flags wildcards for review. It also shows the post-logout
redirect URLs and the back-channel logout URL for clients using that mode.
For SAML clients the dry run shows the NameID format. With persistent,
OpenWorkspace issues new identifiers for existing users. With no configured
format, Keycloak defaults to the username when the app requests no format,
while OpenWorkspace sends the user’s email. Check how the app links existing
accounts before enabling sign-in.
Review each client’s protocol mappers and signing policy during cutover.
Directory CSV
Use the header below. A user needs an email. A group may leave it empty. The last column lists the names of parent groups, separated by semicolons.
type,name,email,groups
group,Engineering,,
group,Design,design@acme.com,Engineering
user,Ada Moss,ada@acme.com,Designbunx @open-workspace/create import idp csv --file directory.csv \
--workspace https://workspace.acme.com --dry-runSAML settings from Google Workspace or another IdP
Obtain the service provider metadata XML from the application. It identifies the app and its assertion consumer service (ACS) URL. Google’s IdP metadata describes Google’s sign-in service and serves a different purpose. Run the following command once per app. Google directory import is described below.
bunx @open-workspace/create import idp saml --file portal-sp.xml \
--workspace https://workspace.acme.com --dry-runThe parser reads the entity ID, ACS, supported NameID format, and the SP signing certificate and signed-request preference when present. Review any warnings about certificates or NameID before enabling sign-in.
Signing in to the workspace
Each command opens your browser to sign in to the workspace, and you approve it
like any other app. You stay signed in for later runs; pass --login to sign
in again.
Tell the command which workspace to use with --workspace https://workspace.acme.com
or the OPENWORKSPACE_URL variable.
Where you can import depends on your permissions:
- People with the “Import mail” permission, which all administrators have, can import into any personal mailbox or shared inbox.
- Everyone else can import only into their own personal mailboxes.
Pick the target mailbox with --into. If you pick one you can’t use, the
command lists the ones you can.
Google Takeout and mbox files
bunx @open-workspace/create import mbox ~/Downloads/Takeout/Mail \
--workspace https://workspace.acme.com --into ada@acme.comTo get a Takeout export:
- Go to takeout.google.com and choose Deselect all.
- Tick Mail, and keep all of its data included.
- Choose Next step, then Export once. Pick
.zipor.tgzand the largest file size. - Wait for Google’s email with the download link, which can take hours or days. Unpack the archive.
Pass the .mbox file, or the Takeout folder to import every .mbox file in
it. A Google Workspace administrator may have turned Takeout off.
For an Apple Mail export, pass the .mbox package directly, or its parent
folder to import several exported mailboxes.
Mbox files from elsewhere, such as Thunderbird, have no Gmail labels. All of
their mail goes to Archive, or to the place you choose with --placement
(inbox, archive, spam, trash or sent). With --placement inbox you
can add --folder Name. Thunderbird read flags are preserved, and messages
marked as deleted before folder compaction are skipped.
Other options for import mbox:
| Option | What it does |
|---|---|
--dry-run |
Shows what would go where, without importing |
--skip spam,trash |
Leaves those messages out |
--archived-labels folder |
Keeps labelled, archived incoming mail in its label’s folder |
--folder-priority "A,B" |
Which labels win when a thread has several |
--map jobs.csv |
Imports many files at once, with rows of mbox path,target |
IMAP
GMAIL_APP_PASSWORD=… bunx @open-workspace/create import imap \
--host imap.gmail.com --user ada@acme.com --password-env GMAIL_APP_PASSWORD \
--workspace https://workspace.acme.com --into ada@acme.comSign in to the old server with either:
- a password, from the variable named by
--password-env, or typed when the command asks, or - an OAuth access token with
--access-token. Microsoft 365 requires this. You get the token yourself.
To import many accounts at once, pass --map accounts.csv with rows of
user,target[,password].
Gmail app passwords
Gmail doesn’t accept your normal password over IMAP. Create an app password:
- Turn on 2-Step Verification at myaccount.google.com/security.
- Create an app password at myaccount.google.com/apppasswords and copy the 16 characters.
- In Gmail, open Settings → See all settings → Forwarding and POP/IMAP and check that IMAP is on. Under Labels, keep Show in IMAP on for All Mail.
If app passwords are turned off for your account, use --access-token or
Takeout instead.
Over IMAP, Gmail’s Spam and Trash aren’t imported. Use Takeout if you want them. Gmail also limits downloads to about 2.5 GB a day, so a large mailbox takes more than one day: run the command again each day.
Other IMAP servers
Inbox, Sent, Spam, Trash and Archive go to the matching places. Other folders
go to Archive, or keep their own folder with --archived-labels folder.
The importer skips the Drafts folder and messages flagged \Draft or \Deleted in any folder.
People and teams from Google Workspace
bunx @open-workspace/create import people --google-credentials key.json --admin admin@acme.com \
--workspace https://workspace.acme.com --dry-runThe command reads your Google directory with credentials from your own Google Cloud project. Set them up one of two ways.
A service account
This needs no browser.
- In console.cloud.google.com, create a
project and enable the Admin SDK API. To use
--group-settings, also enable the Groups Settings API. - Under IAM & Admin → Service accounts, create an account, then add a JSON key under Keys. Newer Google organizations block key creation by default; allow it for this project.
- In the Admin console, open Security → Access
and data control → API controls → Domain-wide delegation → Add new. Enter
the service account’s client ID and these scopes:
https://www.googleapis.com/auth/admin.directory.user.readonly,https://www.googleapis.com/auth/admin.directory.group.readonly,https://www.googleapis.com/auth/admin.directory.group.member.readonly. For--group-settings, addhttps://www.googleapis.com/auth/apps.groups.settings. - Run the command with
--google-credentials key.json --admin <a super administrator>. - Delete the key when you’re done.
Your own OAuth client
You sign in as a Google Workspace administrator.
- In a Google Cloud project, enable the same APIs.
- Set up the OAuth consent screen as Internal.
- Create Credentials → OAuth client ID → Desktop app and download the JSON.
- Run the command with
--google-credentials client.json. A browser opens for the Google sign-in.
If you manage several Google Workspace customers, pass --customer <id> to
read another one.
What carries over
- Each active user becomes an invited person with the same address. Their aliases on your mail domains deliver to their primary mailbox. If an alias belongs to another person or team, the import reports both owners and skips the alias.
- Suspended and archived users are skipped, unless you pass
--include-suspended. - Each group becomes a team. Its first address on a workspace domain becomes a
mailing list, or a shared inbox with
--groups inbox. Its other local addresses deliver to that same list or inbox. - With
--group-settings, collaborative inboxes become shared inboxes. When Google disables sending as the group, the shared inbox is read-only. An Everyone team always grants send access, so the importer skips a read-only inbox for that team. - If a group requires message moderation or its posting restrictions cannot be enforced, the importer creates the team and its memberships and lists the skipped address and aliases. If reading settings fails, rerun against Google to finish adding members and addresses with the correct rights.
- Google administrators are listed for you to promote by hand.
- People disabled in the workspace aren’t added to teams.
The import is a one-time migration, not a sync. Running it again only finishes a run that was interrupted: anything that already exists is left alone, and people a team made by the earlier run is still missing are added to it. The dry run lists them by address. Imported teams have reproducible IDs. If a local team already uses the handle or address, the CLI reports the conflict and skips the group. Later changes in Google, such as people who left a group, don’t carry over.
Invitation links are appended to openworkspace-invitations.csv as each user is
invited. After an interruption, rerun with the same CSV path to recover the
pending link and keep the earlier links. Each link works once. Passwords don’t carry over, because the workspace uses passkeys.
Gmail labels and threads
A Gmail message can have many labels. In the workspace, each conversation is in one place: Inbox, Archive, Spam or Trash. In the Inbox, it can also be in one custom folder.
| Gmail | In the workspace |
|---|---|
| A thread | One conversation |
| Inbox | Inbox |
| No Inbox label | Archive |
| Spam, Trash | Spam, Trash |
| Sent | Sent mail |
| Your labels | One custom folder per thread in the Inbox |
| Read and unread | Read and unread |
| Drafts, Chats | Skipped |
| Starred, Important, Categories | Dropped |
When a thread has several labels, it goes to the first one listed in
--folder-priority, otherwise the label on most of its messages. A mailbox can
have up to 100 custom folders.
Gmail filters often skip the Inbox and add a label. That mail goes to Archive,
without the label. With --archived-labels folder it goes to the label’s
folder in the Inbox instead. Labelled sent mail stays in Sent. A sent-only thread
doesn’t create an Inbox folder.
Limits and storage
- Messages larger than 25 MiB are skipped.
- Imported mail isn’t AI-sorted and doesn’t trigger webhooks or notifications. It’s searchable, and Office attachments get previews.
- Storage is about twice the size of the mailbox.
- To import several mailboxes in parallel, run a separate command for each.
Resuming
If an import stops, run the same command again. It picks up where it left off
and retries any messages that failed. Progress is saved in
.openworkspace-import/ in the folder you ran it from, or in the folder you
give with --state-dir.
Even without that folder, for example on another computer, the workspace skips messages it already has. So the same mail imported from Takeout and then over IMAP is stored once.