Provision a New Subscription (Tenant Subscription)
Applies To: Windows Azure Pack
Provisions a new subscription with the specified information.
Request
Replace <ServiceMgmt> with your Service Management API endpoint address.
Method |
Request URI |
HTTP version |
---|---|---|
POST |
https://<ServiceMgmt>:30005/subscriptions |
HTTP/1.1 |
URI Parameters
None.
Request Headers
The following table describes required and optional request headers.
Request header |
Description |
---|---|
x-ms-principal-id: |
Required. The principal identifier. |
Authorization: Bearer |
Required. Authorization bearer token. |
x-ms-client-request-id: |
Optional. The client request identifier. |
x-ms-client-session-id: |
Optional. The client session identifier. |
x-ms-principal-liveid: |
Optional. The principal Live identifier. |
Request Body
The following table describes the elements of the request body.
Element Name |
Description |
---|---|
AccountAdminLiveEmailId |
The Microsoft account identifier of the account administrator. Not required for subscription provisioning. Use null. |
AccountAdminLivePuid |
The Passport account identifier of the account administrator. This must be an existing user account. You can use Retrieve a User to determine if the account exists. |
AccountId |
The account identifier. Use Guid.Empty. |
FriendlyName |
The friendly name for the subscription. |
OfferCategory |
The offer category. Use null. |
OfferInfo |
The offer information. Use null. |
OfferType |
The offer type. Use 0. |
ReasonCode |
The reason code. Use null. |
ServiceAdminLiveEmailId |
The Microsoft account identifier of the service administrator. This value is not used by Windows Azure Pack and is required for consistency purposes only. Use null. |
ServiceAdminLivePuid |
The Passport account identifier of the service administrator. Not required for subscription provisioning. Use null. |
SubscriptionId |
The subscription Identifier. Use Guid.NewGuid().ToString() to create a GUID. |
Status |
The subscription status. Use null. |
PlanId |
The plan identifier of the plan being subscribed to. |
CoAdminNames |
A list of co-administrators. Use null if no Co-administrators exist. The co-administrators do not need to be known to the system. When the co-administrator account is subsequently created, the subscription is automatically applied to the co-administrator. |
Response
The response includes an HTTP status code, a set of response headers, and a response body.
Status Code
A successful operation returns status code 200 (OK). MaxSubscriptionsPerPlanReached is returned if the maximum number of subscriptions allowable for the plan is reached.
For information about status codes, see Status and Error Codes (Windows Azure Pack Service Management).
Response Headers
The response for this operation includes standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.
Response Body
The following table describes the key elements of the response body:
Element name |
Description |
---|---|
Subscription |
The provisioned subscriptions. For more information, see Subscription (Common object). |
Example
The following code example shows a Provision Subscription request.
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
}
The following code example shows a Provision Subscription response body.
{
"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"
}
Remarks
The management portal for tenants makes the following REST calls when provisioning a subscription.
Retrieve the Available Plans. This is used for displaying the plans a user can subscribe to. The Plan (Administrator object) objects returned each have an Id property. Once a plan has been chosen, the id value is used to identify the chosen plan in the call to Provision a New Subscription.
Retrieve a User. Since a subscription cannot be created for a user that doesn’t exist, this call confirms that a user does indeed exist.
Provision a New Subscription. Provisions the subscription using the supplied information.