註冊訂用帳戶

註冊現有的 用帳戶,使其能夠訂購 Azure 保留。

若要購買 Azure 保留,您必須至少有一個現有的 CSP Azure 訂用帳戶。 此方法可讓您註冊現有的 CSP Azure 訂用帳戶,讓其能夠購買 Azure 保留。

必要條件

C#

若要註冊客戶的訂用帳戶,請使用客戶標識符來呼叫 IAggregatePartner.Customers.ById 方法來識別客戶,以擷取訂用帳戶作業的介面。 然後,使用訂用帳戶標識碼呼叫 Subscription.ById() 方法來識別您要註冊的訂用帳戶。

最後,呼叫 Registration.Register() 方法來註冊訂用帳戶,並擷取可用來取得訂用帳戶註冊狀態的 URI。 如需詳細資訊,請參閱 取得訂用帳戶註冊狀態

// IAggregatePartner partnerOperations;
// var selectedCustomerId;
// var selectedSubscriptionId;

// Retrieve the subscription registration details.
var subscriptionRegistrationDetails = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ById(selectedSubscriptionId).Registration.Register();

REST 要求

要求語法

方法 要求 URI
POST {baseURL}/v1/customers/{customer-id}/subscriptions/{subscription-id}/registrations HTTP/1.1

URI 參數

使用下列路徑參數來識別客戶和訂用帳戶。

名稱 類型​​ 必要 描述
customer-id string Yes 識別客戶的 GUID 格式化字串。
subscription-id string Yes 識別訂用帳戶的 GUID 格式字串。 合作夥伴應針對新的商務案例使用 Azure 方案識別碼。

要求標頭

如需詳細資訊,請參閱合作夥伴中心 REST 標頭

要求本文

無。

要求範例

POST https://api.partnercenter.microsoft.com/v1/customers/<customer-id>/subscriptions/<subscription-id>/registrations HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: ca7c39f7-1a80-43bc-90d8-ee7d1cad3123
MS-CorrelationId: ec8f62e5-1d92-47e9-8d5d-1924af105123
Content-Type: application/json
Content-Length: 1029
Expect: 100-continue
Connection: Keep-Alive

REST 回應

如果成功,回應會 包含具有 URI 的 Location 標頭,可用來擷取訂用帳戶註冊狀態。 儲存此 URI 以與其他相關的 REST API 搭配使用。 如需如何擷取狀態的範例,請參閱 取得訂用帳戶註冊狀態

回應成功和錯誤碼

每個回應都隨附 HTTP 狀態碼,會指出成功與否以及其他的偵錯資訊。 請使用網路追蹤工具來讀取此錯誤碼、錯誤類型和其他參數。 如需完整清單,請參閱錯誤碼

回應範例

HTTP/1.1 202 Accepted
Content-Length: 0
Location: /customers/<customer-id>/subscriptions/<subscription-id>/registrationstatus
MS-CorrelationId: ca7c39f7-1a80-43bc-90d8-ee7d1cad3123
MS-RequestId: ec8f62e5-1d92-47e9-8d5d-1924af105123
MS-CV: iqOqN0FnaE2y0HcD.0
MS-ServerId: 030020525