Create a customer

Applies To

  • Partner Center
  • Partner Center operated by 21Vianet
  • Partner Center for Microsoft Cloud Germany
  • Partner Center for Microsoft Cloud for US Government

This topic explains how to create a new customer. If you are an indirect provider and you want to create a customer for an indirect reseller, please see Create a customer for an indirect reseller.

As a cloud solution provider (CSP) partner, when you create a customer you can place orders on behalf of the customer. When you create a customer, you also create:

  • An Azure Active Directory (AD) tenant object for the customer.
  • A relationship between the reseller and customer, used for delegated admin privileges.
  • A user name and password to sign in as an admin for the customer.

Once the customer is created, save the customer ID and Azure AD details for future use with the Partner Center SDK. You will need them for use with account management, for example.

Prerequisites

Credentials as described in Partner Center authentication. This scenario supports authentication with both standalone App and App+User credentials.

C#

To add a customer, instantiate a new Customer object. Be sure to fill in the BillingProfile and CompanyProfile. Then, add it to your IAggregatePartners.Customers collection by calling Create() or CreateAsync().

// IAggregatePartner partnerOperations;
var partnerOperations = this.Context.UserPartnerOperations;

var customerToCreate = new Customer()
{
    CompanyProfile = new CustomerCompanyProfile()
    {
        Domain = string.Format(CultureInfo.InvariantCulture, 
            "SampleApplication{0}.{1}", 
            new Random().Next(), 
            this.Context.Configuration.Scenario.CustomerDomainSuffix)
    },
    BillingProfile = new CustomerBillingProfile()
    {
        Culture = "EN-US",
        Email = "SomeEmail@Outlook.com",
        Language = "En",
        CompanyName = "Some Company" + new Random().Next(),
        DefaultAddress = new Address()
        {
            FirstName = "Tania",
            LastName = "Carr",
            AddressLine1 = "One Microsoft Way",
            City = "Redmond",
            State = "WA",
            Country = "US",
            PostalCode = "98052",
            PhoneNumber = ""
        }
    }
};

var newCustomer = partnerOperations.Customers.Create(customerToCreate);

Sample: Console test app. Project: Partner Center SDK Samples Class: CreateCustomer.cs

Request

Request syntax

Method Request URI
POST {baseURL}/v1/customers HTTP/1.1

Request headers

  • This API is idempotent (it will not yield a different result if you call it multiple times).
  • A request ID and correlation ID are required.
  • See Partner Center REST headers for more information.

Request body

This table describes the required properties in the request body.

Name Type Description
BillingProfile object The customer's billing profile information.
CompanyProfile object The customer's company profile information.

Billing Profile

This table describes the minimum required fields from the CustomerBillingProfile resource needed to create a new customer.

Name Type Description
email string The customer's email address.
culture string Their preferred culture for communication and currency, such as "en-US". See Table of Language Culture Names for the supported cultures.
language string The default language. Two character language codes (e.g., en, fr) are supported.
company_name string The registered company/organization name.
default_address Address The registered address of the customer's company/organization. See the Address resource for information on any length limitations.

Company Profile

This table describes the minimum required fields from the CustomerCompanyProfile resource needed to create a new customer.

Name Type Description
domain string The customer's domain name, such as contoso.onmicrosoft.com.

Request example

POST https://api.partnercenter.microsoft.com/v1/customers HTTP/1.1
Authorization: Bearer <token> 
Accept: application/json
MS-RequestId: 94e4e214-6b06-4fb7-96d1-94d559f9b47f
MS-CorrelationId: ab993325-1605-4cf4-bac4-fb584142a31b
X-Locale: en-US
Content-Type: application/json
Host: api.partnercenter.microsoft.com
Content-Length: 789
Expect: 100-continue
Connection: Keep-Alive

{
    "CompanyProfile": {
        "Domain": "xyz.ccsctp.net",
    },
    "BillingProfile": {
        "Culture": "EN-US",
        "Email": "test@outlook.com",
        "Language": "en",
        "CompanyName": "test company",
        "DefaultAddress": {
            "FirstName": "Test",
            "LastName": "Test",
            "AddressLine1": "One Microsoft Way",
            "City": "Redmond",
            "State": "WA",
            "PostalCode": "98052",
            "Country": "US",
        }
    }
}

Response

If successful, this API returns a Customer resource for the new customer. Save the customer ID and Azure AD details for future use with the Partner Center SDK. You will need them for use with account management, for example.

Response success and error codes

Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For the full list, see Partner Center REST error codes.

Response example

HTTP/1.1 201 Created
Content-Length: 834
Content-Type: application/json; charset=utf-8
MS-CorrelationId: ab993325-1605-4cf4-bac4-fb584142a31b
MS-RequestId: 94e4e214-6b06-4fb7-96d1-94d559f9b47f
MS-CV: ObwhuhD2tUKJoM+Z.0
MS-ServerId: 202010223
Date: Tue, 14 Feb 2017 20:06:02 GMT

 {
    "id": "dfd8cc0a-c592-468c-8461-869a38d24738",
    "commerceId": "0a4ce58a-6f96-4273-8035-d9c7d31b9ba4",
    "companyProfile": {
        "tenantId": "dfd8cc0a-c592-468c-8461-869a38d24738",
        "domain": "xyz.ccsctp.net",
        "attributes": {
            "objectType": "CustomerCompanyProfile"
        }
    },
    "billingProfile": {
        "id": "d17c0275-da92-5c33-9032-782ef1d0b69b",
        "email": "test@outlook.com",
        "culture": "en-US",
        "language": "en",
        "companyName": "test company",
        "defaultAddress": {
            "country": "US",
            "city": "Redmond",
            "state": "WA",
            "addressLine1": "One Microsoft Way",
            "postalCode": "98052",
            "firstName": "Test",
            "lastName": "Test",
            "phoneNumber": ""
        },
        "attributes": {
            "etag": "5920358838484612121",
            "objectType": "CustomerBillingProfile"
        }
    },
    "relationshipToPartner": "none",
    "userCredentials": {
        "userName": "admin",
        "password": "=;;n.=s9Z"
    },
    "attributes": {
        "objectType": "Customer"
    }
}