How to Add Validation Rules for Taxpayer Identification Numbers

Customers from some countries must specify their taxpayer identification numbers when buying Microsoft 365 services. The countries affected by this requirement are listed in the Microsoft Partner Center documentation.

Note: Microsoft may change the list of countries affected by this requirement.

To comply with this requirement, the application allows customers and resellers on behalf of their customers to specify taxpayer identification numbers through UX1 for Customers and UX1 for Resellers in the sales wizard in the Tax Registration ID field. This functionality works in the following way:

  1. The application retrieves the country name specified in the contact data of a customer account.

  2. The application checks whether it has a validation rule for taxpayer identification numbers for that country in Settings.config of the application endpoint.

  3. If this validation rule exists, that customer is asked to specify a taxpayer identification number.

  4. The specified taxpayer identification number is validated against that validation rule.

Settings.config contains validation rules for some countries by default, but when Microsoft changes the list of countries affected by the requirement, you must manually synchronize these validation rules with the list from Microsoft.

For example, to add new validation rules, complete these steps:

  1. On your application endpoint host, open the Settings.config file of your application endpoint in an editor.

  2. For each new country, add the following line:

    <add key="TAX_REG_ID_VALIDATION_RULE_COUNTRY_CODE" value="VALIDATION_PATTERN" />

    Where:

    • COUNTRY_CODE is the ISO 2 country code of this country.

    • VALIDATION_PATTERN is the validation pattern for taxpayer identification numbers for this country. You must obtain this validation pattern from your Microsoft representative.

    For example, the rule for Hungary looks like this:

    <add key="TAX_REG_ID_VALIDATION_RULE_HU" value="^(\d{10}|\d{11})$" />
  3. Save the file.

  4. Restart IIS by using this command:

    iisreset