इसके माध्यम से साझा किया गया


Get a customer's subscriptions by PartnerID

Applies to: Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government

How to get a list of subscriptions provided by a given Microsoft AI Cloud Partner Program partner to a specified customer.

Prerequisites

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

  • A customer ID (customer-tenant-id). If you don't know the customer's ID, you can look it up in Partner Center by selecting the Customers workspace, then the customer from the customer list, then Account. On the customer’s Account page, look for the Microsoft ID in the Customer Account Info section. The Microsoft ID is the same as the customer ID (customer-tenant-id).

  • A PartnerID

C#

To get a list of subscriptions provided by a given partner to a specified customer, first use the IAggregatePartner.Customers.ById method with the customer ID to identify the customer. Then get an interface to customer subscription collection operations from the Subscriptions property, and call the ByPartner method with the PartnerID to identify the partner and retrieve an interface to partner subscription operations. Finally, call the Get or GetAsync method to get the collection.

// IAggregatePartner partnerOperations;
// string customerId;
// string partnerMpnId;

var customerSubscriptionsByMpnId = partnerOperations.Customers.ById(customerId).Subscriptions.ByPartner(partnerMpnId).Get();

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

Java

The Partner Center Java SDK can be used to manage Partner Center resources. It's an open-source project maintained by the partner community and not officially supported by Microsoft. You can get help from the community or open an issue on GitHub if you experience a problem.

To get a list of subscriptions provided by a given partner to a specified customer, first use the IAggregatePartner.getCustomers.byId function with the customer ID to identify the customer. Then get an interface to customer subscription collection operations from the getSubscriptions function, and call the byPartner function with the PartnerID to identify the partner and retrieve an interface to partner subscription operations. Finally, call the get function to get the collection.

// IAggregatePartner partnerOperations;
// String customerId;
// String partnerMpnId;

ResourceCollection<Subscription> customerSubscriptionsByMpnId = partnerOperations.getCustomers().byId(customerId).getSubscriptions().byPartner(partnerMpnId).get();

PowerShell

The Partner Center PowerShell module can be used to manage Partner Center resources. It's an open-source project maintained by the partner community and not officially supported by Microsoft. You can get help from the community or open an issue on GitHub if you experience a problem.

To get a list of subscriptions provided by a given partner to a specified customer, execute the Get-PartnerCustomerSubscription command. Specify the customer ID to identify the customer using the CustomerId parameter, and populate the MpnId parameter with the PartnerID to identify the partner.

# $customerId
# $partnerMpnId

Get-PartnerCustomerSubscription -CustomerId $customerId -MpnId $partnerMpnId

REST request

Request syntax

Method Request URI
GET {baseURL}/v1/customers/{customer-id}/subscriptions?mpn_id={mpn-id} HTTP/1.1

URI parameters

Use the following path and query parameters to identify the customer and partner.

Name Type Required Description
customer-id string Yes A GUID formatted string that identifies the customer.
mpn-id int Yes A PartnerID that identifies the partner.

Request headers

For more information, see Partner Center REST headers.

Request body

None.

Request example

GET https://api.partnercenter.microsoft.com/v1/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1/subscriptions?mpn_id=4847383 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd 
MS-RequestId: f98d0f61-01da-4d27-a923-8ec1e46e7358 
X-Locale: en-US
Host: api.partnercenter.microsoft.com
Connection: Keep-Alive

REST response

If successful, the response body contains the collection of Subscription resources.

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
Content-Length: 985
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: f98d0f61-01da-4d27-a923-8ec1e46e7358
Date: Thu, 13 Apr 2024 20:58:08 GMT

{ 
  "totalCount": 2, 
  "items": [ 
    { 
      "id": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e", 
      "offerId": "DB2E705F-B82A-4024-A3D5-D88E12F2DB35", 
      "offerName": "Intune Device", 
      "friendlyName": "new offer purchase", 
      "quantity": 5, 
      "unitType": "Licenses", 
      "creationDate": "2024-04-10T23:02:26.02Z", 
      "effectiveStartDate": "2024-04-10T00:00:00Z", 
      "commitmentEndDate": "2025-05-07T00:00:00Z", 
      "status": "active", 
      "autoRenewEnabled": true, 
      "isTrial": false, 
      "billingType": "license", 
      "billingCycle": "monthly", 
      "partnerId": "4847383", 
      "contractType": "subscription", 
      "links": { 
        "offer": { 
          "uri": "/offers/DB2E705F-B82A-4024-A3D5-D88E12F2DB35?country=US", 
          "method": "GET", 
          "headers": [] 
        }, 
        "self": { 
          "uri": "/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e", 
          "method": "GET", 
          "headers": [] 
        } 
      }, 
      "orderId": "3EDDCAC6-63B2-4C40-B0B6-F47E18301492", 
      "attributes": { 
        "etag": "eyJpZCI6IjQyMjI2ZWQ2LTA3MGEtNGUwZi1iODBjLTRjZGZiM2U5N2FhNyIsInZlcnNpb24iOjF9", 
        "objectType": "Subscription" 
      } 
    }, 
    { 
        "id": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f", 
        "offerId": "CFQ7TTC0LH18:0001:CFQ7TTC0P0WS", 
        "offerName": "Microsoft 365 Business Basic", 
        "friendlyName": "Microsoft 365 Business Basic", 
        "productType": { 
            "id": "OnlineServicesNCE", 
            "displayName": "OnlineServicesNCE" 
        }, 
        "quantity": 2, 
        "unitType": "Licenses", 
        "hasPurchasableAddons": false, 
        "creationDate": "2024-06-05T19:26:38.3667635Z", 
        "effectiveStartDate": "2024-06-05T00:00:00Z", 
        "commitmentEndDate": "2024-07-04T00:00:00Z", 
        "commitmentEndDateTime": "2024-07-04T23:59:59Z", 
        "cancellationAllowedUntilDate": "2024-06-12T19:27:03.440527Z", 
        "billingCycleEndDate": "2024-07-04T00:00:00Z", 
        "billingCycleEndDateTime": "2024-07-04T23:59:59Z", 
        "status": "active", 
        "autoRenewEnabled": true, 
        "isTrial": false, 
        "billingType": "license", 
        "billingCycle": "monthly", 
        "termDuration": "P1M", 
        "renewalTermDuration": "", 
        "isMicrosoftProduct": true, 
        "partnerId": "4847383", 
        "attentionNeeded": false, 
        "actionTaken": false, 
        "contractType": "subscription", 
        "links": { 
            "product": { 
                "uri": "/products/CFQ7TTC0LH18?country=US", 
                "method": "GET", 
                "headers": [] 
            }, 
            "sku": { 
                "uri": "/products/CFQ7TTC0LH18/skus/0001?country=US", 
                "method": "GET", 
                "headers": [] 
            }, 
            "availability": { 
                "uri": "/products/CFQ7TTC0LH18/skus/0001/availabilities/CFQ7TTC0P0WS?country=US", 
                "method": "GET", 
                "headers": [] 
            }, 
            "self": { 
                "uri": "/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f", 
                "method": "GET", 
                "headers": [] 
            } 
        }, 
        "publisherName": "Microsoft Corporation", 
        "refundableQuantity": { 
            "totalQuantity": 1, 
            "details": [ 
                { 
                    "quantity": 1, 
                    "allowedUntilDateTime": "2024-06-14T17:41:13.4675407Z" 
                } 
            ] 
        }, 
        "orderId": "79d9f5e2f43a", 
        "attributes": { 
            "objectType": "Subscription" 
        } 
    } 
  ], 
  "attributes": { "objectType": "Collection" } 
} 

See also