注册订阅
注册现有 订阅 ,以便启用它以订购 Azure 预留。
若要购买 Azure 预留,必须至少有一个现有的 CSP Azure 订阅。 此方法允许注册现有的 CSP Azure 订阅,使其能够购买 Azure 预留。
先决条件
合作伙伴中心身份验证中所述的凭据。 此方案支持使用独立应用和 App+User 凭据进行身份验证。
客户 ID (
customer-tenant-id
)。 如果不知道客户的 ID,可以通过选择“客户”工作区,然后从客户列表中选择客户,然后选择“帐户”,在合作伙伴中心中查找该 ID。 在客户的“帐户”页上的“客户帐户信息”部分查找 Microsoft ID。 Microsoft ID 与客户 ID (customer-tenant-id
) 相同。订阅 ID。
C#
若要注册客户的订阅,请使用客户 ID 调用 IAggregatePartner.Customers.ById 方法来检索订阅操作的接口,以标识客户。 然后,使用 订阅 ID 调用 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 | 是 | 标识客户的 GUID 格式字符串。 |
subscription-id | string | 是 | 标识订阅的 GUID 格式字符串。 合作伙伴应将 Azure 计划 ID 用于新的商业案例。 |
请求标头
有关详细信息,请参阅合作伙伴中心 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 的 Location 标头。 保存此 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