Static Sites - Update Database Connection
为静态站点创建或更新数据库连接的说明
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/databaseConnections/{databaseConnectionName}?api-version=2025-05-01
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
database
|
path | True |
string pattern: ^[a-zA-Z0-9]+$ |
数据库连接的名称。 |
|
name
|
path | True |
string |
静态站点的名称 |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
资源组的名称。 此名称不区分大小写。 |
|
subscription
|
path | True |
string (uuid) |
目标订阅的 ID。 该值必须是 UUID。 |
|
api-version
|
query | True |
string minLength: 1 |
要用于此操作的 API 版本。 |
请求正文
| 名称 | 类型 | 说明 |
|---|---|---|
| properties.connectionIdentity |
string |
如果存在,则标识与连接字符串结合使用以连接到数据库。 使用系统分配的托管标识用字符串“SystemAssigned”表示,而使用用户分配的托管标识则用托管标识资源的资源 ID 来指示。 |
| properties.connectionString |
string |
用于连接到数据库的连接字符串。 |
| properties.region |
string |
数据库资源的区域。 |
| properties.resourceId |
string |
数据库的资源 ID。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
Azure作已成功完成。 |
|
| Other Status Codes |
意外的错误响应。 |
安全性
azure_auth
Azure Active Directory OAuth2 流程。
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
| 名称 | 说明 |
|---|---|
| user_impersonation | 模拟用户帐户 |
示例
Patch a database connection for a static site
示例请求
示例响应
{
"name": "default",
"type": "Microsoft.Web/staticSites/databaseConnections",
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/staticSites/testStaticSite0/databaseConnections/default",
"properties": {
"connectionIdentity": "SystemAssigned",
"region": "West US 2",
"resourceId": "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/databaseRG/providers/Microsoft.DocumentDB/databaseAccounts/exampleDatabaseName"
}
}
定义
| 名称 | 说明 |
|---|---|
|
created |
创建资源的标识的类型。 |
|
Database |
静态站点数据库连接资源。 |
|
Database |
修补时的静态站点数据库连接请求属性资源 |
|
Default |
应用服务错误响应。 |
|
Default |
错误模型。 |
|
Default |
详细错误。 |
|
Static |
数据库连接配置文件 |
|
system |
与创建和上次修改资源相关的元数据。 |
createdByType
创建资源的标识的类型。
| 值 | 说明 |
|---|---|
| User | |
| Application | |
| ManagedIdentity | |
| Key |
DatabaseConnection
静态站点数据库连接资源。
| 名称 | 类型 | 说明 |
|---|---|---|
| id |
string (arm-id) |
资源的完全限定资源 ID。 例如“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}” |
| kind |
string |
资源类型。 |
| name |
string |
资源的名称 |
| properties.configurationFiles |
与此数据库连接关联的配置文件列表。 |
|
| properties.connectionIdentity |
string |
如果存在,则标识与连接字符串结合使用以连接到数据库。 使用系统分配的托管标识用字符串“SystemAssigned”表示,而使用用户分配的托管标识则用托管标识资源的资源 ID 来指示。 |
| properties.connectionString |
string |
用于连接到数据库的连接字符串。 |
| properties.region |
string |
数据库资源的区域。 |
| properties.resourceId |
string |
数据库的资源 ID。 |
| systemData |
包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。 |
|
| type |
string |
资源类型。 例如,“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts” |
DatabaseConnectionPatchRequest
修补时的静态站点数据库连接请求属性资源
| 名称 | 类型 | 说明 |
|---|---|---|
| properties.connectionIdentity |
string |
如果存在,则标识与连接字符串结合使用以连接到数据库。 使用系统分配的托管标识用字符串“SystemAssigned”表示,而使用用户分配的托管标识则用托管标识资源的资源 ID 来指示。 |
| properties.connectionString |
string |
用于连接到数据库的连接字符串。 |
| properties.region |
string |
数据库资源的区域。 |
| properties.resourceId |
string |
数据库的资源 ID。 |
DefaultErrorResponse
应用服务错误响应。
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误模型。 |
DefaultErrorResponseError
错误模型。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
标准化字符串,以编程方式识别错误。 |
| details |
详细错误。 |
|
| innererror |
string |
调试错误的更多信息。 |
| message |
string |
详细的错误描述和调试信息。 |
| target |
string |
详细的错误描述和调试信息。 |
DefaultErrorResponseErrorDetailsItem
详细错误。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
标准化字符串,以编程方式识别错误。 |
| message |
string |
详细的错误描述和调试信息。 |
| target |
string |
详细的错误描述和调试信息。 |
StaticSiteDatabaseConnectionConfigurationFileOverview
数据库连接配置文件
| 名称 | 类型 | 说明 |
|---|---|---|
| contents |
string |
文件内容的 Base64 编码。 |
| fileName |
string |
配置文件的名称。 |
| type |
string |
配置文件的类型。 |
systemData
与创建和上次修改资源相关的元数据。
| 名称 | 类型 | 说明 |
|---|---|---|
| createdAt |
string (date-time) |
资源创建时间戳(UTC)。 |
| createdBy |
string |
创建资源的标识。 |
| createdByType |
创建资源的标识的类型。 |
|
| lastModifiedAt |
string (date-time) |
上次修改的资源时间戳(UTC) |
| lastModifiedBy |
string |
上次修改资源的标识。 |
| lastModifiedByType |
上次修改资源的标识的类型。 |