Databases - Failover
Failovers a database.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover?api-version=2023-08-01
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover?replicaType={replicaType}&api-version=2023-08-01
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
database
|
path | True |
string |
The name of the database to failover. |
|
resource
|
path | True |
string |
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. |
|
server
|
path | True |
string |
The name of the server. |
|
subscription
|
path | True |
string |
The subscription ID that identifies an Azure subscription. |
|
api-version
|
query | True |
string |
The API version to use for the request. |
|
replica
|
query |
The type of replica to be failed over. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
Successfully completed database failover. |
|
| 202 Accepted |
Database failover is in progress. Headers Location: string |
|
| Other Status Codes |
*** Error Responses: ***
|
Examples
Failover an database
Sample request
Sample response
Location: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Sql/locations/japaneast/databaseOperationResults/00000000-0000-0000-0000-000000000000
Definitions
| Name | Description |
|---|---|
|
Error |
The resource management error additional info. |
|
Error |
The error detail. |
|
Error |
Error response |
|
Replica |
The type of replica to be failed over. |
ErrorAdditionalInfo
The resource management error additional info.
| Name | Type | Description |
|---|---|---|
| info |
object |
The additional info. |
| type |
string |
The additional info type. |
ErrorDetail
The error detail.
| Name | Type | Description |
|---|---|---|
| additionalInfo |
The error additional info. |
|
| code |
string |
The error code. |
| details |
The error details. |
|
| message |
string |
The error message. |
| target |
string |
The error target. |
ErrorResponse
Error response
| Name | Type | Description |
|---|---|---|
| error |
The error object. |
ReplicaType
The type of replica to be failed over.
| Value | Description |
|---|---|
| Primary | |
| ReadableSecondary |