この記事は、レガシ プレビュー API を使用してプログラムで Azure サブスクリプションを作成する場合に役に立ちます。 この記事では、Azure Resource Manager を使用してプログラムからサブスクリプションを作成する方法について説明します。
さまざまな Azure 契約サブスクリプションの種類で使用できる最新の API バージョンに関して、次のような新しい記事があります。
- 最新の API を使用してプログラムで EA のサブスクリプションを作成する
- 最新の API を使用してプログラムで MCA のサブスクリプションを作成する
- 最新の API を使用してプログラムで MPA のサブスクリプションを作成する
ただし、最新の API バージョンを使用しない場合は、この記事の情報を引き続き使用できます。
次の契約の種類に対する課金アカウントを使用している Azure のお客様は、プログラムでサブスクリプションを作成できます。
- Enterprise Agreement
- Microsoft 顧客契約 (MCA)
- マイクロソフト パートナー契約 (MPA)
プログラムで Azure サブスクリプションを作成した場合、そのサブスクリプションには、お客様が Microsoft または正規販売代理店から Azure サービスを取得した際の契約が適用されます。 詳細については、「Microsoft Azure の法的情報」を参照してください。
注
Azure を操作するには、Azure Az PowerShell モジュールを使用することをお勧めします。 作業を始めるには、「Azure PowerShell をインストールする」を参照してください。 Az PowerShell モジュールに移行する方法については、「AzureRM から Az への Azure PowerShell の移行」を参照してください。
プログラムでサポート プランを作成することはできません。 新しいサポート プランを購入するか、Azure portal で既存のサポート プランをアップグレードすることができます。 [ヘルプとサポート] に移動し、ページの上部にある [適切なサポート プランを選択] を選択します。
EA 課金アカウントのサブスクリプションを作成する
次のセクションの情報を使用して、EA サブスクリプションを作成してください。
前提条件
サブスクリプションを作成するには、登録アカウントの所有者ロールを持っているか、エンタープライズ管理者である必要があります。 そのロールを取得する方法は 2 つあります。
- 登録のエンタープライズ管理者は、ユーザーをアカウント所有者に設定できます (サインインが必要)。これにより、ユーザーは登録アカウントの所有者になります。
- 登録アカウントの既存の所有者が、アクセス許可を付与できます。 同様に、サービス プリンシパルを使用して EA サブスクリプションを作成する場合は、そのサービス プリンシパルにサブスクリプションを作成する権限を付与する必要があります。
アクセスできるアカウントを検索します。
アカウント所有者に関連付けられた登録アカウントに追加されると、Azure はアカウントと登録の関係を使用してサブスクリプション料金の請求先を決定します。 このアカウント内で作成されたすべてのサブスクリプションは、アカウントが属している EA 登録に課金されます。 サブスクリプションを作成するには、サブスクリプションを所有するための登録アカウントおよびユーザー プリンシパルに関する値を受け渡す必要があります。
次のコマンドを実行するには、サブスクリプションが既定で作成されるディレクトリである、アカウント所有者の "ホーム ディレクトリ" にサインインしている必要があります。
- レスト
- PowerShell
- Azure CLI
自分がアクセスできるすべての登録アカウントを一覧表示するリクエスト:
GET https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts?api-version=2018-03-01-preview
API 応答で、自分がアクセスできるすべての登録アカウントが一覧表示されます。
{
"value": [
{
"id": "/providers/Microsoft.Billing/enrollmentAccounts/aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb",
"name": "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb",
"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 登録アカウントでサブスクリプションを作成するには、aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e をコピーします。 この識別子は登録アカウントのオブジェクト ID です。 次の手順で enrollmentAccountObjectId として使用できるように、値をどこかに貼り付けておきます。
特定の登録アカウントの中にサブスクリプションを作成する
次の例では、前のステップで選択した登録アカウントに Dev Team Subscription という名前のサブスクリプションを作成します。 サブスクリプション オファーは MS-AZR-0017P (通常のマイクロソフトエンタープライズ契約) です。 また、必要に応じて Azure RBAC 所有者として 2 人のユーザーをサブスクリプションに追加することもできます。
- レスト
- PowerShell
- Azure CLI
次の要求を実行します。その際、<enrollmentAccountObjectId> を最初のステップでコピーした name (aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb) と置き換えます。 所有者を指定するには、ユーザー オブジェクト 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 |
いいえ | 糸 | サブスクリプションの表示名です。 指定されていない場合は、"Microsoft Azure エンタープライズ" などのプラン名に設定されます。 |
offerType |
はい | 糸 | サブスクリプションのオファーです。 EA では、MS-AZR-0017P (運用環境用) と MS-AZR-0148P (開発/テスト用。Azure portal を使用して有効にする必要があります) の 2 つのオプションがあります。 |
owners |
いいえ | 糸 | サブスクリプションの作成時、それに 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/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
"name": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
"properties": {
"accountId": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
"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 課金アカウントのサブスクリプションを作成するには、bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx をコピーします。 次の手順で使用できるように、値をどこかに貼り付けておいてください。
サブスクリプションを作成するための請求書セクションを見つける
お使いのサブスクリプションの料金は、課金プロファイルの請求書のセクションに表示されます。 次の API を使用して、Azure サブスクリプションを作成するアクセス許可がある請求書セクションと課金プロファイルの一覧を取得します。
次の要求を実行します。その際、<billingAccountName> を最初のステップでコピーした name (bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f: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/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f: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/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f: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/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f: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/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/billingProfiles/PBFV-XXXX-XXX-XXX/invoiceSections/GJGR-XXXX-XXX-XXX"
}]
}
invoiceSectionDisplayName プロパティを使用して、サブスクリプションを作成する請求書セクションを特定します。 請求書セクションの invoiceSectionId、billingProfileId、いずれかの skuId をコピーします。 たとえば、Microsoft Azure plan 請求書セクションの Development 型のサブスクリプションを作成するには、/providers/Microsoft.Billing/billingAccounts/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_2019-05-31/billingProfiles/PBFV-XXXX-XXX-XXX/invoiceSections/GJGR-XXXX-XXX-XXX、/providers/Microsoft.Billing/billingAccounts/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f: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/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_2019-05-31/billingProfiles/PBFV-XXXX-XXX-XXX/invoiceSections/GJGR-XXXX-XXX-XXX) と置き換えます。 2 番目の手順でコピーした billingProfileId と skuId を 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 |
はい | 糸 | サブスクリプションの表示名です。 |
billingProfileId |
はい | 糸 | サブスクリプションの料金の請求先となる課金プロファイルの ID です。 |
skuId |
はい | 糸 | Azure プランの種類を決定する SKU ID です。 |
owners |
いいえ | 糸 | サブスクリプションの作成時にサブスクリプションに Azure RBAC 所有者として追加するユーザーまたはサービス プリンシパルのオブジェクト ID です。 |
costCenter |
いいえ | 糸 | サブスクリプションに関連付けられているコスト センターです。 使用状況の CSV ファイルに含まれます。 |
managementGroupId |
いいえ | 糸 | サブスクリプションが追加される管理グループの ID です。 管理グループの一覧を取得するには、Management Groups - List 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/cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
"name": "cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx",
"properties": {
"accountId": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
"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 課金アカウントのサブスクリプションを作成するには、cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx をコピーします。 次の手順で使用できるように、値をどこかに貼り付けておいてください。
Azure プランを利用している顧客を検索する
次の要求を実行します。その際、<billingAccountName> を最初のステップでコピーした name (bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f: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/cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/dddd3d3d-ee4e-ff5f-aa6a-bbbbbb7b7b7b",
"name": "dddd3d3d-ee4e-ff5f-aa6a-bbbbbb7b7b7b",
"properties": {
"billingProfileDisplayName": "Contoso USD",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a: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/cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a: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/cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a: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/cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/dddd3d3d-ee4e-ff5f-aa6a-bbbbbb7b7b7b をコピーします。 後の手順で使用するので、値をどこかに貼り付けておいてください。
間接プロバイダー向けのオプション: 顧客のリセラーを取得する
CSP の 2 層モデルの間接プロバイダーである場合は、顧客のサブスクリプションを作成するときにリセラーを指定できます。
次の要求を実行します。その際、<customerId> を 2 番目のステップでコピーした id (/providers/Microsoft.Billing/billingAccounts/cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/dddd3d3d-ee4e-ff5f-aa6a-bbbbbb7b7b7b) と置き換えます。これにより、顧客が利用できるすべてのリセラーが一覧表示されます。
GET https://management.azure.com<customerId>?$expand=resellers&api-version=2019-10-01-preview
API 応答には、顧客のリセラーが一覧表示されます。
{
"value": [{
"id": "/providers/Microsoft.Billing/billingAccounts/cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a: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/cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a: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/cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/dddd3d3d-ee4e-ff5f-aa6a-bbbbbb7b7b7b) と置き換えます。 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 |
はい | 糸 | サブスクリプションの表示名です。 |
skuId |
はい | 糸 | Azure プランの SKU ID です。 種類が Microsoft Azure プランであるサブスクリプションには 0001 を使用します。 |
resellerId |
いいえ | 糸 | サブスクリプションに関連付けられるリセラーの ID です。 |
レスポンスでは、監視用の subscriptionCreationResult オブジェクトが返されます。 サブスクリプションの作成が完了すると、subscriptionCreationResult オブジェクトによって、subscriptionLink オブジェクトが返されます。 これには、サブスクリプション ID が含まれています。
次のステップ
- .NET を使用して Enterprise Agreement (EA) サブスクリプションを作成する例を表示するには、GitHub のサンプル コードを参照してください。
- サブスクリプションを作成し終えたら、他のユーザーおよびサービス プリンシパルにその権限を付与できます。 詳細については、「Azure Enterprise サブスクリプションを作成する権限を付与する (プレビュー)」を参照してください。
- 管理グループを使用して大量のサブスクリプションを管理する方法の詳細については、Azure 管理グループによるリソースの整理に関する記事を参照してください。