title | description | author | ms.service | ms.subservice | ms.topic | ms.date | ms.author | ms.reviewer |
---|---|---|---|---|---|---|---|---|
Learn how to manage database accounts in Azure Cosmos DB |
Learn how to manage Azure Cosmos DB resources by using the Azure portal, PowerShell, CLI, and Azure Resource Manager templates |
seesharprun |
cosmos-db |
cosmosdb-sql |
how-to |
09/13/2021 |
sidandrews |
mjbrown |
[!INCLUDEappliesto-all-apis]
This article describes how to manage various tasks on an Azure Cosmos account using the Azure portal.
Tip
Azure Cosmos DB can also be managed with other Azure management clients including Azure PowerShell, Azure CLI, Azure Resource Manager templates, and Bicep.
[!INCLUDE cosmos-db-create-dbaccount]
Tip
When a new region is added, all data must be fully replicated and committed into the new region before the region is marked as available. The amount of time this operation takes will depend upon how much data is stored within the account. If an asynchronous throughput scaling operation is in progress, the throughput scale-up operation will be paused and will resume automatically when the add/remove region operation is complete.
-
Sign in to Azure portal.
-
Go to your Azure Cosmos account, and open the Replicate data globally menu.
-
To add regions, select the hexagons on the map with the + label that corresponds to your desired region(s). Alternatively, to add a region, select the + Add region option and choose a region from the drop-down menu.
-
To remove regions, clear one or more regions from the map by selecting the blue hexagons with check marks. Or select the "wastebasket" (🗑) icon next to the region on the right side.
-
To save your changes, select OK.
:::image type="content" source="./media/how-to-manage-database-account/add-region.png" alt-text="Add or remove regions menu":::
In a single-region write mode, you cannot remove the write region. You must fail over to a different region before you can delete the current write region.
In a multi-region write mode, you can add or remove any region, if you have at least one region.
Open the Replicate Data Globally tab and select Enable to enable multi-region writes. After you enable multi-region writes, all the read regions that you currently have on the account will become read and write regions.
:::image type="content" source="./media/how-to-manage-database-account/single-to-multi-master.png" alt-text="Azure Cosmos account configures multi-region writes screenshot":::
The Service-Managed failover option allows Azure Cosmos DB to failover to the region with the highest failover priority with no user action should a region become unavailable. When service-managed failover is enabled, region priority can be modified. Account must have two or more regions to enable service-managed failover.
-
From your Azure Cosmos account, open the Replicate data globally pane.
-
At the top of the pane, select Automatic Failover.
:::image type="content" source="./media/how-to-manage-database-account/replicate-data-globally.png" alt-text="Replicate data globally menu":::
-
On the Automatic Failover pane, make sure that Enable Automatic Failover is set to ON.
-
Select Save.
:::image type="content" source="./media/how-to-manage-database-account/automatic-failover.png" alt-text="Automatic failover portal menu":::
After a Cosmos account is configured for automatic failover, the failover priority for regions can be changed.
Important
You cannot modify the write region (failover priority of zero) when the account is configured for service-managed failover. To change the write region, you must disable service-managed failover and do a manual failover.
-
From your Azure Cosmos account, open the Replicate data globally pane.
-
At the top of the pane, select Automatic Failover.
:::image type="content" source="./media/how-to-manage-database-account/replicate-data-globally.png" alt-text="Replicate data globally menu":::
-
On the Automatic Failover pane, make sure that Enable Automatic Failover is set to ON.
-
To modify the failover priority, drag the read regions via the three dots on the left side of the row that appear when you hover over them.
-
Select Save.
:::image type="content" source="./media/how-to-manage-database-account/automatic-failover.png" alt-text="Automatic failover portal menu":::
Important
The Azure Cosmos account must be configured for manual failover for this operation to succeed.
Note
If you perform a manual failover operation while an asynchronous throughput scaling operation is in progress, the throughput scale-up operation will be paused. It will resume automatically when the failover operation is complete.
-
Go to your Azure Cosmos account, and open the Replicate data globally menu.
-
At the top of the menu, select Manual Failover.
:::image type="content" source="./media/how-to-manage-database-account/replicate-data-globally.png" alt-text="Replicate data globally menu":::
-
On the Manual Failover menu, select your new write region. Select the check box to indicate that you understand this option changes your write region.
-
To trigger the failover, select OK.
:::image type="content" source="./media/how-to-manage-database-account/manual-failover.png" alt-text="Manual failover portal menu":::
For more information and examples on how to manage the Azure Cosmos account as well as database and containers, read the following articles: