Hello @devopsfj,
Thank you for posting your query on Microsoft Q&A.
To manage application access via Entra ID for your application in AKS, you can use both "Roles" and "Groups" depending on your specific requirements and preferences. Here's a detailed guide on how you can proceed with managing permissions to the application:
Using Roles in Entra ID
- Define App Roles:
- In your Entra ID, define application roles for your app. These roles can be "Marketing" and "Finance".
- Navigate to your application registration in the Azure portal.
- Go to the "App roles" section and add new roles for "Marketing" and "Finance".
- Assign Roles to Users:
- Assign the defined roles to users or groups. This can be done in the "Enterprise applications" section, under your application.
- Select your application, go to "Users and groups", and assign the respective roles to the users or groups.
- Configure Application to Read Roles:
- Ensure that your application is configured to read the roles claim from the ID token issued by Entra ID.
- In your application code, check the user’s roles to determine what resources they should have access to. For example:
if 'Marketing' in user.roles: Show marketing related resources
elseif 'Finance' in user.roles: Show finance related resources
Please refer the below Microsoft Document to know more about "How to Add app roles to your application and receive them in the token."
https://learn.microsoft.com/en-us/entra/identity-platform/howto-add-app-roles-in-apps#assign-users-and-groups-to-roles
Using Groups in Entra ID
- Create Groups:
- Create security groups for each job role in Entra ID. For example, "Marketing" group and "Finance" group.
- Add users to these groups based on their job roles.
- Configure Group Claims:
- In your application registration, go to "Token configuration" and add a group claim to include the groups in the token.
- This will ensure that the group membership information is included in the token.
- Configure Application to Read Group Claims:
- In your application, read the group claims from the token.
- Based on the groups the user is a member of, determine what resources they should have access to. For example:
if 'MarketingGroupId' in user.groups: Show marketing related resources
elif 'FinanceGroupId' in user.groups: Show finance related resources
Please refer the below Microsoft document to know more about Configure optional claims in your application.
https://learn.microsoft.com/en-us/entra/identity-platform/optional-claims?tabs=appui
Best Practice Recommendations
- Roles vs. Groups:
- Use Roles if the permissions are specific to the application and need to be managed within the application registration itself.
- Use Groups if the permissions need to be managed more broadly across different applications and services within your organization.
- Scalability:
- Roles are easier to manage within a single application but can become cumbersome if you need to manage permissions across multiple applications.
- Groups provide a more scalable approach as they can be used across multiple applications and services.
- Claims Configuration:
- Ensure that the token contains the necessary claims (roles or groups) by configuring the token settings in the Azure portal.
- This configuration ensures that the user’s roles or group memberships are included in the token sent to the application.
By following these steps, you can effectively manage access to your application using Entra ID, ensuring that users see resources relevant to their roles.
Hope this includes all the information that you were looking for.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.
Thanks,
Raja Pothuraju.