Provision Azure Plan

Prerequisites

Limits

  • You can only have one Azure Plan per Customer Tenant

  • You can not provision Azure Plan if you already have Azure Subscriptions. Then you need to contact Crayon in order to enable this functionality.

Request

To provision Azure Plan you use endpoint for creating subscription, but use a specific PartNumber: DZH318Z0BPS6:0001. More information on how to create subscriptions can be found here: Create subscription

C#

var subscription = new SubscriptionDetailed
{
        Name = "My Azure Plan",
        Quantity = 1,
        CustomerTenant = new CustomerTenantReference
        {
                Id = <tenant id>
        },
        Organization = new ObjectReference
        {
                Id = <organization id>
        },
        Product = new ProductReference
        {
                PartNumber = "DZH318Z0BPS6:0001"   //DZH318Z0BPS6:0001 = AzurePlan
        }
};

var client = new CrayonApiClient("https://api.crayon.com/");
var token = client.Tokens.GetUserToken(clientId, clientSecret, userName, password).GetData().AccessToken;
var result = client.Subscriptions.Create(token, subscription);

Request

Request Syntax:

Method

Request URI

POST

https://api.crayon.com/api/v1/subscriptions/

Request Example:

POST $"https://api.crayon.com/api/v1/subscriptions/"
Accept: application/json
Content-Type: application/json
Authorization: Bearer < Token >

Request Body:

{
  "Quantity": 1,
  "Name": "My Azure Plan",
  "CustomerTenant": {
    "Id": 486
  },
  "Product": {
    "PartNumber": "DZH318Z0BPS6:0001" 
  }
}

Response

If successful, this method returns the created subscription as a SubscriptionDetailed resource in the response body. PublisherSubscriptionID of AzurePlan-subscription will be pending and state will be set to suspended until subscription is fully functional and will automatically transition to Active when ready. An azure subscription entitlement will also automatically be created.

Response Body:

{
  "Id": 123,
  "PublisherSubscriptionId": "Pending", 
  "Quantity": 1,
  "Name": "My Azure Plan",
  "Status": 2,  
  "OrderId": "e756bfa7-81ee-4f7d-a452-cbf307a41987",
  "Publisher": {
    "Id": 2,
    "Name": "Microsoft"
  },
  "Organization": {
    "Id": 3869,
    "Name": "My company"
  },
  "CustomerTenant": {
    "Id": 486,
    "PublisherCustomerId": "f39d8f51-ff2c-46b4-8435-84bf67f2a36c"
  },
  "Product": {
    "Id": 0,
    "PartNumber": "DZH318Z0BPS6:0001:DZH318Z0BMGG",
    "ItemLegalName": "",
    "ItemName": ""
  },
  "CreationDate": "2015-11-23T13:55:00.37+01:00",
  "EffectiveStartDate": "2016-01-21T00:00:00Z",
  "CommitmentEndDate": "9999-12-21T00:00:00Z",
  "SuspensionReasons": "[]",
  "AvailableAddonsCount": 0,
  "Subscriptions": []
}