How to Configure Cosmos DB Drop Table Protection

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up cosmos db drop table protection with cloud locks and strict role rules. These controls stop users and scripts from deleting your database tables by mistake. Many teams start by giving developers shared master keys to speed up daily work. When roles or keys are too broad, one bad script can wipe out data. Fixing a dropped table takes hours of downtime and slows down the whole team. How native cosmos db drop table protection works Cloud platforms split database management into a cont

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up cosmos db drop table protection with cloud locks and strict role rules. These controls stop users and scripts from deleting your database tables by mistake. Many teams start by giving developers shared master keys to speed up daily work. When roles or keys are too broad, one bad script can wipe out data. Fixing a dropped table takes hours of downtime and slows down the whole team.

How native cosmos db drop table protection works

Cloud platforms split database management into a control plane and a data plane. The control plane handles big tasks like making or deleting accounts and tables. The data plane handles reading, writing, and deleting items inside those tables. To block table drops, admins put a delete lock on the database account. This lock tells the control plane to reject any request that drops a table. Even an admin with full role rights must remove the lock before deleting anything.

Teams also pair resource locks with role-based rules in their cloud directory. Instead of sharing master keys, admins assign each user a scoped role. You can give developers roles that read and write data without management rights. You can also turn off key-based logins so everyone uses directory logins. When a user tries to drop a table, the control plane checks their role. If the role lacks delete rights, the cloud platform blocks the action right away.

What native locks solve and what they miss

Resource locks and role rules work well for stopping control plane mistakes. They prevent a tired engineer from clicking delete on the wrong production table. They also stop automated deploy scripts from tearing down active tables during updates. If you turn on continuous backups, you can also restore data to a past second.

Still, native locks only watch the control plane and ignore the data plane. A lock stops someone from dropping a table, but not from deleting its rows. Any user or app with write access can still run a bulk delete script. Native role checks only decide who can log in and start a session. They do not check what individual queries or commands do while in flight. They also cannot mask sensitive fields like emails, phone numbers, or card numbers.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

How to reduce risk during daily database work

To keep tables safe, teams must separate daily data work from admin tasks. Developers rarely need rights to change table settings or delete whole containers in production. Give people read-only roles by default and require peer review for any data changes. When engineers run queries, masking rules should rewrite national IDs and card numbers in results. Adding query-level checks and human approval for risky commands stops bad deletes before they run.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Does a cloud delete lock stop users from deleting items inside a table?

No, a delete lock only applies to control plane actions like dropping a table. Users with data plane write roles can still delete or overwrite individual items.

Why are master keys risky for cosmos db drop table protection?

Master keys bypass role rules and grant full control over tables and data. Anyone holding a master key can drop tables unless a resource lock blocks them.

Can you recover a dropped table if you did not set up a lock?

Yes, if you turned on continuous backup before the table was dropped. You can restore the deleted table to a point in time within your backup window.

The query runs. The emails stay hidden.