Create a SQL Server Database

 

Applies To: Windows Azure Pack

Creates a SQL Server database.

Request

Replace <TenantAPI> with your Service Management API endpoint address. Replace <SubscriptionId> with the tenant subscription identifier.

Method

Request URI

HTTP version

POST

https://<TenantAPI>:30005/<SubscriptionId>/services/sqlservers/databases

HTTP/1.1

URI Parameters

None.

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

SqlDatabase Plan

The database to create. For more information, see SqlDatabase (Object).

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).

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

SqlDatabase

The new database. For more information, see SqlDatabase (Object).

Example

The following code example shows a Create a SQL Server Database request.

POST https://:30005//services/sqlservers/databases HTTP/1.1
x-ms-version: 2012-03-01
Accept: application/json
Authorization: Bearer 
x-ms-client-request-id: b3a31048-8730-4e69-a266-d2f1424e65ea-2013-08-28 18:29:21Z
x-ms-client-session-id: d8f221df-7740-40d9-b33f-0424a9f3f89b
x-ms-principal-id: abc%40contoso.com
Accept-Language: es-ES
Content-Type: application/json; charset=utf-8
Host: :30005
Content-Length: 407
Expect: 100-continue

{
  "Name": "newdatabase",
  "SqlServerName": null,
  "SqlServerId": null,
  "SubscriptionId": "98700539-2a5c-4248-80e7-d252f6cc8b2a",
  "ConnectionString": null,
  "Edition": "Default",
  "BaseSizeMB": 10,
  "MaxSizeMB": 10,
  "Collation": "SQL_Latin1_General_CP1_CI_AS",
  "IsContained": false,
  "CreationDate": "0001-01-01T00:00:00+00:00",
  "Status": 0,
  "SelfLink": null,
  "Quota": null,
  "AdminLogon": "admin",
  "Password": "pass@word1",
  "AccountAdminId": null
}

The following code example shows a Create a SQL Server Database response.

{
  "Name": "newdatabase",
  "SqlServerName": ""<computer>",
  "SqlServerId": "djpf7",
  "SubscriptionId": "98700539-2a5c-4248-80e7-d252f6cc8b2a",
  "ConnectionString": "Data Source="<computer>;Initial Catalog=newdatabase;User ID=adminNEw;Password=<<Aqu\u00ed-va-la-contrase\u00f1a-de-su-base-de-datos>>;Asynchronous Processing=True",
  "Edition": "Default",
  "BaseSizeMB": 10,
  "MaxSizeMB": 10,
  "Collation": "SQL_Latin1_General_CP1_CI_AS",
  "IsContained": false,
  "CreationDate": "0001-01-01T00:00:00+00:00",
  "Status": 1,
  "SelfLink": null,
  "Quota": "0",
  "AdminLogon": "admin",
  "Password": "",
  "AccountAdminId": null
}

See Also

SQL Server Resource Provider Database Interfaces