Use m365_restore_imap.ps1 after an IMAP migration to undo only the access changes made by
m365_initialize_imap.ps1.
Depending on what the initialize script changed, this disables IMAP for affected mailboxes, removes the Transend service
principal’s added mailbox permissions, and removes the Exchange Online service principal. Settings and permissions that
existed before initialization are left in place.
The restore script requires m365_restore_imap.json, which the initialize script writes to the Documents directory
of the account that ran it. Run the restore script from that same user account and leave the JSON file in its original
location so the script can distinguish migration changes from pre-existing configuration.
common.psm1, m365.psm1 and m365_restore_imap.ps1 from the TMCTools/bin
folder..\m365_restore_imap.ps1
-AppId <AppId>
-AppSecret <AppSecret>
-TenantId <TenantId>
[-CloudEnvironment <Default | DoD | GCCHigh | China | Germany>]
| Parameter | Required | Values | Description |
|---|---|---|---|
-AppId |
Yes | App ID | The application ID to use for authentication. |
-AppSecret |
Yes | App secret | The application secret to use for authentication. |
-TenantId |
Yes | Tenant identifier | The tenant ID to connect to. |
-CloudEnvironment |
No | Default, DoD, GCCHigh, China, Germany |
The cloud environment to connect to. Use this option if your tenant is not in the worldwide cloud. |
.\m365_restore_imap.ps1 -AppId '8b26caf2-2ef6-4a9d-9c27-98616d1c1294' -AppSecret '9pitRZoTezs6M0b~bgcibEfkG6qMaczuNV25Ol6m' -TenantId 'example.org'
Documents directory for more information.