Running the Migration Script

Migration is performed with the connect_migration.py script. We recommend that you perform the migration by following these steps:

  1. Run the script in dry-run mode.

  2. Check the report and log files produced by the script. If there are any issues, analyze and fix them before running the script in production mode.

  3. Run the script in production mode.

  4. Check the report and log files produced by the script. If there are any issues, analyze and fix them.

  5. In BSS, check the orders created by the script. If there are any issues, analyze and fix them.

    Important: After you fix those issues and the failed orders are processed, you must manually cancel the appropriate source subscriptions.

Migration Flow

Every source subscription is processed as follows:

  1. For each Microsoft 365 CSP license resource of that source subscription, the script finds the service plan that contains the corresponding Microsoft 365 NCE license resource.

  2. For each Microsoft 365 CSP license resource of that source subscription, the script creates a sales order and a subscription based on the found service plan, which includes the corresponding Microsoft 365 NCE license resource.

  3. After creating sales orders and subscriptions for all Microsoft 365 CSP license resources of that source subscription, the script creates a cancellation order for that source subscription.

Note: If no sales orders are created for a source subscription due to any issues, no cancellation order is created for that source subscription. You must investigate and fix those issues, then run the script again for that source subscription.

Important: If sales orders are partially created for a source subscription, or all necessary sales order are created but some of them fail due to issues, no cancellation order is created for that source subscription. Such a source subscription is considered as migrated by the script, and you must manually complete the migration of that source subscription.

Parameters

The parameters of the script are in the table.

Parameter name Mandatory Description
--source-data Yes
  • The path to a CSV file that contains the identifiers of the subscriptions that you need to migrate. That file must have a column named OaSubscriptionId. In that column, you must specify the identifiers of those subscriptions. For example:

    subscription_ids.csv

    OaSubscriptionId
    1000098
    1000099
  • The path to a CSV file that contains the identifiers of the customer accounts whose subscriptions you need to migrate. That file must have a column named OaCustomerId. In that column, you must specify the identifiers of those customer accounts. For example:

    customer_account_ids.csv

    OaCustomerId
    1000098
    1000099

Note: The source-data, accounts, resellers, and subscriptions parameters are mutually exclusive. You must use only one of them when running the script.

--accounts Yes

The identifiers of the customer accounts whose subscriptions you need to migrate. These identifiers must be separated with commas and enclosed in single quotes. For example: '1000098,1000099'

Note: The source-data, accounts, resellers, and subscriptions parameters are mutually exclusive. You must use only one of them when running the script.

--resellers Yes

The identifiers of the reseller accounts whose direct customers have subscriptions intended for the migration. These identifiers must be separated with commas and enclosed in single quotes. For example: '1000098,1000099'

Note: The source-data, accounts, resellers, and subscriptions parameters are mutually exclusive. You must use only one of them when running the script.

--subscriptions Yes

The identifiers of the subscriptions you need to migrate. These identifiers must be separated with commas and enclosed in single quotes. For example: '1000098,1000099'

Note: The source-data, accounts, resellers, and subscriptions parameters are mutually exclusive. You must use only one of them when running the script.

--sourcemodel Yes

The type of the application whose subscriptions you need to migrate. You must specify one of these values, depending on which application is installed:

  • odin (for the Microsoft 365 application)

  • softcom (for the O365_APS2 application)

--connect-products Yes The path to a JSON configuration file that contains CloudBlue Connect product descriptions. You must specify the path to the file that you prepared in Preparing a JSON Configuration File with Target Product Descriptions. For example: connect_product_descriptions.json
--csp-nce-mapping Yes The path to a CSV configuration file that contains the mappings between Microsoft 365 CSP licenses and Microsoft 365 NCE licenses. You must specify the path to the file that you prepared in Preparing a CSV Configuration File with CSP to NCE License Mappings. For example: csp_to_nce_license_mappings.csv
--dry-run No

When specified, the script is run in dry-run mode. In this mode, the script performs checks and stores the results in report and log files. No actual migration is performed.

Important: We recommend that you first run the script in dry-run mode and check the report and log files produced by the script before performing the actual migration.

--skip-mca-check No

When started, for every customer account, the script checks whether the Microsoft Customer Agreement was accepted by the owner of that customer account. Each check may take up to several seconds as the script makes calls to the Microsoft APIs.

When specified, the script does not perform that check.

Important: We recommend that you use the skip-mca-check parameter only with the dry-run parameter.

--verbose No When specified, the script writes more details to its log files.
--oa-api-user No The username of a user for connecting to the OSS and BSS XML-RPC APIs. You must specify it if HTTP authentication is turned on for the APIs.
--oa-api-user-password No The password of a user for connecting to the OSS and BSS XML-RPC APIs. You must specify it if HTTP authentication is turned on for the APIs.
--threads No The number of threads for parallel execution (from 1 to 16). If not specified, the script automatically sets that number based on the number of CPU cores in your system.
--timeout-order-process No

When migrating a Microsoft 365 CSP subscription, the script creates a sales order for each Microsoft 365 CSP license included in that subscription. It then waits 600 seconds (the default timeout interval) for each sales order to be completed or fail as the processing of that sales order is performed on the CloudBlue Connect and Microsoft sides. If each sales order created for that subscription is completed within that timeout interval, the script creates a cancellation order for that subscription, and it is considered migrated. Otherwise, no cancellation order is created, and you must manually complete the migration of that Microsoft 365 CSP subscription.

With this parameter, you can redefine the default timeout interval of 600 seconds, depending on how long such sales orders are processed for your CloudBlue Commerce installation.

How To Run the Script

To run the script, go to the respective directory on your cloud MN and execute this command:

python connect_migration.py migration [PARAMETERS]

Here are some examples tailored to various scenarios:

  • Run the script in dry-run mode for the Microsoft 365 application:

    python connect_migration.py migration --dry-run --source-data subscription_ids.csv --sourcemodel odin --connect-products connect_product_descriptions.json --csp-nce-mapping csp_to_nce_license_mappings.csv
  • Run the script in production mode for the Microsoft 365 application:

    python connect_migration.py migration --source-data subscription_ids.csv --sourcemodel odin --connect-products connect_product_descriptions.json --csp-nce-mapping csp_to_nce_license_mappings.csv
  • Run the script in dry-run mode for the O365_APS2 application:

    python connect_migration.py migration --dry-run --source-data subscription_ids.csv --sourcemodel softcom --connect-products connect_product_descriptions.json --csp-nce-mapping csp_to_nce_license_mappings.csv
  • Run the script in production mode for the O365_APS2 application:

    python connect_migration.py migration --source-data subscription_ids.csv --sourcemodel softcom --connect-products connect_product_descriptions.json --csp-nce-mapping csp_to_nce_license_mappings.csv

Script Output

After each run, the script outputs migration statistics and the location of its log and report files to your console. For example:

...
Report for subscription #1000096   : ............................. outresult/m365_20220222T125159/subscriptions/subs_C1000042_1000096.csv
 
Results migrated subscriptions     : ....................................... outresult/m365_20220222T125159/migrate_results__accounts.csv
Failed migrated subscriptions      : .................................. outresult/m365_20220222T125159/fail_migrate_results__accounts.csv
Successful migrated subscriptions  : ............................... outresult/m365_20220222T125159/success_migrate_results__accounts.csv
Log file name                      : ........................................................................... migration_2022-02-22.log
 
Statistics:
##############################################################
### dry-run mode                                           ###
##############################################################
---------------------------------------------------------------
preparation phase
---------------------------------------------------------------
connect products (configured and available) ................ 1
customers total ............................................ 1
customers ready for migration .............................. 1
customers with errors ...................................... 0
customers with warnings .................................... 0
subscriptions total ........................................ 1
subscriptions prepared for migration  ...................... 1
subscriptions with errors .................................. 0
subscriptions with warnings ................................ 0
---------------------------------------------------------------
migration phase
---------------------------------------------------------------
customers migrated to connect .............................. dry-run mode
subscriptions migrated to connect .......................... dry-run mode
subscriptions with migration errors ........................ dry-run mode
---------------------------------------------------------------
 
Done.
 
*********************************** Processing finished ***********************************
 
Log file name                      : ........................................................................... migration_2022-02-22.log
...

Log and Report Files

  • The script writes log records to files named migration_<YYYY-MM-DD>.log. Log records are appended to the same log file for each day.

  • After each run, the script generates these reports:

    • outresult/m365_<TIMESTAMP>/errors__accounts.csv contains information about subscriptions whose processing completed with errors.

    • outresult/m365_<TIMESTAMP>/warnings__accounts.csv contains information about subscriptions whose processing completed with warnings.

    • outresult/m365_<TIMESTAMP>/migrate_results__accounts.csv contains information about all subscriptions.

    • outresult/m365_<TIMESTAMP>/fail_migrate_results__accounts.csv contains information about failed subscriptions.

    • outresult/m365_<TIMESTAMP>/success_migrate_results__accounts.csv contains information about successfully migrated subscriptions.

      Note: After you run the script in dry-run mode, it will write the identifiers of subscriptions that are ready for migration in a report file named outresult/m365_<TIMESTAMP>/success_migrate_results__accounts.csv. You can then use that file as an input file when running the script in production mode.

    • outresult/m365_<TIMESTAMP>/subscriptions/subs_C<CUSTOMER_ACCOUNT_ID>_<SOURCE_SUBSCRIPTION_ID>.csv contains detailed information about a subscription of a customer account.