Remove a reseller relationship with a customer

Applies To

  • Partner Center

Remove a reseller relationship with a customer that you no longer have transactions with.


  • Credentials as described in Partner Center authentication. This scenario supports authentication with App+User credentials only.
  • A customer ID (customer-tenant-id). If you do not have a customer's ID, you can look up the ID in Partner Center by choosing the customer from the customers list, selecting Account, then saving their Microsoft ID.


To remove the reseller relationship for a customer, you must first ensure that all active subscriptions for that customer are suspended. To do this, determine the ID of the customer for whom you want to delete the reseller relationship (in the following code example, the user is prompted to provide the customer identifier). Then, retrieve a collection of the customer's subscriptions by calling the IAggregatePartner.Customers.ById method using the customer identifier to specify the customer, and the Subscriptions property to retrieve an interface to subscription collection operations. Finally, call the Get or GetAsync method to retrieve the customer's subscriptions collection. Traverse the subscription collection and ensure that none of the subscriptions have a Subscriptions.Status property value of SubscriptionStatus.Active. If a subscription is still active, see Suspend a subscription for information on how to suspend it.

After confirming that all active subscriptions are suspended, you can remove the reseller relationship for the customer. First, create a new Customer object with the Customer.RelationshipToPartner property set to CustomerPartnerRelationship.None. Then call the IAggregatePartner.Customers.ById method using the customer identifier to specify the customer, and call the Patch method, passing in the new customer object.

To re-establish the relationship, repeat the process of requesting a reseller relationship.

// IAggregatePartner partnerOperations;

// Prompt the user the enter the customer ID.
var customerIdToDeleteRelationshipOf = this.Context.ConsoleHelper.ReadNonEmptyString("Please enter the ID of the customer you want to delete the relationship with", "The customer ID can't be empty");

// Verify that there are no active subscriptions
ResourceCollection<Subscription> customerSubscriptions = partnerOperations.Customers.ById(customerIdToDeleteRelationshipOf).Subscriptions.Get();
IList<Subscription> subscriptions = new List<Subscription>(customerSubscriptions.Items);

foreach (Subscription customerSubscription in subscriptions)
    if (customerSubscription.Status == SubscriptionStatus.Active)
        this.Context.ConsoleHelper.Warning(String.Format("Subscription with ID :{0}  OfferName: {1} cannot be in active state, ", customerSubscription.Id, customerSubscription.OfferName));
        this.Context.ConsoleHelper.Warning("Please Suspend all the Subscriptions and try again. Aborting the delete customer relationship operation");

// Delete the customer's relationship to the partner.
Customer customer = new Customer();
customer.RelationshipToPartner = CustomerPartnerRelationship.None;
customer = partnerOperations.Customers.ById(customerIdToDeleteRelationshipOf).Patch(customer);

if (customer.RelationshipToPartner == CustomerPartnerRelationship.None)
    this.Context.ConsoleHelper.Success("Customer Partner Relationship successfully deleted");

Sample: Console test app. Project: PartnerSDK.FeatureSample Class: DeletePartnerCustomerRelationship.cs

REST Request

Request syntax

Method Request URI
PATCH {baseURL}/v1/customers/{customer-tenant-id}/ HTTP/1.1

URI parameter

This table lists the required query parameters to remove a reseller relationship.

Name Type Required Description
customer-tenant-id guid Y The value is a GUID formatted customer-tenant-id that identifies the customer.

Request headers

Request body

A Customer resource is required in the request body. Ensure the RelationshipToPartner property has been set to none.

Request example

PATCH<customer-tenant-id> HTTP/1.1
Authorization: Bearer <token>
Content-Length: 74
Content-Type: application/json; charset=utf-8
MS-CorrelationId: 9b4bf2ca-f374-4d51-9113-781ca87b8380
MS-RequestId: 9fef8b23-6e3e-45d2-8678-e9fe89c35af5
Date: Fri, 12 Jan 2018 00:31:55 GMT


REST Response

If successful, this method removes a reseller relationship for the specified customer.

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 200 OK
MS-RequestId: 7988dde4-b516-472c-b226-6d53fb18f04e
MS-CorrelationId: 9b4bf2ca-f374-4d51-9113-781ca87b8380
X-Locale: en-US
Content-Type: application/json
Content-Length: 242
Expect: 100-continue