Logo

Documentation home for Transend tools

Microsoft 365 Initialize EWS script

Use m365_initialize_ews.ps1 when Transend Migration Console will access Microsoft 365 mailboxes through Exchange Web Services (EWS). The script enables EWS where necessary and updates tenant- and mailbox-level application access rules so the Transend migration application is allowed to connect. It preserves settings that already permit access and, by default, evaluates all users with mailboxes; use -Csv to limit the users in scope.

The script also adds -TransendAppId to the tenant’s EwsAllowedAppIDs list, preserving existing application IDs.

The script records every setting it changes in m365_restore_ews.json in your Documents directory. Keep this file if you may need to undo the changes. After the migration, run m365_restore_ews.ps1 from the same user account to restore the recorded tenant and mailbox settings without reversing settings that the initialize script did not change.

Setup

  1. Download TMCTools.
  2. From the TMCTools zip file, extract common.psm1, m365.psm1 and m365_initialize_ews.ps1 from the TMCTools/bin folder.
  3. Ensure you have created the required app using m365_initialize_app.ps1.

Usage

.\m365_initialize_ews.ps1
  -AppId <AppId>
  -AppSecret <AppSecret>
  -TenantId <TenantId>
  -TransendAppId <TransendAppId>
  [-Csv <Csv>]
  [-CloudEnvironment <Default | DoD | GCCHigh | China | Germany>]

Parameters

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.
-TransendAppId Yes App ID The Enterprise app Application ID for TMC.
-Csv No Path to a CSV file A CSV file containing a list of objects to process.
-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.

Examples

Example 1: Configure all users for EWS migration

.\m365_initialize_ews.ps1 -AppId '8b26caf2-2ef6-4a9d-9c27-98616d1c1294' -AppSecret '9pitRZoTezs6M0b~bgcibEfkG6qMaczuNV25Ol6m' -TenantId 'example.org' -TransendAppId 'ee86460f-1b32-4fe8-8b2d-9e215e73ac98'

Example 2: Configure select users for EWS migration

To limit the users for which EWS will be configured, you’ll need to create a CSV with a single field named Identity that includes any of the following attributes:

  • ID
  • UPN
  • Email address
  • Display name

For example:

Identity
user1@example.org
user2@example.org
user3@example.org
.\m365_initialize_ews.ps1 -AppId '8b26caf2-2ef6-4a9d-9c27-98616d1c1294' -AppSecret '9pitRZoTezs6M0b~bgcibEfkG6qMaczuNV25Ol6m' -TenantId 'example.org' -TransendAppId 'ee86460f-1b32-4fe8-8b2d-9e215e73ac98' -Csv 'C:\Temp\users.csv'

Troubleshooting

  • Review the log file in your Documents directory for more information.