Skip to main content
emnode
Cost

Lower or delete idle Azure Cosmos DB containers

Azure Advisor flags Cosmos DB containers with no activity for 30 days. Each one keeps billing for the throughput it reserves whether or not a single request hits it, so the fix is to lower the provisioned RU/s or delete the container outright.

13 min·10 sections·AZURE

Last reviewed

Idle Cosmos DB containers: the basics

Why does an unused Cosmos DB container still cost money?

Azure Cosmos DB bills you for provisioned throughput, measured in Request Units per second (RU/s), not for the queries you actually run. When you create a container with manual throughput, you reserve a floor of RU/s, and Cosmos DB charges you for that reservation every hour the container exists. A container that nobody has read from or written to in a month is still holding its reservation, and you are still paying for it. That is the gap Azure Advisor is pointing at with its 'Consider taking action on your idle Azure Cosmos DB containers' cost recommendation.

Advisor looks for containers in the microsoft.documentdb/databaseaccounts resource type that have had no activity for 30 days and surfaces two clear options: lower the throughput on the container, or delete it if you do not plan to use it again. Both close the same waste. Lowering RU/s shrinks the reservation you keep paying for; deleting the container removes the charge entirely. The recommendation does not decide for you, because only you know whether the data behind the container still matters.

Most idle containers are leftovers, not live workloads. A proof of concept that shipped and was never cleaned up, a per-tenant container for a customer who churned, a copy made for a migration that finished months ago, a test collection that someone over-provisioned at 10,000 RU/s for a load test and never wound back down. None of them serve traffic, all of them bill. The work is to find every container Advisor flags, decide which still need to exist, right-size the keepers down to a sensible floor, and delete the rest.

In this lesson you will learn how Azure Cosmos DB turns provisioned throughput into a bill, why an idle container keeps charging, and how to act on Azure Advisor's idle-container recommendation safely: inventory what Advisor flags, separate keepers from leftovers, right-size the RU/s on the keepers down to the documented floor, and delete the rest. The keep-learning section links the Microsoft references for every command used here.

Fun fact

The load test that never went home

A surprising share of idle Cosmos DB spend traces back to a single pattern: a container provisioned high for a one-off load test or migration and never wound back down. Someone needs 50,000 RU/s for an afternoon, sets it, ships the test, and moves on. Cosmos DB keeps charging for that reservation every hour for months, because provisioned throughput is billed for what you reserve, not what you use. The container looks busy in the portal because it has a big number next to it, but Advisor sees the truth: thirty days with no activity, and the hourly charge still running.

Finding idle Cosmos DB throughput across an account

Priya runs the platform team at a SaaS company and gets the monthly Azure Advisor cost digest. This month it flags several idle Cosmos DB containers across two database accounts, recommending she lower their throughput or delete them.

Rather than open each container in the portal, Priya starts from the CLI, listing every container and the throughput it is provisioned at, so she can see at a glance which reservations are large and which are already at the floor before she decides what to keep.

List the containers in a database and show the throughput each one reserves. The big reservations on idle containers are the biggest savings.

$ for c in $(az cosmosdb sql container list -g rg-data --account-name cosmos-prod --database-name appdb --query "[].name" -o tsv); do echo -n "$c: "; az cosmosdb sql container throughput show -g rg-data --account-name cosmos-prod --database-name appdb --name "$c" --query "resource.throughput" -o tsv; done
loadtest-archive: 50000
tenant-acme-churned: 4000
orders: 4000
# loadtest-archive reserves 50,000 RU/s and Advisor says it is idle. That is the line to cut first.

An idle container reserving 50,000 RU/s costs many times what a 400 RU/s floor does. Right-size or delete the large idle reservations first.

How Advisor decides a Cosmos DB container is idle, and what it costsdeep dive

Azure Advisor watches the activity on each container in a Cosmos DB account and raises the idle-container cost recommendation when a container has had no activity over the trailing 30 days. The recommendation targets the microsoft.documentdb/databaseaccounts resource type and offers two remedies in its own text: lower the throughput, or delete the container if you do not plan to use it. Advisor is reading usage signals it already collects, so the finding costs you nothing to obtain; it is the action that captures the saving.

The cost itself comes from how Cosmos DB provisions throughput. With manual (standard) throughput, a container must reserve a minimum of 400 RU/s, and you are billed for the throughput you provision, by the hour, regardless of how many requests you send. With autoscale, the container scales between 10 percent and 100 percent of a maximum you set, with a documented minimum maximum of 1,000 RU/s, and Microsoft documents that you are billed each hour for the highest RU/s the system scales to during that hour. Either way, an idle container that reserves more than it needs is paying for headroom it never uses.

Two facts shape the right-sizing decision. First, the floor matters: a manual container cannot go below 400 RU/s, so lowering an over-provisioned container down to that floor captures most of the saving without deleting anything. Second, Microsoft documents that in single-write-region accounts the autoscale rate per 100 RU/s is 1.5 times the standard manual rate, so for a container that is genuinely idle and stays idle, manual at the 400 RU/s floor is cheaper than autoscale at its 1,000 RU/s minimum. The strongest saving, of course, is deletion: a container that no longer exists reserves nothing and bills nothing.

What is the impact of leaving idle containers running?

The direct impact is recurring waste. Every idle container reserves throughput and bills for it every hour, so the cost is not a one-off; it is an annuity paid out of the operating budget for capacity that serves no requests. A single over-provisioned load-test container left at tens of thousands of RU/s can cost more on its own than a handful of busy production containers running at the floor.

The second-order impact is drift. Idle containers accumulate because nobody owns removing them: each finished proof of concept, completed migration and churned tenant can leave one behind, and without a review they compound. The Cosmos DB line on the bill creeps up while usage stays flat, which is exactly the pattern that triggers an awkward question at the next cost review and is hard to explain after the fact.

The good news is that the trade-off is almost entirely one-directional. Lowering or deleting throughput on a container that has had no activity for 30 days cannot degrade a live workload, because no live workload is using it. The only thing you can get wrong is deleting data you later need, which is why the discipline is to confirm retention before deletion and to prefer lowering RU/s where there is any doubt, since a lowered container can always be raised again.

How do you act on the idle-container recommendation safely?

Work the recommendation as a short loop. The order matters: confirm which containers still need their data before you delete anything, so the only irreversible action is taken on purpose.

1. Inventory every flagged container by its reservation

List the containers Advisor flags and the throughput each one reserves. Sort by reserved RU/s, because the saving is proportional to the reservation: a single idle container at 50,000 RU/s is worth far more than ten at the 400 RU/s floor. Treat the reserved throughput, not the finding count, as the measure of what is recoverable.

2. Separate leftovers from keepers

For each container, decide whether the data still needs to exist. Abandoned proofs of concept, finished migrations and churned-tenant containers are leftovers and can be deleted. Containers whose data still matters but whose throughput is over-provisioned are keepers to right-size. When in doubt, treat it as a keeper and lower the RU/s rather than delete: lowering is reversible, deletion is not.

3. Right-size the keepers to the floor

For a keeper, query the minimum allowed throughput and lower the container to it. A manual container floors at 400 RU/s; an autoscale container floors at a 1,000 RU/s maximum. For a container that is genuinely idle and expected to stay idle, manual at 400 RU/s is the cheaper resting state. The change takes effect immediately and is fully reversible if the workload returns.

4. Delete the confirmed leftovers

Once retention is confirmed, delete the leftover containers. Deletion removes the throughput charge entirely, the largest possible saving for that container. Take a backup or export first if there is any chance the data is needed, then make a clean review part of the monthly Advisor cadence so idle capacity stops accumulating.

# 1. Right-size a keeper down to its documented minimum (manual throughput).
# Query the floor, then lower the container to it. Both take effect immediately.
min=$(az cosmosdb sql container throughput show \
  --resource-group rg-data \
  --account-name cosmos-prod \
  --database-name appdb \
  --name tenant-acme-churned \
  --query "resource.minimumThroughput" -o tsv)

az cosmosdb sql container throughput update \
  --resource-group rg-data \
  --account-name cosmos-prod \
  --database-name appdb \
  --name tenant-acme-churned \
  --throughput "$min"

# 2. Delete a confirmed leftover after checking the data is no longer needed.
az cosmosdb sql container delete \
  --resource-group rg-data \
  --account-name cosmos-prod \
  --database-name appdb \
  --name loadtest-archive \
  --yes

Quick quiz

Question 1 of 5

Why does an idle Azure Cosmos DB container still appear on the bill when no requests are hitting it?

You can now act on Azure Advisor's idle Cosmos DB container recommendation with confidence: inventory every flagged container by the throughput it reserves, separate the leftovers from the keepers, right-size the keepers down to the documented floor, and delete the confirmed leftovers once retention is checked. Make that review a monthly cadence and idle capacity stops quietly accumulating on the bill.

Back to the library