顧客との再販業者関係の削除

適用対象: パートナー センター | 21Vianet が運営するパートナー センター | Microsoft Cloud for US Government のパートナー センター

トランザクションがなくなった顧客とのリセラー関係を削除します。

前提条件

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

  • 顧客 ID です (customer-tenant-id)。 顧客の ID がわからない場合は、パートナー センターで検索できます。 パートナー センターのホーム ページから [顧客] ワークスペースを選択します。 [顧客一覧] から顧客を選択した後、[アカウント] を選択します。 顧客の [アカウント] ページの [顧客アカウントの詳細セクション] で Microsoft ID を探します。 Microsoft ID は、顧客 ID (customer-tenant-id) と同じです。

  • リセラー関係が削除される前に、すべての Azure 予約 VM インスタンスの注文を取り消す必要があります。 開いている Azure 予約 VM インスタンスの注文を取り消すには、Azure サポートを呼び出します。

C#

顧客のリセラー関係を削除するには、まず、その顧客のアクティブな Azure 予約 VM インスタンスが取り消されていることを確認します。 次に、その顧客のすべてのアクティブなサブスクリプションが中断されていることを確認します。 これを行うには、リセラー関係を削除する顧客の ID を決定します。 次のコード例では、ユーザーは顧客識別子を指定するように求められます。

顧客の Azure 予約 VM インスタンスを取り消す必要があるかどうかを判断するには、顧客識別子を使用して IAggregatePartner.Customers.ById メソッドを呼び出して権利のコレクションを取得し、エンタイトルメント コレクション操作のインターフェイスを取得する Entitlements プロパティを取得します。 Get メソッドまたは GetAsync メソッドを呼び出して、エンタイトルメント コレクションを取得します。 EntitlementType.VirtualMachineReservedInstance EntitlementType 値を持つエンタイトルメントのコレクションをフィルター処理し、存在する場合は、続行する前にサポートを呼び出して取り消します。

次に、顧客識別子を使用して顧客を指定する IAggregatePartner.Customers.ById メソッドを呼び出して顧客のサブスクリプションのコレクションを取得し、サブスクリプション コレクション操作のインターフェイスを取得する Subscriptions プロパティを取得します。 最後に、Get メソッドまたは GetAsync メソッドを呼び出して、顧客のサブスクリプション コレクションを取得します。 サブスクリプション コレクションを走査し、Subscriptions.Status プロパティ値が SubscriptionStatus.Active のサブスクリプションがないことを確認します。 サブスクリプションがまだアクティブな場合は、サブスクリプションを中断する方法の詳細については、「サブスクリプションを中断する」を参照してください

その顧客のすべてのアクティブな Azure 予約 VM インスタンスが取り消され、アクティブなすべてのサブスクリプションが中断されていることを確認したら、顧客のリセラー関係を削除できます。 まず、relationshiptopartner プロパティが CustomerPartnerRelationship.None に設定された新しい Customer オブジェクトを作成します。 次に、顧客識別子を使用して IAggregatePartner.Customers.ById メソッドを呼び出して顧客を指定し、Patch メソッドを呼び出して新しい顧客オブジェクトを渡します。

リレーションシップを再確立するには、リセラー関係を要求するプロセスを繰り返します。

// IAggregatePartner partnerOperations;

// Prompt the user the enter the customer ID.
var customerIdToDeleteRelationshipOf = this.Context.ConsoleHelper.ReadNonEmptyString("Please enter the ID of the customer you want to delete the relationship with", "The customer ID can't be empty");

// Determine if there are any active Azure Reserved VM Instances for this customer.
ResourceCollection<Entitlement> entitlements = partnerOperations.Customers.ById(customerIdToDeleteRelationshipOf).Entitlements.Get();

If (entitlements.Items.Where(x => x.EntitlementType == EntitlementType.VirtualMachineReservedInstance).Any())
{
    this.Context.ConsoleHelper.Warning("Please cancel Azure Reserved Virtual Machine Instance orders through support and try again. Aborting the delete customer relationship operation");
               return;
}

// Verify that there are no active subscriptions.
ResourceCollection<Subscription> customerSubscriptions = partnerOperations.Customers.ById(customerIdToDeleteRelationshipOf).Subscriptions.Get();
IList<Subscription> subscriptions = new List<Subscription>(customerSubscriptions.Items);

foreach (Subscription customerSubscription in subscriptions)
{
    if (customerSubscription.Status == SubscriptionStatus.Active)
    {
        this.Context.ConsoleHelper.Warning(String.Format("Subscription with ID :{0}  OfferName: {1} cannot be in active state, ", customerSubscription.Id, customerSubscription.OfferName));
        this.Context.ConsoleHelper.Warning("Please Suspend all the Subscriptions and try again. Aborting the delete customer relationship operation");
               return;
    }
}

// Delete the customer's relationship to the partner.
Customer customer = new Customer();
customer.RelationshipToPartner = CustomerPartnerRelationship.None;
customer = partnerOperations.Customers.ById(customerIdToDeleteRelationshipOf).Patch(customer);

if (customer.RelationshipToPartner == CustomerPartnerRelationship.None)
{
    this.Context.ConsoleHelper.Success("Customer Partner Relationship successfully deleted");
}

サンプル: コンソール テスト アプリプロジェクト: PartnerSDK.FeatureSample クラス: DeletePartnerCustomerRelationship.cs

REST 要求

要求の構文

認証方法 要求 URI
PATCH {baseURL}/v1/customers/{customer-tenant-id}/ HTTP/1.1

URI パラメーター

次の表に、リセラー関係を削除するために必要なクエリ パラメーターを示します。

名前 タイプ Required 説明
customer-tenant-id guid 値は、顧客を識別する GUID 形式 の customer-tenant-id です。

要求ヘッダー

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

要求本文

要求本文には顧客リソースが必要です。 RelationshipToPartner プロパティが none に設定されていることを確認します。

要求の例

PATCH https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id> HTTP/1.1
Authorization: Bearer <token>
Content-Length: 74
Content-Type: application/json; charset=utf-8
MS-CorrelationId: 9b4bf2ca-f374-4d51-9113-781ca87b8380
MS-RequestId: 9fef8b23-6e3e-45d2-8678-e9fe89c35af5
Date: Fri, 12 Jan 2018 00:31:55 GMT

{
    "relationshipToPartner":"none",
    "attributes":{
        "objectType":"Customer"
    }
}

REST 応答

成功した場合、このメソッドは指定された顧客のリセラー関係を削除します。

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

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

応答の例

HTTP/1.1 200 OK
MS-RequestId: 7988dde4-b516-472c-b226-6d53fb18f04e
MS-CorrelationId: 9b4bf2ca-f374-4d51-9113-781ca87b8380
X-Locale: en-US
Content-Type: application/json
Content-Length: 242
Expect: 100-continue

{
    "Id":null,
    "CommerceId":null,
    "CompanyProfile":null,
    "BillingProfile":null,
    "RelationshipToPartner":"none",
    "AllowDelegatedAccess":null,
    "UserCredentials":null,
    "CustomDomains":null,
    "AssociatedPartnerId":null,
    "Attributes":{
        "ObjectType":"Customer"
    }
}