azure oauth2.0 Application Roles with dot net core Authorization

pritesh dabhi 1 Reputation point
2021-11-10T18:08:47.367+00:00

Hi All,

I have added application roles in Azure AD account and it is visible in Token under Claims.

I am using this roles for authorization in dot net core 5.0 using Identity framework.

But when I disable Role in Azure AD account, it is still visible in claims and doing authorization of it, can you please help me to know how to hide role in token if it is disable or can you help me to know if role is disable then authorization should not happen.

148311-image.png

148230-image.png
Regards,
Pritesh

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,164 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,470 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 27,456 Reputation points Microsoft Employee
    2021-12-03T17:32:09.537+00:00

    Hi @pritesh dabhi ,

    Here State is little confusing in terms of it doesn’t remove application role from the claims nor from the application. After disable the app role, app role is still present in manifest due to which it is visible in token claims.

    154858-image1.png

    It actually specifies whether the app roles are disabled so it can be further deleted.

    To save the accidently deletion of the app role from application registration so it will not impact the daemon applications. There is a double check before deleting the app roles.
    If you will directly try to delete the app role from the application, it will prompt the message as below.
    154870-image2.png
    To delete an app role, deselect this checkbox and apply the change before attempting the delete operation.

    To remove the claim-based authorization you need to delete the app roles from the application after disable the app role which we remove the app role from manifest as well
    154817-image3.png

    And while running the application you will get the below error.
    154840-image4.png

    Thanks,
    Shweta

    0 comments No comments