Get a usage summary for all of a customer's subscriptions

Applies To

  • Partner Center
  • Partner Center for Microsoft Cloud Germany
  • Partner Center for Microsoft Cloud for US Government

Gets a CustomerUsageSummary resource that represent the customer's usage of a specific Azure service or resource during the current billing period.

Prerequisites

  • 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.

C#

To get a usage summary for all of a customer's subscriptions, use your IAggregatePartner.Customers collection and call the ById() method. Then call the UsageSummary property, followed by the Get() or GetAsync() methods.

// IAggregatePartner partnerOperations;
// var selectedCustomerId as string;

var usageSummary = partnerOperations.Customers.ById(selectedCustomerId).UsageSummary.Get();

Sample: Console test app. Project: PartnerSDK.FeatureSamples Class: GetCustomerUsageSummary.cs

REST Request

Request syntax

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

URI parameter

This table lists the required query parameter to get the customer's rated usage information.

Name Type Required Description
customer-tenant-id guid Y A GUID corresponding to the customer.

Request headers

  • See Headers for more information.

Request body

None.

Request example

GET https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/usagesummary HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: e128c8e2-4c33-4940-a3e2-2e59b0abdc67
MS-CorrelationId: 47c36033-af5d-4457-80a4-512c1626fac4

REST Response

If successful, this method returns a CustomerUsageSummary resource in the response body.

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 Error Codes.

Response example

HTTP/1.1 200 OK
Content-Length: 1120
Content-Type: application/json
MS-CorrelationId: 47c36033-af5d-4457-80a4-512c1626fac4
MS-RequestId: e128c8e2-4c33-4940-a3e2-2e59b0abdc67
Date: Fri, 26 Feb 2016 20:31:45 GMT

{
    budget":{
        "ammount":300.000000,
        "attributes":{
            "objectType":"SpendingBudget"
        }
    },
    "id":"65726577-C208-40FD-9735-8C85AC9CAC68",
    "name":"600 test",
    "billingStartDate":"2016-02-06T00:00:00-08:00",
    "billingEndDate":"2016-03-05T00:00:00-08:00",
    "totalCost":0.0,
    "currencyLocale":"en-US",
    "lastModifiedDate":"2016-02-26T09:42:54.5130558+00:00",
    "links":{
        "self":{
            "uri":"/customers/{customer-tenant-id}/usagesummary",
            "method":"GET",
            "headers":[]
        }
    },
    "attributes":{
        "objectType":"CustomerUsageSummary"
    }
}