Net6 Minimal Api | Azure AD Authentication and Authorization

preview_player
Показать описание
Net6 Minimal Api | Azure AD Authentication
How to Azure AD authentication Net6 Minimal Api?
In this video I have demonstrated Implementing azure AD authentication in .net 6 minimal APIs. We have used Visual studio capabilities to configure Azure Active Directory Authentication in .Net6 minimal API.
We have created a .Net6 project as Minimal API support is added from dotnet 6 and going to add Azure AD authentication for the same. While creating the project we need to uncheck the controllers checkbox and it will create minimal API project.
---------------------------------------------------------------
--------------------------------------------------------------------------
In this demo, we have created a .net6 minimal api endpoint which can only be accessed by the user who has authorization with "Manager" role.
------------------------------------------------------------------------
After that, we need to goto app registration, create the roles and expose it as an api by adding the scopes. We have used postman to test the application. for that we need to create another app registration and in the minimal api's app registration, we need to add the new app registration as client app registration in expose as an api section. To test the changes with postman, we have to use implicit authentication and choose oAuth2.0 authorization flow. we can get azure ad oauth2.0 code url from the overview page of app registration by clicking on endpoints. we need to provide scopes in postman tool and logon with any user who has manager role for Azure AD authentication and authorization to test minimal api azure ad authentication.
--------------------------------------------------------------------------
Chapters

00:00 Intro
00:31 Creating .Net6 Minimal API Azure Ad authentication Project
01:20 Configuring Azure AD to .Net6 Minimal API project
08:35 Creating Azure AD roles for the user
12:12 Testing Azure AD Authentication with Postman

Рекомендации по теме
Комментарии
Автор

Very nice, mate. I was looking for it. Just a question, can I do it without "connected services" (MS Id. Platform) in the project? I mean, just using configuration with the proper values and code? I ask because it appears to be exclusive facilitation to Visual Studio users. Would like to know if it hids any other magic than generate code and add configuration settings.

zameb
Автор

Concise and to the point - well instructed!

ChinmayGadre
Автор

Thanks for your work. your videos help me to figure out what to do with auth via AzureAD. but one more case is left. what if a user is added to a group and the group has assigned app roles. in this case the user doesn't get the app roles from their group. it seems to me that it shouldn't work this way. I'm seeking a solution to that.
but if you could help - it would be easier to understand what's going on and why it doesn't work for me :)

valeriik
Автор

At 9:40, a single role is assigned to a user. Is it possible to assign multiple roles to a single user?

regulardev
Автор

Wow lot of new stuff to learn on you youtube series

TellaTrix
Автор

.NET 6 Project Templates do not have Startup.cs class rather a Program.cs class.
Also the csproj file is also worth looking.
By default <Nullable> is set to true, which says that we need to make the strings as nullable explicitly.

anurag