閱讀英文

共用方式為


使用 REST API 建立Azure SQL資料庫

本操作說明說明如何使用Azure REST API建立新的Azure SQL 資料庫

Azure SQL資料庫 REST 參考中提供完整的參考檔和其他範例。

建立要求

使用下列 HTTP PUT 要求來建立新的 Azure SQL Database。

HTTP
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}?api-version=2017-10-01-preview

要求標頭

以下是必要標頭:

要求標頭 描述
Content-Type: 必要。 設定為 application/json
Authorization: 必要。 設定為無效的 Bearer存取權杖

URI 參數

名稱 描述
subscriptionId 可識別 Azure 訂用帳戶的訂用帳戶識別碼。 如果您有多個訂用帳戶,請參閱使用多個訂用帳戶
resourceGroupName 包含資源的資源群組名稱。 您可以從 Azure Resource Manager API、CLI 或入口網站取得這個值。
serverName Azure SQL資料庫伺服器的名稱。
databaseName 資料庫的名稱。
api-version 要用於要求的 API 版本。

本文件涵蓋 api-version 2017-10-01-preview,內含於上述 URL 中。
   

要求本文

唯一必要的參數是 location。 使用 選擇性參數 來自訂資料庫。

名稱 類型 描述
location 字串 資源位置。 使用 List Locations 作業取得目前的位置清單。

處理回應

成功建立資料庫時,會傳回狀態碼 201。 參考 檔中有完整的回應碼清單,包括錯誤碼。

範例回應

JSON
{
  "sku": {
    "name": "S0",
    "tier": "Standard"
  },
  "kind": "v12.0,user",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "maxSizeBytes": 1073741824,
    "status": "Online",
    "databaseId": "6c764297-577b-470f-9af4-96d3d41e2ba3",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "currentServiceObjectiveName": "S0",
    "defaultSecondaryLocation": "North Europe",
    "catalogCollation": "SQL_Latin1_General_CP1_CI_AS"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb",
  "name": "testdb",
  "type": "Microsoft.Sql/servers/databases"
}