サブスクリプションを移行する
適用対象: パートナー センター | 21Vianet が運営するパートナー センター | Microsoft Cloud for US Government のパートナー センター
顧客のサブスクリプションを、指定されたターゲット サブスクリプションにアップグレードします。
前提条件
パートナー センターの認証に関するページで説明している資格情報。 このシナリオでは、スタンドアロンの App と App+User の両方の資格情報を使用した認証がサポートされています。
顧客 ID です (
customer-tenant-id
)。 顧客の ID がわからない場合は、[顧客] ワークスペースを選択し、顧客の一覧から顧客を選択し、[アカウント] を選択して、パートナー センターで検索できます。 顧客の [アカウント] ページで、[顧客アカウント情報] セクションで Microsoft ID を探します。 Microsoft ID は、顧客 ID (customer-tenant-id
) と同じです。最初のサブスクリプション用とターゲット サブスクリプション用の 2 つのサブスクリプション ID。
GDAP ロール
次の GDAP ロールのうち少なくとも 1 つが必要です。
- ディレクトリ リーダーまたはグローバル リーダー (アップグレードのみ)
- ディレクトリ ライター (ライセンス転送によるアップグレード)
C#
顧客のサブスクリプションをアップグレードするには、最初 に顧客のサブスクリプションを取得します。 次に、Upgrades プロパティの後に Get() メソッドまたは GetAsync() メソッドを呼び出して、そのサブスクリプションのアップグレードの一覧を取得します。 アップグレードの一覧からターゲット アップグレードを選択し、最初のサブスクリプションの Upgrades プロパティを呼び出し、次に Create() メソッドを呼び出します。
// IAggregatePartner partnerOperations;
// string selectedCustomerId;
// string subscriptionIdForUpgrade;
// Upgrade targetOffer;
UpgradeResult upgradeResult = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ById(subscriptionIdForUpgrade).Upgrades.Create(targetOffer);
サンプル: コンソール テスト アプリ。 プロジェクト: PartnerSDK.FeatureSamples クラス: UpgradeSubscription.cs
REST 要求
要求の構文
認証方法 | 要求 URI |
---|---|
GET | {baseURL}/v1/customers/{customer-tenant-id}/subscriptions/{id-for-subscription}/upgrades HTTP/1.1 |
POST | {baseURL}/v1/customers/{customer-tenant-id}/subscriptions/{id-for-target}/upgrades HTTP/1.1 |
URI パラメーター
サブスクリプションを移行するには、次のクエリ パラメーターを使用します。
名前 | 種類 | 必須 | 説明 |
---|---|---|---|
customer-tenant-id | guid | Y | 顧客に対応する GUID。 |
id-for-subscription | guid | Y | 初期サブスクリプションに対応する GUID。 |
id-for-target | guid | Y | ターゲット サブスクリプションに対応する GUID。 |
要求ヘッダー
詳細については、「パートナー センター REST ヘッダー」を参照してください。
要求本文
なし
要求の例
GET https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/subscriptions/{id-for-subscription}/upgrades HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 18752a69-1aa1-4ef7-8f9d-eb3681b2d70a
MS-CorrelationId: 81b08ffe-4cf8-49cd-82db-5c2fb0a8e132
X-Locale: en-US
POST https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/subscriptions/{id-for-target}/upgrades HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 750fd5ea-904b-4c3e-b476-60d0feacab0d
MS-CorrelationId: 81b08ffe-4cf8-49cd-82db-5c2fb0a8e132
X-Locale: en-US
Content-Type: application/json
Content-Length: 1098
Expect: 100-continue
{
"TargetOffer":{
"Id":"796B6B5F-613C-4E24-A17C-EBA730D49C02",
"Name":"Office 365 Enterprise E3",
"Description":"The best plan for businesses that need full productivity, communication and collaboration tools with the familiar Office suite, including Office Online.",
"MinimumQuantity":1,
"MaximumQuantity":10000000,
"Rank":61,
"Uri":"/3c95518e-8c37-41e3-9627-0ca339200f53/Offers/796B6B5F-613C-4E24-A17C-EBA730D49C02",
"Locale":"en-us",
"Country":"US",
"Category":{
"Id":"Enterprise_Key",
"Name":"Enterprise",
"Rank":20,
"Locale":"en-us",
"Country":"US",
"Attributes":{
"ObjectType":"OfferCategory"
}
},
"PrerequisiteOffers":[],
"IsAddOn":false,
"IsAvailableForPurchase":true,
"Billing":"license",
"IsAutoRenewable":true,
"Product":{
"Id":"6fd2c87f-b296-42f0-b197-1e91e994b900",
"Name":"Office 365 Enterprise E3",
"Unit":"Licenses"
},
"UnitType":"Licenses",
"Links":{
"LearnMore":{
"Uri":"http://g.microsoftonline.com/0BXPS00en/1015",
"Method":"GET",
"Headers":[]
}
}
"Attributes":{
"ObjectType":"Offer"
}
},
"UpgradeType":1,
"IsEligible":true,
"Quantity":1,
"UpgradeErrors":[],
"Attributes":{
"ObjectType":"Upgrade"
}
}
REST 応答
成功した場合、このメソッドは応答本文でアップグレード結果リソースを返します。
応答の成功とエラーのコード
各応答には、成功または失敗を示す HTTP ステータス コードと、追加のデバッグ情報が付属しています。 このコード、エラーの種類、追加のパラメーターを読み取るには、ネットワーク トレース ツールを使用します。 完全な一覧については、エラー コードに関するページを参照してください。
応答の例
HTTP/1.1 200 OK
Content-Length: 138
Content-Type: application/json
MS-CorrelationId: 81b08ffe-4cf8-49cd-82db-5c2fb0a8e132
MS-RequestId: 18752a69-1aa1-4ef7-8f9d-eb3681b2d70a
Date: Fri, 29 Jan 2016 20:42:26 GMT
{
"totalCount": 1,
"items": [{
"targetOffer": {
"id": "91FD106F-4B2C-4938-95AC-F54F74E9A239",
"name": "Office 365 Enterprise E1",
"description": "For businesses that need communication and collaboration tools and the ability to read and do lightweight editing of documents with Office Online.",
"minimumQuantity": 1,
"maximumQuantity": 10000000,
"rank": 48,
"uri": "/3c95518e-8c37-41e3-9627-0ca339200f53/Offers/91FD106F-4B2C-4938-95AC-F54F74E9A239",
"locale": "en-us",
"country": "US",
"category": {
"id": "Enterprise_Key",
"name": "Enterprise",
"rank": 20,
"locale": "en-us",
"country": "US",
"attributes": {
"objectType": "OfferCategory"
}
},
"prerequisiteOffers": [],
"isAddOn": false,
"isAvailableForPurchase": true,
"billing": "license",
"isAutoRenewable": true,
"isInternal": false,
"conversionTargetOffers": [],
"partnerQualifications": ["none"],
"product": {
"id": "18181a46-0d4e-45cd-891e-60aabd171b4e",
"name": "Office 365 Enterprise E1",
"unit": "Licenses"
},
"unitType": "Licenses",
"links": {
"learnMore": {
"uri": "http://g.microsoftonline.com/0BXPS00en/1013",
"method": "GET",
"headers": []
},
"self": {
"uri": "/offers/91FD106F-4B2C-4938-95AC-F54F74E9A239?country=US",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "Offer"
}
},
"upgradeType": "upgrade_only",
"isEligible": false,
"quantity": 1,
"upgradeErrors": [{
"code": 2,
"description": "Subscription cannot be upgraded because the source subscription state is not active. Additional Details contains the current source subscription state.",
"attributes": {
"objectType": "UpgradeError"
}
}],
"attributes": {
"objectType": "Upgrade"
}
}],
"attributes": {
"objectType": "Collection"
}
}
HTTP/1.1 200 OK
Content-Length: 448
Content-Type: application/json
MS-CorrelationId: 81b08ffe-4cf8-49cd-82db-5c2fb0a8e132
MS-RequestId: 750fd5ea-904b-4c3e-b476-60d0feacab0d
MS-CV: RnK86LBbDkWP/w2R.0
MS-ServerId: 102031201
Date: Fri, 29 Jan 2016 20:44:21 GMT
{
"sourceSubscriptionId":"896a2862-67e2-4f3d-bb3f-c50c42b5fad8",
"targetSubscriptionId":"2add8a55-454a-4ae5-a4c9-5107dc6e9768",
"upgradeType":1,
"upgradeErrors":[],
"licenseErrors":[],
"attributes":{
"objectType":"UpgradeResult"
}
}