Restricting a managed identity's access to Azure Cosmos DB for MongoDB account (RU)

Boyan Stefanov 20 Reputation points
2024-08-13T12:03:57.7166667+00:00

I have 5 container apps with that each have a user managed identity. Each of the container apps uses their identity to connect to a Azure Cosmos DB for MongoDB account (RU) database by having a read access to a key vault that contains the primary connection string.

Is it possible to restrict the access of the user managed identities to a specific database/collection within the Azure Cosmos DB for MongoDB account? What is considered a best practice in this case so the managed identities don't have access to everything?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,680 questions
Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,927 questions
{count} votes

Accepted answer
  1. Sina Salam 12,166 Reputation points
    2024-08-13T16:25:34.26+00:00

    Hello Boyan Stefanov,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you would like to restrict a managed identity's access to Azure Cosmos DB for MongoDB account (RU).

    Solution

    To restrict user-managed identities access in Azure Cosmos DB for MongoDB, best practices is to create a custom Role in your Azure Active Directory (AAD), then assign this custom role to the user-managed identities used by your container apps.

    Other method and references that support best practices:

    To read more about other methods supported by best practices, kindly use the below links:

    Accept Answer

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.