Authorization with Roles #3223
Unanswered
mschuepbach
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I previously asked this on Stack Overflow.
We have an ASP.NET Core MVC application and want to migrate from on-premise Active Directory to Microsoft Entra ID. Authentication works without any issues, but authorization does not.
Currently, we use
[Authorize(Roles = "GroupX")]
orHttpContext.User.IsInRole("GroupX")
to check if a user is in a certain group. These groups are security groups in Entra ID.I replaced
with
But the user gets redirected to
/Account/AccessDenied
even when they are assigned to the group.After setting
GroupMembershipClaims
in the manifest toSecurityGroup
, I see my groups inHttpContext.User.Claims
. ButIsInRole
returns still false.I was under the impression that this would automatically work with
Microsoft.Identity.Web
. Is this not supported? What is the recommended way to do authorization in ASP.NET Core applications with Microsoft Entra ID?Beta Was this translation helpful? Give feedback.
All reactions