移除與客戶的經銷商關係
適用於:合作夥伴中心 |由 21Vianet 營運的合作夥伴中心 |美國政府適用的 Microsoft Cloud 合作夥伴中心
拿掉與您不再有交易之客戶的轉銷商關係。
必要條件
認證,如合作夥伴中心驗證所述。 此案例僅支援使用「應用程式+使用者」認證來進行驗證。
客戶識別碼 (
customer-tenant-id
)。 如果您不知道客戶的識別碼,您可以在合作夥伴中心查閱。 從合作夥伴中心首頁選取 [客戶] 工作區。 從 [客戶] 列表中選取客戶,然後選取 [ 帳戶]。 在客戶的 [帳戶] 頁面上,在 [客戶帳戶詳細數據] 區段中尋找 Microsoft 識別符。 Microsoft 識別碼與客戶識別碼 (customer-tenant-id
) 相同。拿掉轉銷商關係之前,必須先取消所有 Azure 保留的 VM 實例訂單。 呼叫 Azure 支援,以取消任何開啟的 Azure 保留 VM 實例訂單。
C#
若要移除客戶的轉銷商關係,請先確定已取消該客戶的任何作用中 Azure 保留 VM 實例。 接下來,請確定該客戶的所有作用中訂用帳戶都會暫停。 若要這樣做,請判斷您要刪除轉銷商關係的客戶標識符。 在下列程式代碼範例中,系統會提示使用者提供客戶識別碼。
若要判斷客戶是否必須取消任何 Azure 保留的 VM 實例,請使用客戶標識符呼叫 IAggregatePartner.Customers.ById 方法來擷取權利集合的集合,以及用來擷取權利集合作業介面的權利屬性。 呼叫 Get 或 GetAsync 方法來擷取權利集合。 篩選具有 EntitlementType.VirtualMachineReservedInstance 值的任何權利集合,如果有的話,請在繼續之前呼叫支援來取消這些權利。
然後,使用客戶標識符來指定客戶的 IAggregatePartner.Customers.ById 方法來擷取客戶的訂用帳戶集合,以及擷取訂閱集合作業介面的 Subscriptions 屬性。 最後,呼叫 Get 或 GetAsync 方法來擷取客戶的訂用帳戶集合。 周遊訂用帳戶集合,並確定沒有任何訂用帳戶具有 SubscriptionStatus.Active 的 Subscription.Status 屬性值。 如果訂用帳戶仍在使用中,請參閱 暫停訂閱 ,以取得如何暫停訂閱的相關信息。
確認已取消該客戶的所有作用中 Azure 保留 VM 實例,並暫停所有作用中的訂用帳戶之後,您可以移除客戶的轉銷商關係。 首先,建立新的 Customer 物件,並將 relationshiptopartner 屬性設定為 CustomerPartnerRelationship.None。 然後使用客戶標識碼來指定客戶,並呼叫 Patch 方法,並傳入新的客戶對象,然後呼叫 IAggregatePartner.Customers.ById 方法。
若要重新建立關聯性,請重複要求轉銷商關係的程式。
// 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");
}
範例: 控制台測試應用程式。 專案:P artnerSDK.FeatureSample 類別:DeletePartnerCustomerRelationship.cs
REST 要求
要求語法
方法 | 要求 URI |
---|---|
PATCH | {baseURL}/v1/customers/{customer-tenant-id}/ HTTP/1.1 |
URI 參數
下表列出移除轉銷商關聯性所需的查詢參數。
名稱 | 類型 | 必要 | 描述 |
---|---|---|---|
customer-tenant-id | guid | Y | 此值是 GUID 格式 的客戶租使用者識別碼 ,可識別客戶。 |
要求標頭
如需詳細資訊,請參閱合作夥伴中心 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: aaaa0000-bb11-2222-33cc-444444dddddd
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: aaaa0000-bb11-2222-33cc-444444dddddd
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"
}
}