顧客のサブスクリプションの使用状況の概要を取得する

適用対象: パートナー センター | Microsoft Cloud for US Government のパートナー センター

SubscriptionUsageSummary リソースを使用して、顧客のサブスクリプション使用状況の概要を取得できます。 このリソースは、現在の課金期間中の特定の Azure サービスまたはリソースのサブスクリプション使用状況の概要を表します。

前提条件

  • パートナー センターの認証に関するページで説明している資格情報。 このシナリオでは、アプリとユーザーの資格情報を使用した認証のみがサポートされます。

  • 顧客 ID です (customer-tenant-id)。 顧客の ID がわからない場合は、 パートナー センター で [顧客] ワークスペースを選択し、 次に顧客 の一覧から顧客を探し、[ アカウント] を選択します。 お客様のアカウント ページで、 [顧客のアカウント情報] セクションの Microsoft ID を探します。 Microsoft ID は、顧客 ID (customer-tenant-id) と同じです。

  • サブスクリプション識別子

C#

顧客のサブスクリプションのサブスクリプション使用状況の概要を取得するには:

  1. ById() メソッドを呼び出すには、IAggregatePartner.Customers コレクションを使用します。

  2. 次に、Subscriptions プロパティと UsageSummary プロパティを呼び出します。 Get() メソッドまたは GetAsync() メソッドを呼び出して完了します。

    // IAggregatePartner partnerOperations;
    // var selectedCustomerId as string;
    // var selectedSubscriptionId as string;
    
    var subscriptionUsageSummary = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ById(selectedSubscriptionId).UsageSummary.Get();
    

例については、次を参照してください。

REST 要求

要求の構文

認証方法 要求 URI
GET {baseURL}/v1/customers/{customer-tenant-id}/subscriptions/{subscription-id}/usagesummary HTTP/1.1

URI パラメーター

次の表に、顧客の評価された使用状況情報を取得するために必要なクエリ パラメーターの一覧を示します。

名前 Type 必須 説明
customer-tenant-id guid Y 顧客に対応する GUID。
subscription-id guid Y サブスクリプションの識別子に対応する GUID。 Azure プランの場合、これは対応するパートナー センター サブスクリプション リソースの識別子であり、これは Azure プランを表します。 Azure プラン サブスクリプション リソースの場合は、このルートのサブスクリプション ID として plan-id を指定します。

要求ヘッダー

詳細については、「パートナー センター REST ヘッダー」を参照してください。

[要求本文]

なし。

要求の例

GET https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/subscriptions/{subscription-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 応答

成功した場合、このメソッドは応答本文で SubscriptionUsageSummary リソースを返します。

応答の成功とエラーのコード

各応答には、成功または失敗を示す HTTP ステータス コードと、追加のデバッグ情報が付属しています。 このコード、エラーの種類、追加のパラメーターを読み取るには、ネットワーク トレース ツールを使用します。 完全な一覧については、「 エラー コード」を参照してください。

Microsoft Azure (MS-AZR-0145P) サブスクリプションの応答の例

この例では、顧客は 145P Azure PayG オファーを 購入しました。

Microsoft Azure (MS-AZR-0145P) サブスクリプションをお持ちのお客様の場合、API 応答に変更はありません。

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: Tue, 17 Sep 2019 20:31:45 GMT

{
    "resourceId": "ABCDEFGH-F347-41B6-B02C-187B1B778A43",
    "id": "ABCDEFGH-F347-41B6-B02C-187B1B778A43",
    "resourceName": "Microsoft Azure",
    "name": "Microsoft Azure",
    "billingStartDate": "2019-08-28T00:00:00-07:00",
    "billingEndDate": "2019-09-27T00:00:00-07:00",
    "totalCost": 22.861172,
    "currencyLocale": "fr-FR",
    "lastModifiedDate": "2019-09-01T23:04:41.193+00:00",
    "links": {
        "self": {
            "uri": "/customers/<customer-tenant-id>/subscriptions/<subscription-id>/usagesummary",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "SubscriptionUsageSummary"
    }
}

Azure プランの REST 応答の例

この例では、顧客が Azure プランを購入しました。

Azure プランをお持ちのお客様には、次の API 応答の変更があります。

  • currencyLocalecurrencyCode に置き換えられます
  • usdTotalCost は新しいフィールドです
HTTP/1.1 200 OK
Content-Length: 1120
Content-Type: application/json
MS-CorrelationId: 47c36033-af5d-4457-80a4-512c1626fac1
MS-RequestId: e128c8e2-4c33-4940-a3e2-2e59b0abdc67
Date: Tue, 17 Sep 2019 20:31:45 GMT

{
    "resourceId": "11111111-dca5-6f31-d3a6-dbbfad9be0fc",
    "resourceName": "Azure plan",
    "billingStartDate": "2019-09-01T00:00:00+00:00",
    "billingEndDate": "2019-10-01T00:00:00+00:00",
    "totalCost": 28.82860766744404945074,
    "currencyCode": "GBP",
    "usdTotalCost": 35.23000000000000362337,
    "lastModifiedDate": "2019-09-18T17:09:26.16+00:00",
    "links": {
        "self": {
            "uri": "/customers/<customer-tenant-id>/subscriptions/<subscription-id>/usagesummary",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "SubscriptionUsageSummary"
    }
}