Database Accounts - Failover Priority Change

Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange?api-version=2026-03-15

URI Parameters

Name In Required Type Description
accountName
path True

string

minLength: 3
maxLength: 50
pattern: ^[a-z0-9]+(-[a-z0-9]+)*

Cosmos DB database account name.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Required Type Description
failoverPolicies True

FailoverPolicy[]

List of failover policies.

Responses

Name Type Description
202 Accepted

Resource operation accepted.

Headers

  • Azure-AsyncOperation: string
  • Location: string
  • Retry-After: integer
204 No Content

There is no content to send for this request, but the headers may be useful.

Other Status Codes

ErrorResponse

An unexpected 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

CosmosDBDatabaseAccountFailoverPriorityChange

Sample request

POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1-failover/failoverPriorityChange?api-version=2026-03-15

{
  "failoverPolicies": [
    {
      "locationName": "eastus",
      "failoverPriority": 0
    },
    {
      "locationName": "westus",
      "failoverPriority": 1
    }
  ]
}

Sample response

Location: https://centraluseuap.management.azure.com/subscriptions/d1eb41bc-1b7f-4404-bd2a-8568c222852d/providers/Microsoft.DocumentDB/locations/centraluseuap/operationsStatus/fdd04b7b-86d5-460f-b19e-386230348bcc?api-version=2026-03-15
Azure-AsyncOperation: https://centraluseuap.management.azure.com/subscriptions/d1eb41bc-1b7f-4404-bd2a-8568c222852d/providers/Microsoft.DocumentDB/locations/centraluseuap/operationsStatus/fdd04b7b-86d5-460f-b19e-386230348bcc?api-version=2026-03-15

Definitions

Name Description
ErrorResponse

Error Response.

FailoverPolicies

The list of new failover policies for the failover priority change.

FailoverPolicy

The failover policy for a given region of a database account.

ErrorResponse

Error Response.

Name Type Description
code

string

Error code.

message

string

Error message indicating why the operation failed.

FailoverPolicies

The list of new failover policies for the failover priority change.

Name Type Description
failoverPolicies

FailoverPolicy[]

List of failover policies.

FailoverPolicy

The failover policy for a given region of a database account.

Name Type Description
failoverPriority

integer (int32)

minimum: 0

The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.

id

string

The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>.

locationName

string

The name of the region in which the database account exists.