How to Configure Copilot Studio MongoDB Read Only Access
You set up copilot studio mongodb read only access by creating a restricted database user. Then you link that user account to your bot workflow. Teams often start by reusing an existing app account with write rights. That shortcut gives the bot the power to change or delete live data. If a user prompt tricks the bot, broad roles allow bad updates. Scoping the database account down to read actions stops write queries before they run. How copilot studio mongodb read only access works with native
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 copilot studio mongodb read only access by creating a restricted database user. Then you link that user account to your bot workflow. Teams often start by reusing an existing app account with write rights. That shortcut gives the bot the power to change or delete live data. If a user prompt tricks the bot, broad roles allow bad updates. Scoping the database account down to read actions stops write queries before they run.
How copilot studio mongodb read only access works with native roles
MongoDB uses role-based rules to control what a database user can do. Each role grants a set of actions on a chosen resource. A role applies to the database where an admin defines it. You can also narrow a role down to the collection level. MongoDB Atlas and self-hosted setups have different built-in role lists. Both systems build their roles from the same core privilege actions.
For a read-only bot, you assign the built-in read role to a dedicated user. The read role lets the user read all non-system collections in that database. It allows actions like find, listCollections, listIndexes, dbStats, collStats, and changeStream. It leaves out write actions like insert, update, remove, and dropCollection. By contrast, the readWrite role adds those write and index actions. When your bot logs in with the read role, the database blocks any write attempt.
Why static database roles leave runtime gaps for AI bots
The native read role solves one major risk. It stops the bot from changing records or dropping a collection. That protection holds even when a user sends a hostile prompt. Still, database roles only check who logs in and which collection they touch. The role does not check what a single query returns in flight.
A collection often holds both safe fields and private user data in the same document. If the bot has the read role on a customer collection, it reads the whole document. The bot can pull emails, phone numbers, card numbers, or national IDs into its response. Static roles also share one database user across every person who chats with the bot. Database logs show the bot account ran a find query, not which human asked for it. Teams also must store and rotate the database password inside their bot settings.
Auditor Read-Only Access + Customer Support Access to Production: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What to check before connecting your bot to live data
Start by listing the exact collections the bot needs to answer user questions. Create a dedicated database user that only holds the read role on those collections. Never assign the readWrite role to an account used for chat queries. Test the account to confirm that insert, update, and remove actions fail.
Next, inspect the documents inside those allowed collections for sensitive fields. Check if documents contain emails, phone numbers, card numbers, or national IDs. Native collection roles do not rewrite or mask individual fields inside a returned document. If those fields exist, you need controls that inspect and mask results in flight. You also need a way to tie each database query back to the human user.
Check MongoDB commands and documents on the wire
MongoDB roles and SCRAM login decide who opens a session. They do not check single commands or redact sensitive fields inside returned documents. With hoop.dev, you run an open-source proxy, a sidecar for your MongoDB. It reads the MongoDB wire protocol and checks commands and bulk writes as JSON while passing login through untouched.
Before a command runs, hoop.dev guardrails check its effect and refuse banned drops or writes with MongoDB error code 13. On the way back, hoop.dev data masking rewrites sensitive fields in returned documents that match your rules. Every command and verdict is logged. See the open-source code on GitHub.
Frequently asked questions
Which MongoDB role should I assign for a read-only Copilot Studio bot?
Assign the built-in read role on the specific database the bot needs. This role allows find, listCollections, and listIndexes while blocking insert, update, remove, and dropCollection. You can also scope custom roles down to the collection level.
Does the MongoDB read role hide sensitive fields like emails or card numbers?
No, the native read role works at the database or collection level. If a bot can read a collection, it receives every field in the matched documents. To hide emails, phone numbers, or card numbers, you need data masking that rewrites results.
Why is sharing one read-only database user across all bot users a risk?
When every chat session uses the same database account, audit logs lose human context. You can see that the bot ran a find action, but not who triggered it. Tying queries to user identity and masking fields fixes this audit gap.
Related guides
In this post