Web Api Calling Web Api Azure AD(Active Directory) Authentication and Authorization

preview_player
Показать описание
Web Api Calling Web Api Azure AD(Active Directory) Authentication and Authorization

Step - 1 - Create Azure app registrations
----------------------------------------------------------------

Step -2 - Create .Net 5 Web Api Projects
------------------------------------------------------------

Step -3 Writing Actions and decorating them with Authorize Attribute
---------------------------------------------------------------

Step - 4 Assigning Azure AD (Active Directory) roles to the user
-------------------------------------------------------------
We need to go to azure active directory, Enterprise applications and choose correct application registration. Then click on Assign roles to users and Groups. In the next page we can add azure ad roles to user. We need to do this role assignment for the user in both azure ad app registrations.

Step - 5 Testing Azure AD with Postman
-----------------------------------------------------------
We need to use Outh 2.0 authorization flow in postman and add required configuration for getting the azure authentication token in Postman. We need to create a separate app registration for the postman as well. Then we can login with the user who has both roles and hit the first api with azure ad authentication. Then it will call the other api with azure ad authentication. You can find the response in the response panel of postman tool.

Chapters
00:00 Introduction
00:36 Realtime use case for Web Api Azure AD Authentication
02:42 Creating Azure App Registrations and Adding Scopes
06:04 Creating Azure AD Roles
20:03 Creating another Web Api with azure ad using Microsoft Identity Platform
31:25 Assign Azure AD role to user
32:00 Azure AD authentication - Test using Postman

#AzureADAuthenticationAndAuthorization#
#WebApiAzureADAuthenticationAndAuthorization#
#WebAPIWithAzureADCallingAnotherWebAPI#

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

Do we also register a visual studio client Id if required to work via local testing

vipuldawar
Автор

Great video!! I'm just getting started with all this. Could you maybe create a similar video for the following scenario: 1.) A Web API using Azured AD authentication & authorization, 2.) a Blazor Web Assembly (WASM) application also using Azure AD authentication and calling the web API created in step 1.) passing on the user authentication. It is quite similar but the steps you perform in the startup.cs are different in a WASM application.

nothingisreal
Автор

I need this calling local AD (on premise). Only read calling Azure AD.

EdisonVolpe
Автор

Hey thanks so much for this detailed explanation! I want to use Microsoft Graph as downstream api, but I can't get it to work. Would you by any chance know what I would have to do differently to the steps in your video to make authorized calls to Microsoft Graph via my Web API?

mad_man_
Автор

Great video showing all the details! 2 questions, 1 do you know how to enable a pre-script in postman to get the token? Instead of going through the login flow? 2 Any repo that has the code available?

GlennVersweyveld
Автор

Great video! Are you planning on doing a .net 7 version of this code?

kevinl
Автор

Thanks for the video:) i have one doubt what is "Authorize Client Application" section in azure ad (5.49 video time), why we need that?

bhavinpatel
Автор

It is no more working, the error in postman is

AADSTS9002325: Proof Key for Code Exchange is required for cross-origin authorization code redemption.

RAZUMOVSKY
Автор

Awesome video. Any chance of getting the code please?

bijitpal