Retrieve user roles within .net web application from Azure AD

What is the process for retrieving custom roles created within Azure Active Directory for a registered web application?  

The application is already accessible to logged in users of our internal network, so that part is working fine, but I need to consume the roles added to the users to control access for the application's modules.  I successfully added the roles to the manifest of the application and assigned the role to a test user.

"appId": "xxx",
  "appRoles": [
      "allowedMemberTypes": [
      "displayName": "xxx",
      "id": "xxxx",
      "isEnabled": true,
      "description": "",
      "value": "xxx"

Open in new window

When I tried to access the claims for the logged in user within the application, the role was not included.  I used the following code to attempt to retrieve the value:

var identity = (ClaimsIdentity)Context.User.Identity;
var claims = identity.Claims;
var roles = claims.Where(a => a.Type == ClaimTypes.Role).Select(a => a.Value).FirstOrDefault();

Open in new window

There is no claim entry for roles, only for name, primarysid and groupsid. i.e.{ xxx} Type:System.Security.Claims.Claim

What else am I missing from the process of getting the role claim from Azure AD?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aaronzwProgrammerAuthor Commented:
After a long search I ran across this github code solution for exactly what I needed.  This came directly from the Microsoft Identity Developer group.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.