{"id":11843,"date":"2026-02-05T07:38:42","date_gmt":"2026-02-05T15:38:42","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=11843"},"modified":"2026-02-05T07:38:42","modified_gmt":"2026-02-05T15:38:42","slug":"how-to-enable-microsoft-entra-id-for-azure-cosmos-db-nosql","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/how-to-enable-microsoft-entra-id-for-azure-cosmos-db-nosql\/","title":{"rendered":"How to Enable Microsoft Entra ID for Azure Cosmos DB (NoSQL)"},"content":{"rendered":"<h2>Strengthen Identity Security and Eliminate Account Keys<\/h2>\n<p>Identity is becoming the new security perimeter. As organizations modernize their cloud applications, long\u2011lived secrets and shared keys introduce unnecessary risk. Azure Cosmos DB now fully supports Microsoft Entra ID for both control plane and data plane access, giving customers a secure, passwordless, least\u2011privilege alternative to legacy key\u2011based authentication.<\/p>\n<p>This blog walks through why customers are moving to Entra ID, what changes when you disable local authentication, and how to configure modern RBAC for Cosmos DB.<\/p>\n<h2>Why Move to Microsoft Entra ID?<\/h2>\n<p>Organizations are accelerating their shift toward identity\u2011driven security to address:<\/p>\n<ul>\n<li>Key leakage and secret sprawl across distributed applications<\/li>\n<li>Zero Trust mandates requiring continuous verification and least\u2011privilege access<\/li>\n<li>Compliance obligations (SOC 2, ISO, FedRAMP) that discourage unmanaged secrets<\/li>\n<li>Operational challenges tracking who has access and why<\/li>\n<li>Microsoft Entra ID addresses these needs with a secure, auditable, modern access model<\/li>\n<\/ul>\n<h2>Key Benefits of Enabling Entra ID of Azure Cosmos DB<\/h2>\n<h4>Eliminates account keys<\/h4>\n<p>Account keys grant full, unrestricted access to all databases, containers, and items. If leaked, they create immediate high\u2011severity exposure. Disabling local authentication removes these long\u2011lived primary and secondary keys. All access flows through Microsoft Entra ID, significantly reducing the attack surface<\/p>\n<h4>Fine\u2011grained, least\u2011privilege data\u2011plane roles<\/h4>\n<p>Cosmos DB\u2019s native data plane RBAC delivers precise, operations-scoped permissions so every identity gets only the actions it truly needs, nothing more. By eliminating broad, all\u2011powerful keys and replacing them with tightly bounded, auditable role assignments, it dramatically reduces lateral movement risk and enforces clear, least\u2011privilege access boundaries aligned with Zero Trust.<\/p>\n<h4>Zero Trust Controls and governance with Azure RBAC<\/h4>\n<p>Once local auth is disabled, all access must flow through Azure RBAC or Cosmos DB\u2019s native data\u2011plane RBAC roles. This ensures every user, app, or managed identity has explicit permissions rather than \u201cgod\u2011mode\u201d keys.<\/p>\n<h4>Clear separation of duties<\/h4>\n<p>Instead of everyone sharing account keys, teams get purpose\u2011built roles:<\/p>\n<ul>\n<li>Operators manage account\u2011level settings<\/li>\n<li>Developers build apps with scoped data access<\/li>\n<li>Security teams audit activity through Azure Monitor and Entra ID logs<\/li>\n<\/ul>\n<h2>How to Get Started<\/h2>\n<h3>Step 1 \u2014 Disable Local Authentication<\/h3>\n<p>Disabling key\u2011based authentication forces all callers to authenticate using Entra ID. You can do this for new accounts or existing accounts.<\/p>\n<h4>For a New Cosmos DB Account (Azure Portal)<\/h4>\n<ol>\n<li>Go to <strong>Create Azure Cosmos DB Account<\/strong>.<\/li>\n<li>Navigate to the <strong>Security<\/strong> tab.<\/li>\n<li>Under <strong>Key-based authentication<\/strong>, select <strong>Disable<\/strong>.<\/li>\n<li>Complete the remaining steps and deploy.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/02\/Key-based-auth.png\"><img decoding=\"async\" class=\"alignleft wp-image-11860 size-large\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/02\/Key-based-auth-1024x210.png\" alt=\"Key based auth image\" width=\"1024\" height=\"210\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/02\/Key-based-auth-1024x210.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/02\/Key-based-auth-300x62.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/02\/Key-based-auth-768x157.png 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/02\/Key-based-auth-1536x315.png 1536w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/02\/Key-based-auth.png 1585w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h4><\/h4>\n<h4><\/h4>\n<h4><\/h4>\n<h4><\/h4>\n<h4><\/h4>\n<h4>For an Existing Cosmos DB Account (Azure CLI)<\/h4>\n<pre class=\"prettyprint language-json\"><code>az resource update --resource-group \"&lt;name-of-existing-resource-group&gt;\" --name \"&lt;name-of-existing-account&gt;\" --resource-type \"Microsoft.DocumentDB\/databaseAccounts\" --set properties.disableLocalAuth=true<\/code><\/pre>\n<h3>Step 2 \u2014 Configure Control Plane RBAC<\/h3>\n<p>Control plane roles govern management operations such as creating databases or adjusting account\u2011level settings. These apply to ARM operations, not data access. Common built-in roles include:<\/p>\n<ul>\n<li>Cosmos DB Operator<\/li>\n<li>Cosmos DB Account Reader<\/li>\n<li>DocumentDB Account Contributor<\/li>\n<\/ul>\n<h4><strong>Assign a Built-in Role (Azure Portal)<\/strong><\/h4>\n<ul>\n<li>Navigate to <strong>Access control (IAM)<\/strong><\/li>\n<li>Click on <strong>Add<\/strong> &gt; <strong>Add role assignment<\/strong><\/li>\n<li>In the search bar, type in <strong>Cosmos DB Operator<\/strong>, select and choose <strong>Next<\/strong>.<\/li>\n<li>Click <strong>Select members<\/strong> and search for the user to assign the role.<\/li>\n<li>Lastly, <strong>Review + assign.<\/strong><\/li>\n<\/ul>\n<h4><strong>Assign a Built-in Role (Azure CLI)<\/strong><\/h4>\n<p>Built-in role can also be assigned using Azure CLI<\/p>\n<pre class=\"prettyprint language-json\"><code class=\"language-json\">az role assignment create\u00a0--assignee &lt;principal-id-or-upn&gt;\u00a0--role \"Cosmos DB Operator\"\u00a0--scope \/subscriptions\/&lt;sub-id&gt;\/resourceGroups\/&lt;rg&gt;\/providers\/Microsoft.DocumentDB\/databaseAccounts\/&lt;account&gt;<\/code><\/pre>\n<h3>Step 3 \u2014 Configure Native Data Plane RBAC<\/h3>\n<p>Data plane RBAC determines who can read, write, or delete items within a database or container.<\/p>\n<p>Built\u2011in data plane roles include:<\/p>\n<ul>\n<li><strong>Cosmos DB Built-in Data Reader <\/strong>(id<strong> &#8211; <\/strong>00000000-0000-0000-0000-000000000001)<\/li>\n<li><strong>Cosmos DB Built-in Data Contributor <\/strong>(id<strong> &#8211; <\/strong>00000000-0000-0000-0000-000000000002)<\/li>\n<\/ul>\n<h4><strong>a. Assign a Built-in data plane role (Azure CLI)<\/strong><\/h4>\n<p>Use the role definition id of the built\u2011in role to create the appropriate role assignment, <em>Cosmos DB Built-in Data Contributor<\/em> role in this example.<\/p>\n<pre class=\"prettyprint language-json\"><code class=\"language-json\">az cosmosdb sql role assignment create --resource-group \u201c&lt;rg&gt;\u201d --account-name \u201c&lt;accountname&gt;\u201d --role-definition-id \u201c00000000-0000-0000-0000-000000000002\u201d --principal-id \u201c&lt;principal-id&gt;\u201d --scope \/subscriptions\/&lt;sub-id&gt;\/resourceGroups\/&lt;rg&gt;\/providers\/Microsoft.DocumentDB\/databaseAccounts\/&lt;account&gt;<\/code><\/pre>\n<h4><strong>b. List All Role Assignments (Optional)<\/strong><\/h4>\n<p>Run this to confirm\/validate role assignments.<\/p>\n<pre class=\"prettyprint language-json\"><code class=\"language-json\">az cosmosdb sql role assignment list --resource-group \u201c&lt;rg&gt;\u201d --account-name \u201c&lt;accountname&gt;\u201d<\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>Moving to Microsoft Entra ID is one of the most impactful steps you can take to strengthen Azure Cosmos DB security. By eliminating account keys and adopting modern RBAC for both the control and data plane, you reduce risk, improve auditability, and align with Zero Trust best practices. Identity\u2011driven access is the new default. With these capabilities, Cosmos DB gives customers a cleaner, more secure foundation for cloud\u2011native applications.<\/p>\n<h2>References<\/h2>\n<ul>\n<li><a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/how-to-connect-role-based-access-control?pivots=azure-cli\">Connect to Azure Cosmos DB for NoSQL using role-based access control and Microsoft Entra ID<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/azure\/role-based-access-control\/permissions\/databases#microsoftdocumentdb\">Azure permissions for Databases: Microsoft.DocumentDB<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/reference-data-plane-security#built-in-actions\">Azure Cosmos DB for NoSQL data plane security reference: Built-in actions<\/a><\/li>\n<\/ul>\n<h2><strong>About Azure Cosmos DB<\/strong><\/h2>\n<p>Azure Cosmos DB is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL and MongoDB applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.<\/p>\n<p>To stay in the loop on Azure Cosmos DB updates, follow us on\u00a0<a href=\"https:\/\/twitter.com\/AzureCosmosDB\" target=\"_blank\" rel=\"noopener\">X<\/a>,\u00a0<a href=\"https:\/\/aka.ms\/AzureCosmosDBYouTube\" target=\"_blank\" rel=\"noopener\">YouTube<\/a>, and\u00a0<a href=\"https:\/\/www.linkedin.com\/company\/azure-cosmos-db\/\" target=\"_blank\" rel=\"noopener\">LinkedIn<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Strengthen Identity Security and Eliminate Account Keys Identity is becoming the new security perimeter. As organizations modernize their cloud applications, long\u2011lived secrets and shared keys introduce unnecessary risk. Azure Cosmos DB now fully supports Microsoft Entra ID for both control plane and data plane access, giving customers a secure, passwordless, least\u2011privilege alternative to legacy key\u2011based [&hellip;]<\/p>\n","protected":false},"author":188311,"featured_media":11845,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1980,1918,667],"tags":[499,1963,668],"class_list":["post-11843","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure-cosmos-db","category-rbac","category-security","tag-azure-cosmos-db","tag-entra-id","tag-security"],"acf":[],"blog_post_summary":"<p>Strengthen Identity Security and Eliminate Account Keys Identity is becoming the new security perimeter. As organizations modernize their cloud applications, long\u2011lived secrets and shared keys introduce unnecessary risk. Azure Cosmos DB now fully supports Microsoft Entra ID for both control plane and data plane access, giving customers a secure, passwordless, least\u2011privilege alternative to legacy key\u2011based [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/11843","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/188311"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=11843"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/11843\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/11845"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=11843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=11843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=11843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}