I've recently migrated my .NET Core 3.1 MVC application from Identity to AAD & couldn't believe how easy it was! Added below & removed references to Identity:
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", false)
.Build();
services.AddAuthentication(AzureADDefaults.AuthenticationScheme).AddAzureAD(options => config.Bind("AzureAd", options));
services.AddControllers();
However - I used roles with Identity. Only 3 - used to decorate controllers & methods with an attribute to protect certain functionality. How do I set that up in AAD?
I saw AAD users can be assigned to AAD "Groups", but how do I get a user's group membership in a controller or Razor page once a user is logged in?