Create a Cloud Service to Host VM Roles [SPFSDK][VMROLE]

 

Applies To: Windows Azure Pack

When VM roles are created, they are hosted within a cloud service. Cloud services group VM role instances together. After a cloud service has been created, VM role instances are created and contained within the cloud service.

Create cloud service

A cloud service is created by submitting an HTTP POST operation to the CloudServices OData collection of the Service Management API Tenant service at https://server-name:server-port/subscription-id/CloudServices?api-version=2013-03. The body of the HTTP POST operation must have the Name and Label properties defined.

Tip

For more information about the placeholders used in the URL, see URL Cheat Sheet for VM Roles [SPFSDK][VMROLE].

Important

Anytime you access a resource within cloud services, you must append the api-version=2013-03 query string. The query string always starts with the ? character after the URL.

HTTP POST request

POST https://smapi-server:30006/01274684-6afa-4f3f-b62f-353c6202fed1/CloudServices?api-version=2013-03 HTTP/1.1
x-ms-principal-id: user@contoso.com
Accept: application/json
Content-Type: application/json
Host: smapi-server:30006
Content-Length: 33
Expect: 100-continue

{
    "Name": "TestingCloudService299",
    "Label": "TestingCloudService299"
}

HTTP POST response

HTTP/1.1 201 Created
Cache-Control: no-cache
Content-Length: 196
Content-Type: application/json; odata=minimalmetadata; streaming=true; charset=utf-8
Location: https://spf-server:8090/SC2012R2/VMM/Microsoft.Management.Odata.svc/CloudServices/TestingCloudService299
Server: Microsoft-IIS/8.5
x-ms-request-id: 928dbb56-441a-4d32-9c10-9a002ff3a814
X-Content-Type-Options: nosniff
request-id: 68d9b05b-a9da-0001-05ae-db68daa9ce01
DataServiceVersion: 3.0;
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Fri, 13 Sep 2013 23:21:25 GMT

{
    "odata.metadata": "https://spf-server:8090/SC2012R2/VMM/Microsoft.Management.Odata.svc/$metadata#CloudServices/@Element",
    "Name": "TestingCloudService299",
    "Label": "TestingCloudService299",
    "ProvisioningState": "Provisioned"
}

See Also

Create a New VM Role Instance from the Gallery [SPFSDK][VMROLE]
Inspect a VM Role for Provisioning Errors [SPFSDK][VMROLE]