The Simplest Way to Make Azure Resource Manager and Cosmosdb Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

You use azure resource manager and cosmosdb together to build and run cloud databases. The control plane sets up the database, while your apps read and write data. This setup lets your team manage rules and store data in one place. Many teams mix up control tasks and data tasks during setup. When you split these two jobs, you keep your data much safer. You also make daily work easier for every developer on the team. How azure resource manager and cosmosdb share roles and data First, you need

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 use azure resource manager and cosmosdb together to build and run cloud databases. The control plane sets up the database, while your apps read and write data. This setup lets your team manage rules and store data in one place.

Many teams mix up control tasks and data tasks during setup. When you split these two jobs, you keep your data much safer. You also make daily work easier for every developer on the team.

How azure resource manager and cosmosdb share roles and data

First, you need to know how the two layers talk to each other. The control layer sets up accounts, regions, and network rules for your database. Your engineers and deploy tools send requests to this layer first.

Next, the cloud directory checks who is asking to make a change. Each person or app gets a role with a clear list of allowed tasks. One role lets you create a database account or change its size.

Still, a control role does not mean you should read the actual records. Data tasks use a separate path to read, write, and delete items. In the past, teams used master keys to do both jobs at once.

Today, you can link identity roles to both layers for better safety. An app logs in with its own identity and asks for a token. The directory checks the role and sends back a token with a time limit.

The app then sends this token to the database to read or write items. This flow keeps control tasks away from daily data queries. Your deploy tools set up the containers, and your apps handle the records.

Common failure modes and how to fix them

The biggest risk happens when teams share master keys across apps and people. Master keys have way too much power and never expire on their own. If a developer leaks a master key, an attacker can delete everything.

Another bad habit is giving control roles the power to read master keys. Some control roles let a user list the database keys in plain text. That user can then take the key and read any table they want.

Azure RBAC + CosmosDB RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Shared service accounts also cause huge headaches when you check your logs. When five people use one account, the logs show only one name. You cannot tell who ran a bad query or deleted a table.

Unlogged queries create blind spots for your security team during an audit. Control logs show who changed a setting, but data logs cost extra to run. Many teams forget to turn on data logs until after a breach happens.

To fix these issues, start by turning off local master keys where you can. Give every user and app a separate identity in your cloud directory. Next, split your control roles from your data roles right away.

Give deploy tools the power to change settings, but block them from reading data. Give apps the power to read or write only the tables they need. Lock down the network path so the database blocks open public traffic.

Use private network links so traffic stays inside your own cloud network. Finally, turn on full logs for both control changes and data queries. When sensitive fields like emails, phone numbers, card numbers, or national IDs sit in tables, masking rewrites matched fields in results.

Keeping daily database work fast and safe

Developers often need to check live data when they fix a bug. If you give them permanent write roles, a simple typo can break production. Instead, make default roles read-only for humans who look at live data.

Save write roles for automated apps and rare emergency fixes. Review your role lists every month to drop access that people no longer need. Clean roles and strict network rules keep your cloud setup safe every day.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Can a control role read records inside the database?

Yes, if that role has permission to list the master keys for the account. You must block key listing in custom roles to stop control users from reading data.

How do we stop developers from sharing master keys?

You can turn off local key login on the database account settings. This rule forces every person and app to log in through your cloud directory.

Why do we need separate logs for control and data tasks?

Control logs only track account changes like scaling or network updates. You need data plane logs to see who read or changed items inside a table.

The query runs. The emails stay hidden.