Share via


Provision a New Subscription

 

Applies To: Windows Azure Pack

Provisions a new subscription.

Request

Replace <ServiceMgmt> with your Service Management API endpoint address.

Method

Request URI

HTTP version

POST

https://<ServiceMgmt>:30004/subscriptions

HTTP/1.1

Request Headers

The following table describes required and optional request headers.

Request header

Description

Authorization: Bearer

Required. The authorization bearer token.

x-ms-principal-id

Required. The principal identifier.

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

AccountAdminLiveId

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. It is expressed as a GUID string. Use Guid.NewGuid().ToString() to create a suitable GUID string value.

Status

The subscription status. Use null.

PlanId

The plan identifier of the plan being subscribed to. This is the Plan (Administrator object)Id property.

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 will automatically be 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).

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

AdminSubscription

The provisioned subscription. For more information, see AdminSubscription (Administrator object).

Example

The following code example shows a Provision Subscription request.

POST https://<Computer>:30004/subscriptions HTTP/1.1
Authorization: Bearer 
x-ms-client-request-id: cf5bca16-e945-42ab-a934-af462fd70aca-2014-04-15 20:37:33Z
x-ms-client-session-id: b5488aa5-137e-443e-be88-407ab0db068d
x-ms-principal-id: <COMPUTER>Administrator
Accept-Language: en-US
Content-Type: application/json; charset=utf-8
Host: <COMPUTER>:30004
Content-Length: 428
Expect: 100-continue
{
  "AccountAdminLiveEmailId": "User@Contoso.com",
  "AccountAdminLivePuid": "user@contoso.com",
  "AccountId": "00000000-0000-0000-0000-000000000000",
  "FriendlyName": "c23",
  "OfferCategory": null,
  "OfferInfo": null,
  "OfferType": 0,
  "ReasonCode": null,
  "ServiceAdminLiveEmailId": "User@Contoso.com",
  "ServiceAdminLivePuid": "user@contoso.com",
  "SubscriptionId": "2ad337ed-c99f-40d1-9645-670b4bdb5016",
  "Status": null,
  "PlanId": "chtm4uwen",
  "CoAdminNames": null
}

The following example shows a Provision Subscription response body.

{
  "SubscriptionID": "2ad337ed-c99f-40d1-9645-670b4bdb5016",
  "SubscriptionName": "c23",
  "AccountAdminLiveEmailId": "user@contoso.com",
  "ServiceAdminLiveEmailId": null,
  "CoAdminNames": [

  ],
  "AddOnReferences": [

  ],
  "AddOns": [

  ],
  "State": 1,
  "QuotaSyncState": 0,
  "ActivationSyncState": 1,
  "PlanId": "chtm4uwen",
  "Services": [
    {
      "Type": "sqlservers",
      "State": "registered",
      "QuotaSyncState": 0,
      "ActivationSyncState": 1,
      "BaseQuotaSettings": [
        {
          "Key": "Editions",
          "Value": "[{\"displayName\":\"Default\",\"groupName\":\"Default\",\"resourceCount\":\"10\",\"resourceSize\":\"1024\",\"resourceSizeLimit\":\"1024\",\"offerEditionId\":\"032814080310\",\"groupType\":null}]"
        }
      ]
    }
  ],
  "LastErrorMessage": null,
  "Features": null,
  "OfferFriendlyName": "c23",
  "OfferCategory": null,
  "Created": "2014-04-15T20:37:39.223"
}

Remarks

When a user is created in the Windows Azure Pack for Windows Server administrator management portal, a subscription to a plan is provisioned. The procedure is as follows.

  1. Collect the user information and desired plan. For the user, an email address and password will be required. The user is subscribed to one plan initially. A list of available plans is obtained by calling Retrieve the Available Plans. The id property of the desired Plan (Administrator object) will be needed to call Provision a New Subscription.

  2. Call Retrieve a User to determine if the requested user already exists.

  3. Provision the subscription using Provision a New Subscription.

See Also

Administrator Subscription Interfaces