Collecting Tenant Data

Before importing tenant subscriptions, tenant data must be collected from the Microsoft cloud. It is done by using the readCSPAccounts.py script. The script retrieves information about tenants, such as tenant properties and lists of tenant subscriptions, tries to find the corresponding customer accounts for these tenants, and tries to find suitable Microsoft 365 service plans for tenant subscriptions.

The readCSPAccounts.py script has the following input parameters:

  • csp-app-instance-id: The identifier of a Microsoft 365 application instance. Specify the prepared identifier of the required application instance.
  • vendor-id: The identifier of a vendor account in CloudBlue Commerce. Specify the prepared identifier of the required vendor account.
  • account-domain-list: A comma-separated list of verified domains of tenants. If it is specified, the readCSPAccounts.py script collects the tenant data of the tenants identified by the domains. If it is not specified, the readCSPAccounts.py script collects the tenant data of all tenants. Note that the readCSPAccounts.py script takes into account tenants that are not managed by CloudBlue Commerce.

    You can use this parameter to import the tenant subscriptions of the tenants that you need. To do this, specify the parameter when running the readCSPAccounts.py script, and then use the produced output file when running the importSubsCSP.py script.

    Note: When using this parameter, enclose its value in double quotation marks (").

  • account-default-domain: (DEPRECATED) A verified domain of a tenant. If it is specified, the readCSPAccounts.py script collects the tenant data of the tenant identified by the domain. If it is not specified, the readCSPAccounts.py script collects the tenant data of all tenants. Note that the readCSPAccounts.py script takes into account tenants that are not managed by CloudBlue Commerce.

    You can use this parameter to import the tenant subscriptions of the tenant that you need. To do this, specify the parameter when running the readCSPAccounts.py script, and then use the produced output file when running the importSubsCSP.py script.

  • tenant-id-attribute-name: The identifier of a custom attribute in Billing. This parameter is optional. Specify this input parameter if the prepared customer accounts have a custom attribute and the corresponding tenant identifiers are specified in the custom attribute. This will enable the readCSPAccounts.py script to find the corresponding customer account for each tenant. Do not specify the input parameter if the prepared customer accounts do not have this custom attribute. In this case, you will need to use another approach to find the corresponding customer account for each tenant.
  • oa-api-user: The name of a CloudBlue Commerce Public API user. Specify this parameter only if HTTP authentication is turned on for the CloudBlue Commerce Public API. We recommend that you specify the name of the user that you created during the deployment of the application (see Preparing a CloudBlue Commerce Public API User for details).
  • oa-api-user-password: The password of that CloudBlue Commerce Public API user. Specify this parameter only if HTTP authentication is turned on for the CloudBlue Commerce Public API. We recommend that you specify the password of the user that you created during the deployment of the application (see Preparing a CloudBlue Commerce Public API User for details).
  • verbose: If specified, more log information is displayed in the console during the readCSPAccounts.py script's execution. The parameter is optional.
  • ignore-disabled: If specified, suspended tenant subscriptions are ignored by the script.

The readCSPAccounts.py script produces the following output files:

  • customers_PARTNER_SUBDOMAIN.csv or customers_PARTNER_TENANT_ID.csv. This file contains a list of tenants and their properties. Each tenant is represented in the following way:

    • TenantId: The identifier of the tenant in the Microsoft cloud.
    • CspCustomerId: The CSP customer identifier of the tenant in the Microsoft cloud.
    • InitialDomainName: The initial domain of the tenant.
    • DisplayName: The display name of the tenant.
    • OSACustomerId: The identifier of the corresponding customer account in CloudBlue Commerce. It is set to -1 if the customer account cannot be found.
    • company_name: The name of the company of the tenant.
    • culture: The default locale of the tenant.
    • address_line1: The first line of the address of the tenant.
    • address_line2: The second line of the address of the tenant.
    • address_line3: The third line of the address of the tenant.
    • city: The city of the tenant.
    • country: The country of the tenant.
    • first_name: The first name of the tenant.
    • last_name: The last name of the tenant.
    • phone_number: The phone number of the tenant.
    • postal_code: The postal code of the tenant.
    • state: The state of the tenant.
    • email: The email address of the tenant.
    • language: The language of the tenant.
    • type: The type of the tenant in the Microsoft cloud.
  • importSubs_PARTNER_SUBDOMAIN.csv or importSubs_PARTNER_TENANT_ID.csv. This file contains lists of tenant subscriptions which will be imported. This file will be used by the importSubsCSP.py script to perform importing. Each list of tenant subscriptions is represented in the following way:

    • OSACustomerID: The identifier of the corresponding customer account in CloudBlue Commerce. It is set to -1 if the customer account cannot be found.
    • OSAServicePlanId: The identifier of the target Microsoft 365 service plan which will be used to create a Microsoft 365 subscription in CloudBlue Commerce for the tenant subscriptions listed in MSSubscriptionIDs.
    • OSAPlanPeriodID: The identifier of the target subscription period of the chosen Microsoft 365 service plan.
    • SubscriptionStartDate: The start date of the Microsoft 365 subscription which will be created in CloudBlue Commerce. The date is specified according to ISO 8601. For example: 2019-06-30T00:00:00Z.
    • SubscriptionLastBillingDate: The last billing date of the Microsoft 365 subscription which will be created in CloudBlue Commerce. By default, this field is empty, which means that this date will be calculated automatically based on SubscriptionStartDate and parameters of the corresponding service plan, such as its billing period and subscription period. If you need to customize this date, specify it according to ISO 8601. For example: 2019-06-30T00:00:00Z.
    • SubscriptionNextBillingDate: The next billing date of the Microsoft 365 subscription which will be created in CloudBlue Commerce. By default, this field is empty, which means that this date will be calculated automatically based on SubscriptionStartDate and parameters of the corresponding service plan, such as its billing period and subscription period. If you need to customize this date, specify it according to ISO 8601. For example: 2019-07-30T00:00:00Z.
    • SubscriptionExpirationDate: The expiration date of the Microsoft 365 subscription which will be created in CloudBlue Commerce. By default, this field is empty, which means that this date will be calculated automatically based on SubscriptionStartDate and parameters of the corresponding service plan, such as its billing period and subscription period. If you need to customize this date, specify it according to ISO 8601. For example: 2020-06-30T00:00:00Z.
    • ResourceRateLimits: The list of resource rates and their limits. The format "RR_ID1-LIMIT,RR_ID2-LIMIT" is used for the list. For example: "100-10,200-20".
    • CSPAccountId: The CSP customer identifier of the tenant in the Microsoft cloud.
    • MSSubscriptionIDs: The list of tenant subscriptions. The format "MS_SUB_ID1,MS_SUB_ID2,..." is used for the list. For example: "A49C6781-1557-42CA-A074-52D0553397EA,EBE5106C-B1ED-44FF-8CE7-A2746AF8BC42".
    • DefaultAdminLogin: The login of the default administrative user of the tenant.
    • InitialDomainName: The initial domain of the tenant.

    Notes:

    1. There may be several rows in the importSubs_PARTNER_SUBDOMAIN.csv or importSubs_PARTNER_TENANT_ID.csv file for different lists of tenant subscriptions of a tenant because one list of tenant subscriptions may belong to one Microsoft 365 service plan and another list of tenant subscriptions may belong to another Microsoft 365 service plan.

    2. See Creating Microsoft 365 Service Plans to obtain information about the structure of Microsoft 365 service plans.

    3. Microsoft 365 service plans with composite resources are supported by the readCSPAccounts.py script. If each composite resource of a Microsoft 365 service plan contains one included resource and the amount of the included resource is equal to 1, the Microsoft 365 service plan is taken into account by the script to find suitable Microsoft 365 service plans for tenant subscriptions.

    4. By default, both active tenant subscriptions and suspended tenant subscriptions are taken into account by the readCSPAccounts.py script.

  • errorSubs_PARTNER_SUBDOMAIN.csv or errorSubs_PARTNER_TENANT_ID.csv. This file contains lists of tenant subscriptions which cannot be imported. Each list of tenant subscriptions is represented in the following way:

    • OSACustomerID: The identifier of the corresponding customer account in CloudBlue Commerce. It is set to -1 if the customer account cannot be found.
    • CSPAccountId: The CSP customer identifier of the tenant in the Microsoft cloud.
    • SubscriptionStartDate: The start date of the Microsoft 365 subscription which will be created in CloudBlue Commerce.
    • MSSubscriptionIDs: The list of tenant subscriptions.
    • MSSubscriptionOfferIDs: The list of offer identifiers.
    • Comments: Comments containing information which may be used for troubleshooting.

    Analyze the errorSubs_PARTNER_SUBDOMAIN.csv or errorSubs_PARTNER_TENANT_ID.csv file and fix problems. After doing this, you can run the readCSPAccounts.py script again.

  • readCSPAccountsYYYY-MM-DD.log. The log file of the readCSPAccounts.py script.

You can run the readCSPAccounts.py script, for example, in the following way: readCSPAccounts.py --vendor-id 1 --csp-app-instance-id 10

After running the readCSPAccounts.py script, make sure all tenant subscriptions are processed correctly:

  1. Check that each tenant belongs to the corresponding customer account.
  2. Check that each list of tenant subscriptions belongs to the appropriate Microsoft 365 service plan; the correct resource rates and limits are specified for each list of tenant subscriptions; the billing frequencies of the tenant subscriptions belong to the billing periods of their Microsoft 365 service plans. If required, update the importSubs_PARTNER_SUBDOMAIN.csv or importSubs_PARTNER_TENANT_ID.csv file.