共用方式為


註冊訂用帳戶

註冊現有的 訂用帳戶,以啟用其訂購 Azure 預留項目。

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

先決條件

  • 合作夥伴中心驗證中所述的認證。 此案例支援使用獨立應用程式和 App+使用者認證進行驗證。

  • 客戶標識碼 (customer-tenant-id)。 如果您不知道客戶的標識碼,您可以在 合作夥伴中心 中選取 [客戶 工作區],然後從客戶清單中選擇客戶,再選擇 帳戶以查詢。 在客戶的 [帳戶] 頁面上,在 [客戶帳戶資訊] 區段中尋找 Microsoft ID。 Microsoft識別碼與客戶標識碼 (customer-tenant-id) 相同。

  • 訂用帳戶標識碼。

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
發布 {baseURL}/v1/customers/{customer-id}/subscriptions/{subscription-id}/registrations HTTP/1.1

URI 參數

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

名字 類型 必填 描述
客戶ID 字串 是的 識別客戶的 GUID 格式化字串。
訂閱編號 字串 是的 識別訂用帳戶的 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: bbbb1111-cc22-3333-44dd-555555eeeeee
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
Content-Type: application/json
Content-Length: 1029
Expect: 100-continue
Connection: Keep-Alive

REST 回應

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

回應成功和錯誤碼

每個回應都有一個 HTTP 狀態代碼,指出成功或失敗和其他偵錯資訊。 使用網路追蹤工具來讀取此程式代碼、錯誤類型和其他參數。 如需完整清單,請參閱 錯誤碼

回應範例

HTTP/1.1 202 Accepted
Content-Length: 0
Location: /customers/<customer-id>/subscriptions/<subscription-id>/registrationstatus
MS-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee
MS-RequestId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-CV: iqOqN0FnaE2y0HcD.0
MS-ServerId: 030020525