レガシ API を使用してプログラムで Azure サブスクリプションを作成する

この記事は、レガシ プレビュー API を使用してプログラムで Azure サブスクリプションを作成する場合に役に立ちます。 この記事では、Azure Resource Manager を使用してプログラムからサブスクリプションを作成する方法について説明します。

さまざまな Azure 契約サブスクリプションの種類で使用できる最新の API バージョンに関して、次のような新しい記事があります。

ただし、最新の API バージョンを使用しない場合は、この記事の情報を引き続き使用できます。

次の契約の種類に対する課金アカウントを使用している Azure のお客様は、プログラムでサブスクリプションを作成できます。

  • Enterprise Agreement
  • Microsoft 顧客契約 (MCA)
  • Microsoft Partner Agreement (MPA)

プログラムで Azure サブスクリプションを作成した場合、そのサブスクリプションには、お客様が Microsoft または正規の販売代理店と締結した Azure サービスの契約が適用されます。 詳細については、「Microsoft Azure の法的情報」を参照してください。

注意

Azure を操作するには、Azure Az PowerShell モジュールを使用することをお勧めします。 作業を開始するには、Azure PowerShell のインストールに関する記事を参照してください。 Az PowerShell モジュールに移行する方法については、「AzureRM から Az への Azure PowerShell の移行」を参照してください。

プログラムでサポート プランを作成することはできません。 新しいサポート プランを購入するか、Azure portal でアップグレードすることができます。 [ヘルプとサポート] に移動し、ページの上部にある [適切なサポート プランを選択] を選択します。

EA 課金アカウントのサブスクリプションを作成する

次のセクションの情報を使用して、EA サブスクリプションを作成します。

前提条件

サブスクリプションを作成するには、登録アカウントの所有者ロールを持っているか、エンタープライズ管理者である必要があります。 そのロールを取得する方法は 2 つあります。

アクセスできるアカウントを検索します。

アカウント所有者に関連付けられた登録アカウントに追加されると、アカウントと登録の関係を使用してサブスクリプション料金の請求先が決定されます。 このアカウント内で作成されたすべてのサブスクリプションは、アカウントが含まれる EA 登録に課金されます。 サブスクリプションを作成するには、サブスクリプションを所有するための登録アカウントおよびユーザー プリンシパルに関する値を受け渡す必要があります。

次のコマンドを実行するには、サブスクリプションが既定で作成されるディレクトリである、アカウント所有者の "ホーム ディレクトリ" にサインインしている必要があります。

自分がアクセスできるすべての登録アカウントを一覧表示するための要求:

GET https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts?api-version=2018-03-01-preview

API 応答で、自分がアクセスできるすべての登録アカウントが一覧表示されます。

{
  "value": [
    {
      "id": "/providers/Microsoft.Billing/enrollmentAccounts/747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "name": "747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "type": "Microsoft.Billing/enrollmentAccounts",
      "properties": {
        "principalName": "SignUpEngineering@contoso.com"
      }
    },
    {
      "id": "/providers/Microsoft.Billing/enrollmentAccounts/4cd2fcf6-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "name": "4cd2fcf6-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "type": "Microsoft.Billing/enrollmentAccounts",
      "properties": {
        "principalName": "BillingPlatformTeam@contoso.com"
      }
    }
  ]
}

principalName プロパティを使用して、サブスクリプション料金の請求先アカウントを指定します。 そのアカウントの name をコピーします。 たとえば、SignUpEngineering@contoso.com 登録アカウントでサブスクリプションを作成するには、747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx をコピーします。 この識別子は登録アカウントのオブジェクト ID です。 次の手順で enrollmentAccountObjectId として使用できるように、値をどこかに貼り付けておきます。

特定の登録アカウントの中にサブスクリプションを作成する

次の例では、前のステップで選択した登録アカウントに Dev Team Subscription という名前のサブスクリプションを作成します。 サブスクリプション オファーは MS-AZR-0017P (通常のマイクロソフトエンタープライズ契約) です。 また、必要に応じて Azure RBAC 所有者として 2 人のユーザーをサブスクリプションに追加することもできます。

次の要求を実行します。その際、<enrollmentAccountObjectId> を最初のステップでコピーした name (747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx) と置き換えます。 所有者を指定するには、ユーザー オブジェクト ID を取得する方法を参照してください。

POST https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts/<enrollmentAccountObjectId>/providers/Microsoft.Subscription/createSubscription?api-version=2018-03-01-preview

{
  "displayName": "Dev Team Subscription",
  "offerType": "MS-AZR-0017P",
  "owners": [
    {
      "objectId": "<userObjectId>"
    },
    {
      "objectId": "<servicePrincipalObjectId>"
    }
  ]
}
要素名 必須 タイプ 説明
displayName いいえ String サブスクリプションの表示名です。 指定されていない場合は、"Microsoft Azure エンタープライズ" などのプラン名に設定されます。
offerType はい String サブスクリプションのオファーです。 EA では、MS-AZR-0017P (運用環境用) と MS-AZR-0148P (開発/テスト用。Azure portal を使用して有効にする必要があります) の 2 つのオプションがあります。
owners いいえ String サブスクリプションの作成時、それに Azure RBAC 所有者として追加するユーザーのオブジェクト ID。

応答では、ヘッダー Location の一部として、サブスクリプション作成操作の状態を照会できる URL が返されます。 サブスクリプションの作成が完了すると、Location URL の GET によって、サブスクリプション ID を持つ subscriptionLink オブジェクトが返されます。 詳細については、サブスクリプション API のドキュメントを参照してください

Azure Enterprise のサブスクリプション作成 API の制限事項

  • この API を使用して作成できるのは、Azure Enterprise サブスクリプションのみです。
  • 登録アカウントあたりのサブスクリプション数は 5000 までに制限されています。 その後、アカウントの追加のサブスクリプションは、Azure portal でのみ作成することができます。 API を使用してさらにサブスクリプションを作成する場合は、別の登録アカウントを作成します。 キャンセル、削除、および譲渡されたサブスクリプションもカウントされ、5000 件の制限の対象となります。
  • アカウント所有者ではないが、Azure RBAC で登録アカウントに追加されたユーザーは、Azure portal でサブスクリプションを作成することはできません。
  • サブスクリプションが作成されるテナントを選択することはできません。 サブスクリプションは常に、アカウント所有者のホーム テナント内に作成されます。 サブスクリプションを別のテナントに移動する場合は、テナントのサブスクリプションの変更に関する記事を参照してください。

MCA アカウントのサブスクリプションを作成する

次のセクションの情報を使用して、MCA アカウントのサブスクリプションを作成します。

前提条件

サブスクリプションを作成するには、請求書セクションで所有者、共同作成者、または Azure サブスクリプション作成者のロールを持っているか、課金プロファイルまたは課金アカウントで所有者または共同作成者のロールを持っている必要があります。 詳細については、「サブスクリプションの課金ロールとタスク」を参照してください。

以下の例では REST API を使用します。 現時点では、PowerShell と Azure CLI はサポートされていません。

アクセスできる課金アカウントを検索する

すべての課金アカウントの一覧を表示するには、次の要求を行います。

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts?api-version=2019-10-01-preview

API 応答で、自分がアクセスできる課金アカウントが一覧表示されます。

{
  "value": [
    {
      "id": "/providers/Microsoft.Billing/billingAccounts/5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
      "name": "5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
      "properties": {
        "accountId": "5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "accountStatus": "Active",
        "accountType": "Enterprise",
        "agreementType": "MicrosoftCustomerAgreement",
        "displayName": "Contoso",
        "hasReadAccess": true,
        "organizationId": "41b29574-xxxx-xxxx-xxxx-xxxxxxxxxxxxx_xxxx-xx-xx"
      },
      "type": "Microsoft.Billing/billingAccounts"
    },
    {
      "id": "/providers/Microsoft.Billing/billingAccounts/4f89e155-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
      "name": "4f89e155-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
      "properties": {
        "accountId": "4f89e155-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "accountStatus": "Active",
        "accountType": "Enterprise",
        "agreementType": "MicrosoftCustomerAgreement",
        "displayName": "Fabrikam",
        "hasReadAccess": true,
        "organizationId": "41b29574-xxxx-xxxx-xxxx-xxxxxxxxxxxxx_xxxx-xx-xx"
      },
      "type": "Microsoft.Billing/billingAccounts"
    }
  ]
}

displayName プロパティを使用して、サブスクリプションを作成する課金アカウントを指定します。 アカウントの agreementType が MicrosoftCustomerAgreement であることを確認します。 アカウントの name をコピーします。 たとえば、Contoso 課金アカウントのサブスクリプションを作成するには、5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx をコピーします。 次の手順で使用できるように、値をどこかに貼り付けておきます。

サブスクリプションを作成する請求書セクションを検索する

お使いのサブスクリプションの料金は、課金プロファイルの請求書のセクションに表示されます。 次の API を使用して、自分に Azure サブスクリプションを作成するためのアクセス権がある請求書セクションと課金プロファイルの一覧を取得します。

次の要求を実行します。その際、<billingAccountName> を最初のステップでコピーした name (5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx) と置き換えます。

POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/<billingAccountName>/listInvoiceSectionsWithCreateSubscriptionPermission?api-version=2019-10-01-preview

API 応答には、自分にサブスクリプションを作成するためのアクセス権があるすべての請求書セクションとその課金プロファイルが一覧表示されます。

{
    "value": [{
        "billingProfileDisplayName": "Contoso finance",
        "billingProfileId": "/providers/Microsoft.Billing/billingAccounts/5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/billingProfiles/PBFV-xxxx-xxx-xxx",
        "enabledAzurePlans": [{
            "productId": "DZH318Z0BPS6",
            "skuId": "0001",
            "skuDescription": "Microsoft Azure Plan"
        }, {
            "productId": "DZH318Z0BPS6",
            "skuId": "0002",
            "skuDescription": "Microsoft Azure Plan for DevTest"
        }],
        "invoiceSectionDisplayName": "Development",
        "invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/billingProfiles/PBFV-xxxx-xxx-xxx/invoiceSections/GJ77-xxxx-xxx-xxx"
    }, {
        "billingProfileDisplayName": "Contoso finance",
        "billingProfileId": "/providers/Microsoft.Billing/billingAccounts/5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/billingProfiles/PBFV-xxxx-xxx-xxx",
        "enabledAzurePlans": [{
            "productId": "DZH318Z0BPS6",
            "skuId": "0001",
            "skuDescription": "Microsoft Azure Plan"
        }, {
            "productId": "DZH318Z0BPS6",
            "skuId": "0002",
            "skuDescription": "Microsoft Azure Plan for DevTest"
        }],
        "invoiceSectionDisplayName": "Testing",
        "invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/billingProfiles/PBFV-XXXX-XXX-XXX/invoiceSections/GJGR-XXXX-XXX-XXX"
  }]
}

invoiceSectionDisplayName プロパティを使用して、サブスクリプションを作成する請求書セクションを指定します。 請求書セクションの invoiceSectionIdbillingProfileId、いずれかの skuId をコピーします。 たとえば、Development 請求書セクションの Microsoft Azure plan 型のサブスクリプションを作成するには、/providers/Microsoft.Billing/billingAccounts/5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_2019-05-31/billingProfiles/PBFV-XXXX-XXX-XXX/invoiceSections/GJGR-XXXX-XXX-XXX/providers/Microsoft.Billing/billingAccounts/5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_2019-05-31/billingProfiles/PBFV-xxxx-xxx-xxx、および 0001 をコピーします。 次の手順で使用できるように、これらの値をどこかに貼り付けておきます。

請求書セクションのサブスクリプションを作成する

次の例では、Dev Team Subscription という名前で種類が Microsoft Azure プランであるサブスクリプションを、Development 請求書セクションを対象に作成します。 サブスクリプションは Contoso finance の課金プロファイルに請求され、請求書の Development セクションに表示されます。

次の要求を実行します。その際、<invoiceSectionId> を 2 番目のステップでコピーした invoiceSectionId (/providers/Microsoft.Billing/billingAccounts/5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_2019-05-31/billingProfiles/PBFV-XXXX-XXX-XXX/invoiceSections/GJGR-XXXX-XXX-XXX) と置き換えます。 2 番目の手順でコピーした billingProfileIdskuId を API の要求パラメーターで渡します。 所有者を指定するには、ユーザー オブジェクト ID を取得する方法を参照してください。

POST https://management.azure.com<invoiceSectionId>/providers/Microsoft.Subscription/createSubscription?api-version=2018-11-01-preview
'{"displayName": "Dev Team subscription",
  "billingProfileId": "<billingProfileId>",
  "skuId": "<skuId>",
  "owners": [
      {
        "objectId": "<userObjectId>"
      },
      {
        "objectId": "<servicePrincipalObjectId>"
      }
    ],
  "costCenter": "35683",
  "managementGroupId": "/providers/Microsoft.Management/managementGroups/xxxxxxx",",
}'

要素名 必須 タイプ 説明
displayName イエス String サブスクリプションの表示名です。
billingProfileId はい String サブスクリプションの料金に対して課金される課金プロファイルの ID です。
skuId はい String Azure プランの種類を決定する SKU ID です。
owners いいえ String サブスクリプションの作成時にサブスクリプションに Azure RBAC 所有者として追加するユーザーまたはサービス プリンシパルのオブジェクト ID です。
costCenter いいえ String サブスクリプションに関連付けられているコスト センターです。 使用状況の CSV ファイルに表示されます。
managementGroupId いいえ String サブスクリプションが追加される管理グループの ID です。 管理グループの一覧を取得するには、「管理グループ - 一覧表示」の API を参照してください。 API からの管理グループの ID を使用します。

監視対象の subscriptionCreationResult オブジェクトが返されます。 サブスクリプションの作成が完了すると、subscriptionCreationResult オブジェクトから、サブスクリプション ID を持つ subscriptionLink オブジェクトが返されます。

MPA 課金アカウントのサブスクリプションを管理する

次のセクションの情報を使用して、MPA 課金アカウントのサブスクリプションを作成します。

前提条件

課金アカウントのサブスクリプションを作成するには、組織のクラウド ソリューション プロバイダー アカウントにグローバル管理者ロールまたは管理エージェント ロールが必要です。 詳細については、「パートナー センター - ユーザー ロールとアクセス許可の割り当て」を参照してください。

以下の例では REST API を使用します。 現時点では、PowerShell と Azure CLI はサポートされていません。

アクセス権のある課金アカウントを検索する

自分がアクセスできるすべての課金アカウントを一覧表示するには、以下の要求を行います。

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts?api-version=2019-10-01-preview

API の応答には、課金アカウントの一覧が含まれます。

{
  "value": [
    {
      "id": "/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
      "name": "99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
      "properties": {
        "accountId": "5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "accountStatus": "Active",
        "accountType": "Enterprise",
        "agreementType": "MicrosoftPartnerAgreement",
        "displayName": "Contoso",
        "hasReadAccess": true,
        "organizationId": "1d100e69-xxxx-xxxx-xxxx-xxxxxxxxxxxxx_xxxx-xx-xx"
      },
      "type": "Microsoft.Billing/billingAccounts"
    },
    {
      "id": "/providers/Microsoft.Billing/billingAccounts/4f89e155-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
      "name": "4f89e155-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
      "properties": {
        "accountId": "4f89e155-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "accountStatus": "Active",
        "accountType": "Enterprise",
        "agreementType": "MicrosoftCustomerAgreement",
        "displayName": "Fabrikam",
        "hasReadAccess": true,
        "organizationId": "1d100e69-xxxx-xxxx-xxxx-xxxxxxxxxxxxx_xxxx-xx-xx"
      },
      "type": "Microsoft.Billing/billingAccounts"
    }
  ]
}

displayName プロパティを使用して、サブスクリプションを作成する課金アカウントを指定します。 アカウントの agreementType が MicrosoftPartnerAgreement であることを確認します。 アカウントの name をコピーします。 たとえば、Contoso 課金アカウントのサブスクリプションを作成するには、99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx をコピーします。 次の手順で使用できるように、値をどこかに貼り付けておきます。

Azure プランの顧客を検索する

次の要求を実行します。その際、<billingAccountName> を最初のステップでコピーした name (5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx) と置き換えます。これにより、課金アカウントの顧客のうち、自分が Azure サブスクリプションを作成できるすべての顧客が一覧表示されます。

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/<billingAccountName>/customers?api-version=2019-10-01-preview

API 応答には、課金アカウントの顧客のうち、Azure プランを利用している顧客が一覧表示されます。 これらの顧客のサブスクリプションを作成できます。

{
  "value": [
    {
      "id": "/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/2281f543-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "name": "2281f543-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "properties": {
        "billingProfileDisplayName": "Contoso USD",
        "billingProfileId": "/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/billingProfiles/JUT6-xxxx-xxxx-xxxx",
        "displayName": "Fabrikam toys"
      },
      "type": "Microsoft.Billing/billingAccounts/customers"
    },
    {
      "id": "/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/97c3fac4-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "name": "97c3fac4-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "properties": {
        "billingProfileDisplayName": "Fabrikam sports",
        "billingProfileId": "/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/billingProfiles/JUT6-xxxx-xxxx-xxxx",
        "displayName": "Fabrikam bakery"
      },
      "type": "Microsoft.Billing/billingAccounts/customers"
    }]
}

displayName プロパティを使用して、サブスクリプションを作成する対象の顧客を指定します。 顧客の id をコピーします。 たとえば、Fabrikam toys のサブスクリプションを作成するには、/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/2281f543-xxxx-xxxx-xxxx-xxxxxxxxxxxx をコピーします。 後の手順で使用するので、値をどこかに貼り付けておきます。

間接プロバイダー向けのオプション: 顧客のリセラーを取得する

CSP の 2 層モデルの間接プロバイダーである場合は、顧客のサブスクリプションを作成するときにリセラーを指定できます。

次の要求を実行します。その際、<customerId> を 2 番目のステップでコピーした id (/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/2281f543-xxxx-xxxx-xxxx-xxxxxxxxxxxx) と置き換えます。これにより、顧客が利用できるすべてのリセラーが一覧表示されます。

GET https://management.azure.com<customerId>?$expand=resellers&api-version=2019-10-01-preview

API 応答には、顧客向けのリセラーが一覧表示されます。

{
  "value": [{
  "id": "/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/2ed2c490-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "name": "2ed2c490-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "type": "Microsoft.Billing/billingAccounts/customers",
  "properties": {
    "displayName": "Fabrikam toys",
    "resellers": [
      {
        "resellerId": "3xxxxx",
        "description": "Wingtip"
      }
    ]
  }
},
{
  "id": "/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/4ed2c793-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "name": "4ed2c793-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "type": "Microsoft.Billing/billingAccounts/customers",
  "properties": {
    "displayName": "Fabrikam toys",
    "resellers": [
      {
        "resellerId": "5xxxxx",
        "description": "Tailspin"
      }
    ]
  }
}]
}

description プロパティを使用して、サブスクリプションに関連付けるリセラーを特定します。 リセラーの resellerId をコピーします。 たとえば、Wingtip を関連付けるには、3xxxxx をコピーします。 次の手順で使用できるように、値をどこかに貼り付けておきます。

顧客のサブスクリプションを作成する

次の例では、Dev Team subscription という名前のサブスクリプションを Fabrikam toys 用に作成し、Wingtip リセラーをそのサブスクリプションに関連付けます。

次の要求を実行します。その際、<customerId> を 2 番目のステップでコピーした id (/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/2281f543-xxxx-xxxx-xxxx-xxxxxxxxxxxx) と置き換えます。 2 番目のステップでコピーしたオプションの resellerId を API の要求パラメーターで渡します。

POST https://management.azure.com<customerId>/providers/Microsoft.Subscription/createSubscription?api-version=2018-11-01-preview
'{"displayName": "Dev Team subscription",
  "skuId": "0001",
  "resellerId": "<resellerId>",
}'
要素名 必須 タイプ 説明
displayName イエス String サブスクリプションの表示名です。
skuId はい String Azure プランの SKU ID です。 種類が Microsoft Azure プランであるサブスクリプションには 0001 を使用します。
resellerId いいえ String サブスクリプションに関連付けられるリセラーの ID です。

監視対象の subscriptionCreationResult オブジェクトが返されます。 サブスクリプションの作成が完了すると、subscriptionCreationResult オブジェクトによって、subscriptionLink オブジェクトが返されます。 これには、サブスクリプション ID が含まれています。

次のステップ

  • .NET を使用して Enterprise Agreement (EA) サブスクリプションを作成する例を表示するには、GitHub のサンプル コードを参照してください。