Static Sites - Create Or Update Build Database Connection
Description for Create or update a database connection for a static site build
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/databaseConnections/{databaseConnectionName}?api-version=2024-04-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
database
|
path | True |
string |
Name of the database connection. Regex pattern: |
environment
|
path | True |
string |
The stage site identifier. Regex pattern: |
name
|
path | True |
string |
Name of the static site |
resource
|
path | True |
string |
Name of the resource group to which the resource belongs. Regex pattern: |
subscription
|
path | True |
string |
Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). |
api-version
|
query | True |
string |
API Version |
Request Body
Name | Required | Type | Description |
---|---|---|---|
properties.region | True |
string |
The region of the database resource. |
properties.resourceId | True |
string |
The resource id of the database. |
kind |
string |
Kind of resource. |
|
properties.connectionIdentity |
string |
If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. |
|
properties.connectionString |
string |
The connection string to use to connect to the database. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK |
|
Other Status Codes |
App Service error response. |
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
Create or update a database connection for a static site build
Sample request
PUT https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/staticSites/testStaticSite0/builds/default/databaseConnections/default?api-version=2024-04-01
{
"properties": {
"resourceId": "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/databaseRG/providers/Microsoft.DocumentDB/databaseAccounts/exampleDatabaseName",
"connectionIdentity": "SystemAssigned",
"connectionString": "AccountEndpoint=https://exampleDatabaseName.documents.azure.com:443/;Database=mydb;",
"region": "West US 2"
}
}
Sample response
{
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/staticSites/testStaticSite0/builds/default/databaseConnections/default",
"name": "default",
"type": "Microsoft.Web/staticSites/builds/databaseConnections",
"properties": {
"resourceId": "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/databaseRG/providers/Microsoft.DocumentDB/databaseAccounts/exampleDatabaseName",
"connectionIdentity": "SystemAssigned",
"region": "West US 2"
}
}
Definitions
Name | Description |
---|---|
Database |
Static Site Database Connection resource. |
Default |
App Service error response. |
Details | |
Error |
Error model. |
Static |
A database connection configuration file |
DatabaseConnection
Static Site Database Connection resource.
Name | Type | Description |
---|---|---|
id |
string |
Resource Id. |
kind |
string |
Kind of resource. |
name |
string |
Resource Name. |
properties.configurationFiles |
A list of configuration files associated with this database connection. |
|
properties.connectionIdentity |
string |
If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. |
properties.connectionString |
string |
The connection string to use to connect to the database. |
properties.region |
string |
The region of the database resource. |
properties.resourceId |
string |
The resource id of the database. |
type |
string |
Resource type. |
DefaultErrorResponse
App Service error response.
Name | Type | Description |
---|---|---|
error |
Error model. |
Details
Name | Type | Description |
---|---|---|
code |
string |
Standardized string to programmatically identify the error. |
message |
string |
Detailed error description and debugging information. |
target |
string |
Detailed error description and debugging information. |
Error
Error model.
Name | Type | Description |
---|---|---|
code |
string |
Standardized string to programmatically identify the error. |
details |
Details[] |
Detailed errors. |
innererror |
string |
More information to debug error. |
message |
string |
Detailed error description and debugging information. |
target |
string |
Detailed error description and debugging information. |
StaticSiteDatabaseConnectionConfigurationFileOverview
A database connection configuration file
Name | Type | Description |
---|---|---|
contents |
string |
The Base64 encoding of the file contents. |
fileName |
string |
The name of the configuration file. |
type |
string |
The type of configuration file. |