Importing Tenant Subscriptions

After collecting tenant information and preparing the final file importSubs_PARTNER_SUBDOMAIN.csv or importSubs_PARTNER_TENANT_ID.csv, you can run the importSubsCSP.py script which imports tenant subscriptions from the Microsoft cloud into Odin Automation. The importSubsCSP.py script imports tenant subscriptions specified in the file importSubs_PARTNER_SUBDOMAIN.csv or importSubs_PARTNER_TENANT_ID.csv.

The importSubsCSP.py script has the following input parameters:

  • csp-app-instance-id – The identifier of an application instance of the Office 365 application. Specify the prepared identifier of the required application instance.
  • file – The name of a CSV file that contains lists of tenant subscriptions to be imported. Specify the name of the file you prepared earlier (importSubs_PARTNER_SUBDOMAIN.csv or importSubs_PARTNER_TENANT_ID.csv).
  • oa-api-user – The name of an Odin Automation Public API user. Specify this parameter only if HTTP authentication is turned on for the Odin Automation Public API. We recommend that you specify the name of the user that you created during the deployment of the application (see the Preparing an Odin Automation Public API User section for details).
  • oa-api-user-password – The password of that Odin Automation Public API user. Specify this parameter only if HTTP authentication is turned on for the Odin Automation Public API. We recommend that you specify the password of the user that you created during the deployment of the application (see the Preparing an Odin Automation Public API User section for details).
  • verbose – If it is specified, more log information is shown in the console during the importSubsCSP.py script's execution. This parameter is optional.

The importSubsCSP.py script creates the following files:

  • importCSPYYYY-MM-DD.log – This file contains general messages, such as information messages and error messages.
  • errors_import_<input file name> – This CSV file contains a list of tenant subscriptions which cannot be processed by the importSubsCSP.py script as well as reasons why the tenant subscriptions cannot be processed. The CSV file has the same format as the input file of the importSubsCSP.py script (except for the additional Error column, which contains error messages).
  • reimport_<input file name> – This CSV file contains a list of tenant subscriptions which cannot be processed by the importSubsCSP.py script. The CSV file has the same format as the input file of the importSubsCSP.py script. You can use the file reimport_<input file name> to run the importSubsCSP.py script again only for affected tenant subscriptions.
  • result_YY-MM-DD<timestamp>_<input file name> – Each row of the CSV file contains the following data of a subscription created in Odin Automation by the importSubsCSP.py script:

    • CustomerId – The identifier of the customer account to which the subscription belongs.
    • SubscriptionId – The Odin Automation identifier of the newly created Office 365 CSP subscription.

To run the importSubsCSP.py script, perform the following actions:

  1. Stop Office 365 synchronization:

    1. In the Provider Control Panel, go to Operations > Tasks.
    2. Select the Periodic tab.
    3. Cancel all the Office 365 * Synchronization with Office 365 Portal tasks.
  2. Log in to the host where the import scripts are placed.
  3. Run the importSubsCSP.py script. For example: importSubsCSP.py --csp-app-instance-id 10 --file importSubs_example.onmicrosoft.com.csv
  4. After running the script, Office 365 import tasks will be scheduled in the task manager. Wait until they are processed.
  5. Start Office 365 synchronization:

    1. In the Provider Control Panel, go to Operations > Tasks.
    2. Select the Periodic tab.
    3. Run all the Office 365 * Synchronization with Office 365 Portal tasks.

Notes:

1. To import tenant subscriptions of specific tenants, use --account-domain-list <comma-separated list of verified domains of tenants> with the readCSPAccounts.py script and then use the produced output file with the importSubsCSP.py script.

2. After importing all the tenant subscriptions of a customer tenant, do not use the Partner Center to manage the tenant subscriptions. All subscription management operations, such as adding new tenant subscriptions, changing tenant subscription limits, removing existing tenant subscriptions, must be performed through Odin Automation for the customer tenant.

3. When tenant subscriptions of a customer tenant are imported, the importSubsCSP.py script always creates new Office 365 subscriptions in Odin Automation. It means the script does not update the limits of the existing Office 365 subscriptions of the corresponding customer account in Odin Automation even though the Office 365 subscriptions contain a suitable set of resources to import the tenant subscriptions.

4. If the importSubsCSP.py script fails with the A duplicated entry is found for the SA Customer #CustomerId and Service Plan #PlanId in the line LineNumber error, consider using the --allow-duplicates option described in this KB article.

5. The Office 365 * Synchronization with Office 365 Portal tasks facilitate tenant subscription import (for instance, users are synchronized by the tasks). To learn more about what the tasks synchronize and synchronization limitations, refer to Synchronizing Changes from the Office 365 Portal.