布建新的訂用帳戶 (租使用者訂用帳戶)
適用于:Windows Azure Pack
使用指定的資訊布建新的訂用帳戶。
要求
以您的服務管理 API 端點位址取代 < ServiceMgmt > 。
方法 |
要求 URI |
HTTP 版本 |
---|---|---|
POST |
<HTTPs:// ServiceMgmt > :30005/subscriptions |
HTTP/1.1 |
URI 參數
無。
要求標頭
下表描述必要的和選用的要求標頭。
要求標頭 |
描述 |
---|---|
x-ms-principal-id: |
必要。 主體識別碼。 |
授權:持有人 |
必要。 授權持有人權杖。 |
x-ms-client-request-id: |
選擇性。 用戶端要求識別碼。 |
x-ms-client-session-id: |
選擇性。 用戶端會話識別碼。 |
x-ms-principal-liveid: |
選擇性。 主體 Live 識別碼。 |
要求本文
下表說明要求主體的元素。
元素名稱 |
Description |
---|---|
AccountAdminLiveEmailId |
帳戶管理員的 Microsoft 帳戶識別碼。 訂用帳戶布建不需要。 使用 null。 |
AccountAdminLivePuid |
帳戶管理員的 Passport 帳戶識別碼。 這必須是現有的使用者帳戶。 您可以使用擷 取使用者 來判斷帳戶是否存在。 |
AccountId |
帳戶識別碼。 使用 Guid.Empty。 |
FriendlyName |
訂用帳戶的易記名稱。 |
OfferCategory |
供應專案類別。 使用 null。 |
OfferInfo |
供應專案資訊。 使用 null。 |
OfferType |
供應專案類型。 使用 0。 |
ReasonCode |
原因代碼。 使用 null。 |
ServiceAdminLiveEmailId |
服務管理員的 Microsoft 帳戶識別碼。 Windows Azure Pack 不會使用此值,而且僅供一致性之用。 使用 null。 |
ServiceAdminLivePuid |
服務管理員的 Passport 帳戶識別碼。 訂用帳戶布建不需要。 使用 null。 |
SubscriptionId |
訂用帳戶識別碼。 使用 Guid.NewGuid () 。ToString () 以建立 GUID。 |
狀態 |
訂用帳戶狀態。 使用 null。 |
PlanId |
所訂閱者案的方案識別碼。 |
CoAdminNames |
共同管理員的清單。 如果沒有共同管理員存在,請使用 null。 系統不需要知道共同管理員。 後續建立共同管理員帳戶時,會自動將訂用帳戶套用至共同管理員。 |
回應
回應包括 HTTP 狀態碼、一組回應標頭和回應主體。
狀態碼
成功的作業會傳回狀態碼 200 (OK)。 如果達到方案允許的訂用帳戶數目上限,則會傳回 MaxSubscriptionsPerPlanReached。
如需狀態碼的相關資訊,請參閱狀態和錯誤碼 (Windows Azure Pack Service Management) 。
回應標頭
此作業的回應包含標準 HTTP 標頭。 所有標準標頭都符合 HTTP/1.1 通訊協定規格。
回應本文
下表描述回應主體的重要元素:
元素名稱 |
描述 |
---|---|
訂用帳戶 |
布建的訂用帳戶。 如需詳細資訊,請參閱訂用帳戶 (Common 物件) 。 |
範例
下列程式碼範例顯示布建 訂用帳戶 要求。
POST https://<Computer>:30005/subscriptions HTTP/1.1
Authorization: Bearer <Token>
x-ms-client-request-id: 02130fee-13b7-4b93-b618-3a8830dbe611-2014-04-15 20:00:55Z
x-ms-client-session-id: eec98428-7dd5-4033-8a2c-77946f61a2f6
x-ms-principal-id: NewUser%40contoso.com
Accept-Language: en-US
Content-Type: application/json; charset=utf-8
Host: <computer>:30005
Content-Length: 458
Expect: 100-continue
{
"AccountAdminLiveEmailId": null,
"AccountAdminLivePuid": "newuser@contoso.com",
"AccountId": "00000000-0000-0000-0000-000000000000",
"FriendlyName": "MyServicePlanX",
"OfferCategory": null,
"OfferInfo": null,
"OfferType": 0,
"ReasonCode": null,
"ServiceAdminLiveEmailId": null,
"ServiceAdminLivePuid": "newuser@contoso.com",
"SubscriptionId": "da506abb-1658-4abf-971c-e0e5a9c47b83",
"Status": null,
"PlanId": "MyServicePlanX18aa6bac",
"CoAdminNames": null
}
下列程式碼範例顯示布建 訂用帳戶 回應本文。
{
"SubscriptionID": "da506abb-1658-4abf-971c-e0e5a9c47b83",
"SubscriptionName": "MyServicePlanX",
"AccountAdminLiveEmailId": "newuser@contoso.com",
"ServiceAdminLiveEmailId": null,
"CoAdminNames": [
],
"AddOnReferences": [
],
"AddOns": [
],
"State": 1,
"QuotaSyncState": 0,
"ActivationSyncState": 1,
"PlanId": "MyServicePlanX18aa6bac",
"Services": [
{
"Type": "mysqlservers",
"State": "registered",
"QuotaSyncState": 0,
"ActivationSyncState": 1,
"BaseQuotaSettings": [
{
"Key": "Editions",
"Value": "[{\"displayName\":\"Default\",\"groupName\":\"Default\",\"resourceCount\":\"10\",\"resourceSize\":\"1024\",\"offerEditionId\":\"040814101717\",\"groupType\":null}]"
}
]
}
],
"LastErrorMessage": null,
"Features": null,
"OfferFriendlyName": "MyServicePlanX",
"OfferCategory": null,
"Created": "2014-04-15T20:00:59.187"
}
備註
布建訂用帳戶時,租使用者的管理入口網站會進行下列 REST 呼叫。
擷取可用的方案。 這用於顯示使用者可以訂閱的方案。 Plan (Administrator 物件) 傳回的物件都有一個 Id屬性。 選擇方案之後, 識別碼 值會用來識別布建 新訂用帳戶呼叫中所選擇的方案。
擷取使用者。 由於無法為不存在的使用者建立訂用帳戶,此呼叫會確認使用者確實存在。
布建新的訂用帳戶。 使用所提供的資訊布建訂用帳戶。