Items - Create SQL Database

在指定的工作區中建立 SQL 資料庫。
此 API 支援 長時間執行的作業 (LRO)。

若要建立具有公用定義的 SQL 資料庫,請參閱 SQLDatabase 定義 一文。

Permissions

呼叫端必須具有 參與者 工作區角色。

必要的委派範圍

SQLDatabase.ReadWrite.All 或 Item.ReadWrite.All

Limitations

Microsoft Entra 支援的身份

此 API 支援本節列出的 Microsoft identities。

Identity Support
User Yes
服務主體 與 受管理身份 Yes

Interface

POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/sqlDatabases

URI 參數

名稱 位於 必要 類型 Description
workspaceId
path True

string (uuid)

工作區標識碼。

要求本文

名稱 必要 類型 Description
displayName True

string

SQL 資料庫顯示名稱。 顯示名稱必須依照項目類型遵循命名規則。

creationPayload SQLDatabaseCreationPayload:

SQL 資料庫建立承載。

definition

SQLDatabaseDefinition

SQL 資料庫定義。

description

string

SQL 資料庫描述。 長度上限為 256 個字元。

folderId

string (uuid)

資料夾識別碼。 如果未指定或 Null,則會使用工作區作為其資料夾來建立 SQL 資料庫。

sensitivityLabelSettings

SensitivityLabelSettings

SQL 資料庫的敏感性標籤設定。

回覆

名稱 類型 Description
201 Created

SQLDatabase

已成功建立

202 Accepted

要求已接受,SQL 資料庫布建正在進行中。

標題

  • Location: string
  • x-ms-operation-id: string
  • Retry-After: integer
429 Too Many Requests

ErrorResponse

服務費率上限被超標。 伺服器會回傳一個 Retry-After 標頭,以秒數表示客戶端在發送額外請求前必須等待多久。

標題

Retry-After: integer

Other Status Codes

ErrorResponse

常見的錯誤碼:

  • InvalidItemType - 項目類型無效

  • ItemDisplayNameAlreadyInUse - 已使用項目顯示名稱。

  • CorruptedPayload - 提供的承載已損毀。

  • WorkspaceItemsLimitExceeded - 超過工作區專案限制。

範例

Create a SQLDatabase example
Create a SQLDatabase with definition example
Create a SQLDatabase with payload example
Create a SQLDatabase with payload of restore deleted database example

Create a SQLDatabase example

範例要求

POST https://api.fabric.microsoft.com/v1/workspaces/cfafbeb1-8037-4d0c-896e-a46fb27ff229/sqlDatabases

{
  "displayName": "SQLDatabase 1",
  "description": "A SQLDatabase description."
}

範例回覆

{
  "displayName": "SQLDatabase 1",
  "description": "A SQLDatabase description.",
  "type": "SQLDatabase",
  "workspaceId": "cfafbeb1-8037-4d0c-896e-a46fb27ff229",
  "id": "5b218778-e7a5-4d73-8187-f10824047715",
  "sensitivityLabel": {
    "id": "b7b4f4d9-3f0d-4b3e-8f3d-4f6d3f4f3f4f"
  }
}
Location: https://api.fabric.microsoft.com/v1/operations/0acd697c-1550-43cd-b998-91bfbfbd47c6
x-ms-operation-id: 0acd697c-1550-43cd-b998-91bfbfbd47c6
Retry-After: 30

Create a SQLDatabase with definition example

範例要求

POST https://api.fabric.microsoft.com/v1/workspaces/cfafbeb1-8037-4d0c-896e-a46fb27ff229/sqlDatabases

{
  "displayName": "SQLDatabase1",
  "description": "A SQLDatabase description.",
  "definition": {
    "parts": [
      {
        "path": "definition.dacpac",
        "payload": "ew0KICAibGFrZWhvdXNlSWQiOiAiYjliNWQzNmYtNDQ0NS00MDNiLWFjODctMDE2YjFjZDIwMjExIg0KfQ==",
        "payloadType": "InlineBase64"
      }
    ]
  }
}

範例回覆

{
  "displayName": "SQLDatabase 1",
  "description": "A SQLDatabase description.",
  "type": "SQLDatabase",
  "workspaceId": "cfafbeb1-8037-4d0c-896e-a46fb27ff229",
  "id": "5b218778-e7a5-4d73-8187-f10824047715",
  "sensitivityLabel": {
    "id": "b7b4f4d9-3f0d-4b3e-8f3d-4f6d3f4f3f4f"
  }
}
Location: https://api.fabric.microsoft.com/v1/operations/0acd697c-1550-43cd-b998-91bfbfbd47c6
x-ms-operation-id: 0acd697c-1550-43cd-b998-91bfbfbd47c6
Retry-After: 30

Create a SQLDatabase with payload example

範例要求

POST https://api.fabric.microsoft.com/v1/workspaces/cfafbeb1-8037-4d0c-896e-a46fb27ff229/sqlDatabases

{
  "displayName": "SQLDatabase1",
  "description": "A SQLDatabase description.",
  "creationPayload": {
    "creationMode": "Restore",
    "sourceDatabaseReference": {
      "referenceType": "ById",
      "itemId": "d96de2f4-7dd1-45ad-9ff6-37a2d6aa9861",
      "workspaceId": "cfafbeb1-8037-4d0c-896e-a46fb27ff229"
    },
    "restorePointInTime": "2024-12-01T00:00:00.000Z"
  }
}

範例回覆

{
  "displayName": "SQLDatabase 1",
  "description": "A SQLDatabase description.",
  "type": "SQLDatabase",
  "workspaceId": "cfafbeb1-8037-4d0c-896e-a46fb27ff229",
  "id": "5b218778-e7a5-4d73-8187-f10824047715",
  "sensitivityLabel": {
    "id": "b7b4f4d9-3f0d-4b3e-8f3d-4f6d3f4f3f4f"
  }
}
Location: https://api.fabric.microsoft.com/v1/operations/0acd697c-1550-43cd-b998-91bfbfbd47c6
x-ms-operation-id: 0acd697c-1550-43cd-b998-91bfbfbd47c6
Retry-After: 30

Create a SQLDatabase with payload of restore deleted database example

範例要求

POST https://api.fabric.microsoft.com/v1/workspaces/cfafbeb1-8037-4d0c-896e-a46fb27ff229/sqlDatabases

{
  "displayName": "SQLDatabase1",
  "description": "A SQLDatabase description.",
  "creationPayload": {
    "creationMode": "RestoreDeletedDatabase",
    "restorableDeletedDatabaseName": "deletedDatabaseName",
    "restorePointInTime": "2024-12-01T00:00:00.000Z"
  }
}

範例回覆

{
  "displayName": "SQLDatabase1",
  "description": "A SQLDatabase description.",
  "type": "SQLDatabase",
  "workspaceId": "cfafbeb1-8037-4d0c-896e-a46fb27ff229",
  "id": "5b218778-e7a5-4d73-8187-f10824047715"
}
Location: https://api.fabric.microsoft.com/v1/operations/0acd697c-1550-43cd-b998-91bfbfbd47c6
x-ms-operation-id: 0acd697c-1550-43cd-b998-91bfbfbd47c6
Retry-After: 30

定義

名稱 Description
CreateSQLDatabaseRequest

建立 SQL 資料庫要求承載。

CreationMode

建立承載的建立模式。 隨著時間的推移,可能會新增其他 CreationMode 類型。

EntireTenantPrincipal

代表租戶委託人

ErrorParameter

一個結構化參數,提供關於錯誤的額外機器可讀上下文。

ErrorRelatedResource

錯誤相關的資源詳細資料物件。

ErrorResponse

錯誤回應。

ErrorResponseDetails

錯誤回應詳細數據。

GroupDetails

群組特定詳細數據。 當主體類型 Group時適用。

GroupPrincipal

代表一個安全小組。

GroupType

群組的類型。 可能會隨著時間新增其他群組類型。

ItemReferenceById

標識元對象的項目參考。

ItemReferenceType

項目參考類型。 可能會隨著時間新增其他 ItemReferenceType 類型。

ItemTag

表示在專案上套用的標記。

ItemType

專案的型別。 可能會隨著時間新增其他項目類型。

NewSQLDatabaseCreationPayload

使用支援的設定建立 SQL 資料庫專案建立承載

PayloadType

定義元件承載的類型。 可能會隨著時間新增其他承載類型。

PrincipalType

主體的類型。 可能會隨著時間新增其他主體類型。

RestoreDeletedDatabaseCreationPayload

備註

刪除資料庫中的 PITR 目前處於預覽階段(了解更多)。

透過從可還原的已刪除資料庫還原,建立 SQL 資料庫項目。

RestoreSQLDatabaseCreationPayload

建立 SQL 資料庫專案建立承載,並從來源資料庫還原

SensitivityLabel

代表對物品施加的敏感性標籤。

SensitivityLabelApplyStrategy

敏感度標籤的套用策略。 預設值為 ApplyOrFail。 可能會隨著時間新增其他類型。

SensitivityLabelSettings

靈敏度標籤設定。

ServicePrincipalDetails

服務主體特定詳細數據。 當主體類型 ServicePrincipal時適用。

ServicePrincipalPrincipal

代表 Microsoft Entra 服務主體。

ServicePrincipalProfileDetails

服務主體配置檔詳細數據。 當主體類型 ServicePrincipalProfile時適用。

ServicePrincipalProfilePrincipal

代表服務主體的設定檔。

SQLDatabase

SQL 資料庫物件。

SQLDatabaseDefinition

SQL 資料庫公用定義物件。 有關 SQL 資料庫定義結構的更多細節,請參閱本文。

SQLDatabaseProperties

SQL 資料庫屬性。

SQLDatabasePublicDefinitionPart

SQL 資料庫定義部分物件。

UserDetails

用戶主體特定詳細數據。 當主體類型 User時適用。

UserPrincipal

代表 Microsoft Entra 使用者主體。

CreateSQLDatabaseRequest

建立 SQL 資料庫要求承載。

名稱 類型 Description
creationPayload SQLDatabaseCreationPayload:

SQL 資料庫建立承載。

definition

SQLDatabaseDefinition

SQL 資料庫定義。

description

string

SQL 資料庫描述。 長度上限為 256 個字元。

displayName

string

SQL 資料庫顯示名稱。 顯示名稱必須依照項目類型遵循命名規則。

folderId

string (uuid)

資料夾識別碼。 如果未指定或 Null,則會使用工作區作為其資料夾來建立 SQL 資料庫。

sensitivityLabelSettings

SensitivityLabelSettings

SQL 資料庫的敏感性標籤設定。

CreationMode

建立承載的建立模式。 隨著時間的推移,可能會新增其他 CreationMode 類型。

值 Description
New

預設建立模式。 「backupRetentionDays」和「collation」屬性在此模式下被接受。

Restore

從原始資料庫還原的建立模式。 必須具備「sourceDatabaseReference」與「restorePointInTime」屬性。 其他性質不被接受。

RestoreDeletedDatabase

從可還原已刪除資料庫的建立模式。 必須使用「restorableDeletedDatabaseName」和「restorePointInTime」屬性。 其他性質不被接受。

EntireTenantPrincipal

代表租戶委託人

名稱 類型 Description
displayName

string

主體的顯示名稱。

id

string (uuid)

主體的標識碼。

type string:

EntireTenant

主體的類型。 可能會隨著時間新增其他主體類型。

ErrorParameter

一個結構化參數,提供關於錯誤的額外機器可讀上下文。

名稱 類型 Description
message

string

一個人類可讀的參數意義描述。

name

string

參數識別碼。

value

string

這是參數值。

ErrorRelatedResource

錯誤相關的資源詳細資料物件。

名稱 類型 Description
resourceId

string

發生錯誤的資源識別碼。

resourceType

string

發生錯誤的資源類型。

ErrorResponse

錯誤回應。

名稱 類型 Description
errorCode

string

提供錯誤狀況相關信息的特定標識碼,允許服務與其使用者之間的標準化通訊。

isRetriable

boolean

若屬實,請求可重新嘗試。 如果有延遲,請使用 Retry-After 回應標頭來判斷延遲。

message

string

錯誤的人類可讀取表示法。

moreDetails

ErrorResponseDetails[]

其他錯誤詳細數據的清單。

parameters

ErrorParameter[]

結構化參數提供更多機器可讀的錯誤上下文。

relatedResource

ErrorRelatedResource

錯誤相關的資源詳細數據。

requestId

string (uuid)

與錯誤相關聯的要求標識碼。

ErrorResponseDetails

錯誤回應詳細數據。

名稱 類型 Description
errorCode

string

提供錯誤狀況相關信息的特定標識碼,允許服務與其使用者之間的標準化通訊。

message

string

錯誤的人類可讀取表示法。

parameters

ErrorParameter[]

結構化參數提供更多機器可讀的錯誤上下文。

relatedResource

ErrorRelatedResource

錯誤相關的資源詳細數據。

GroupDetails

群組特定詳細數據。 當主體類型 Group時適用。

名稱 類型 Description
groupType

GroupType

群組的類型。 可能會隨著時間新增其他群組類型。

GroupPrincipal

代表一個安全小組。

名稱 類型 Description
displayName

string

主體的顯示名稱。

groupDetails

GroupDetails

群組特定詳細數據。 當主體類型 Group時適用。

id

string (uuid)

主體的標識碼。

type string:

Group

主體的類型。 可能會隨著時間新增其他主體類型。

GroupType

群組的類型。 可能會隨著時間新增其他群組類型。

值 Description
Unknown

主體群組類型未知。

SecurityGroup

主體是安全組。

DistributionList

主體是通訊組清單。

ItemReferenceById

標識元對象的項目參考。

名稱 類型 Description
itemId

string (uuid)

項目的識別碼。

referenceType string:

ById

項目參考類型。

workspaceId

string (uuid)

專案的工作區標識碼。

ItemReferenceType

項目參考類型。 可能會隨著時間新增其他 ItemReferenceType 類型。

值 Description
ById

項目標識碼會參考該專案。

ByVariable

該項目由一個變數作為參考。

ItemTag

表示在專案上套用的標記。

名稱 類型 Description
displayName

string

標籤的名稱。

id

string (uuid)

標記標識碼。

ItemType

專案的型別。 可能會隨著時間新增其他項目類型。

值 Description
Dashboard

PowerBI 儀錶板。

Report

PowerBI 報表。

SemanticModel

PowerBI 語意模型。

PaginatedReport

PowerBI 編頁報表。

Datamart

PowerBI datamart。

Lakehouse

湖屋

Eventhouse

事件屋。

Environment

環境。

KQLDatabase

KQL 資料庫。

KQLQueryset

KQL 查詢集。

KQLDashboard

KQL 儀錶板。

DataPipeline

數據管線。

Notebook

筆記本。

SparkJobDefinition

Spark 作業定義。

MLExperiment

機器學習實驗。

MLModel

機器學習模型。

Warehouse

倉儲。

Eventstream

eventstream。

SQLEndpoint

SQL 端點。

MirroredWarehouse

鏡像倉儲。

MirroredDatabase

鏡像資料庫。

Reflex

反射。

GraphQLApi

GraphQL 專案的 API。

MountedDataFactory

MountedDataFactory。

SQLDatabase

SQLDatabase。

CopyJob

複製作業。

VariableLibrary

VariableLibrary。

Dataflow

數據流。

ApacheAirflowJob

ApacheAirflowJob。

WarehouseSnapshot

倉儲快照集。

DigitalTwinBuilder

DigitalTwinBuilder。

DigitalTwinBuilderFlow

數字對應項產生器流程。

MirroredAzureDatabricksCatalog

鏡像的 Azure databricks 目錄。

Map

一張地圖。

AnomalyDetector

異常偵測器。

UserDataFunction

使用者資料函數。

GraphModel

GraphModel 的 GraphModel。

GraphQuerySet

圖形 QuerySet。

SnowflakeDatabase

一個 Snowflake 資料庫,用來儲存由 Snowflake 帳號建立的 Iceberg 表格。

OperationsAgent

一個行動特工。

CosmosDBDatabase

一個 Cosmos 資料庫。

Ontology

一個本體論。

EventSchemaSet

一個事件結構集。

DataAgent

一個資料代理人。

MirroredCatalog

鏡像目錄。

PolicySet

一套政策集。

AppBackend

一個 AppBackend。

OrgApp

一個組織應用程式。

OrgAppAudience

一個組織應用程式的受眾。

DataBuildToolJob

一個 DataBuildToolJob。

AzureDatabricksStorage

A OneLake backed storage item for Azure Databricks.

Plan

一個計畫。

Monitoring

一個監控物品。

DeploymentPlan

部署計畫。

ShareSubscription

一份股票訂閱。

Share

一份。

Playbook

一本戰術手冊。

MirroredOneLake

一個鏡像的 OneLake 產品。

PostgreSQLDatabase

Microsoft Fabric 中的一個 PostgreSQL 資料庫項目。

CustomStreamConnector

Microsoft Fabric 中的自訂串流連接器項目。

NewSQLDatabaseCreationPayload

使用支援的設定建立 SQL 資料庫專案建立承載

名稱 類型 Description
backupRetentionDays

integer (int32)

minimum: 1
maximum: 35

設定備份保留期間 (以天為單位)。 最短為 1 天。 最長為 35 天。

collation

string

設定 SQL 資料庫的整合。

creationMode string:

New

建立 SQL 資料庫的建立模式。

PayloadType

定義元件承載的類型。 可能會隨著時間新增其他承載類型。

值 Description
InlineBase64

內嵌基底 64。

PrincipalType

主體的類型。 可能會隨著時間新增其他主體類型。

值 Description
User

Principal 是 Microsoft Entra 的使用者 Principal。

ServicePrincipal

Principal 是 Microsoft Entra 服務主體。

Group

主體是安全組。

ServicePrincipalProfile

主體是服務主體配置檔。

EntireTenant

主體代表所有租用戶使用者。

RestoreDeletedDatabaseCreationPayload

備註

刪除資料庫中的 PITR 目前處於預覽階段(了解更多)。

透過從可還原的已刪除資料庫還原,建立 SQL 資料庫項目。

名稱 類型 Description
creationMode string:

RestoreDeletedDatabase

建立 SQL 資料庫的建立模式。

restorableDeletedDatabaseName

string

設定可還原已刪除資料庫的名稱。

restorePointInTime

string (date-time)

使用 YYYY-MM-DDTHH:mm:ssZ 格式,以 UTC 設定還原來源資料庫的時間。

RestoreSQLDatabaseCreationPayload

建立 SQL 資料庫專案建立承載,並從來源資料庫還原

名稱 類型 Description
creationMode string:

Restore

建立 SQL 資料庫的建立模式。

restorePointInTime

string (date-time)

使用 YYYY-MM-DDTHH:mm:ssZ 格式,以 UTC 設定還原來源資料庫的時間。

sourceDatabaseReference

ItemReferenceById

設定要從中還原的來源資料庫的參考。

SensitivityLabel

代表對物品施加的敏感性標籤。

名稱 類型 Description
id

string (uuid)

敏感度標籤 ID。

SensitivityLabelApplyStrategy

敏感度標籤的套用策略。 預設值為 ApplyOrFail。 可能會隨著時間新增其他類型。

值 Description
ApplyOrFail

套用敏感標籤,否則若無法套用,則操作失敗。

Ignore

如果無法套用敏感度標籤,則忽略它,繼續操作而不套用標籤。

SensitivityLabelSettings

靈敏度標籤設定。

名稱 類型 Description
labelId

string (uuid)

敏感度標籤 ID。

sensitivityLabelApplyStrategy

SensitivityLabelApplyStrategy

敏感度標籤的套用策略。

ServicePrincipalDetails

服務主體特定詳細數據。 當主體類型 ServicePrincipal時適用。

名稱 類型 Description
aadAppId

string (uuid)

服務主體的 Microsoft Entra AppId。

ServicePrincipalPrincipal

代表 Microsoft Entra 服務主體。

名稱 類型 Description
displayName

string

主體的顯示名稱。

id

string (uuid)

主體的標識碼。

servicePrincipalDetails

ServicePrincipalDetails

服務主體特定詳細數據。 當主體類型 ServicePrincipal時適用。

type string:

ServicePrincipal

主體的類型。 可能會隨著時間新增其他主體類型。

ServicePrincipalProfileDetails

服務主體配置檔詳細數據。 當主體類型 ServicePrincipalProfile時適用。

名稱 類型 Description
parentPrincipal Principal:

服務主體配置檔的父主體。

ServicePrincipalProfilePrincipal

代表服務主體的設定檔。

名稱 類型 Description
displayName

string

主體的顯示名稱。

id

string (uuid)

主體的標識碼。

servicePrincipalProfileDetails

ServicePrincipalProfileDetails

服務主體配置檔詳細數據。 當主體類型 ServicePrincipalProfile時適用。

type string:

ServicePrincipalProfile

主體的類型。 可能會隨著時間新增其他主體類型。

SQLDatabase

SQL 資料庫物件。

名稱 類型 Description
defaultIdentity Principal:

物品的預設身份。

description

string

專案描述。

displayName

string

項目顯示名稱。

folderId

string (uuid)

資料夾識別碼。

id

string (uuid)

項目標識碼。

logicalId

string (uuid)

物品的邏輯識別碼。 對應的項目實例共享相同的邏輯 ID。 當沒有邏輯 ID 被指派時,該值為空。

properties

SQLDatabaseProperties

SQLDatabase 屬性。

sensitivityLabel

SensitivityLabel

物品敏感度標籤。

tags

ItemTag[]

已套用標籤的清單。

type

ItemType

項目類型。

workspaceId

string (uuid)

工作區標識碼。

SQLDatabaseDefinition

SQL 資料庫公用定義物件。 有關 SQL 資料庫定義結構的更多細節,請參閱本文。

名稱 類型 Description
format

string

SQL 資料庫定義的格式。 支援的格式: dacpac 和 sqlproj。 如果未提供任何格式, dacpac 則會使用 。

parts

SQLDatabasePublicDefinitionPart[]

定義元件的清單。

SQLDatabaseProperties

SQL 資料庫屬性。

名稱 類型 Description
backupRetentionDays

integer (int32)

備份保留期間以天為單位。

collation

string

SQL 資料庫的整合。

connectionString

string

資料庫的 連接字串。

databaseName

string

資料庫名稱。

earliestRestorePoint

string (date-time)

資料庫最早還原點(UTC)的 ISO 8601 時間戳記,使用 YYYY-MM-DDTHH:mm:ssZ 格式。

latestRestorePoint

string (date-time)

資料庫最新還原點的 ISO 8601 時間戳記(UTC),使用 YYYY-MM-DDTHH:mm:ssZ 格式。

serverFqdn

string

伺服器完整功能變數名稱 (FQDN)。

SQLDatabasePublicDefinitionPart

SQL 資料庫定義部分物件。

名稱 類型 Description
path

string

SQL 資料庫公用定義組件路徑。 支援的 SQL 資料庫內容擴充:.dacpac格式化;dacpac.sqlproj格式.sql化sqlproj。

payload

string

SQL 資料庫公用定義組件承載。

payloadType

PayloadType

承載類型。

UserDetails

用戶主體特定詳細數據。 當主體類型 User時適用。

名稱 類型 Description
userPrincipalName

string

用戶主體名稱。

UserPrincipal

代表 Microsoft Entra 使用者主體。

名稱 類型 Description
displayName

string

主體的顯示名稱。

id

string (uuid)

主體的標識碼。

type string:

User

主體的類型。 可能會隨著時間新增其他主體類型。

userDetails

UserDetails

用戶主體特定詳細數據。 當主體類型 User時適用。