Azure AD Web Api Authentication Multitenant | .Net6 Web API Azure AD Multi Tenant Authentication

AzureTeach•Net August 12, 2024
Video Thumbnail
AzureTeach•Net Logo

AzureTeach•Net

View Channel

About

I am NC, having 11+ years of experience on various Microsoft Technologies. In my career, I have worked for multiple Fortune 500 companies as a Tech Lead and Senior Developer. I am Microsoft Certified Technology Specialist and Azure Certified Developer. I have created this channel to share my knowledge with you all. Please subscribe to my channel for excellent learning tutorials on .Net and Azure. Github repo - https://github.com/AzureTeachNet/AzureTeachTutorials Buy Me A Coffee - https://www.buymeacoffee.com/azureteachnet

Video Description

Azure AD Web Api Authentication Multitenant | .Net6 Web API Azure AD Multi Tenant Authentication | Azure AD Multi Tenant Authentication | Multi Tenant Authentication Web Api Azure AD | Authenticate Web API with multiple Azure Accounts | .Net Core 6 Azure AD multi tenant Authentication ========================================= .Net6 Web Api Azure AD Multi Tenant authentication and authorization is demonstrated in this video with example. It is super easy to implement multi tenant authentication and authorization in .Net core using Azure AD/Microsoft Entra ID. To Implement multi tenant authentication we need to have multiple tenants. In this video I have used Two Azure AD active directory tenants. First step is to create the app registrations in each Azure directory. Then go to expose an API section and add a scope. If you have roles you can add it in app roles section. You have to configure these in multi tenants. i.e in all the tenants that you want to include as part of your Web API Azure AD authentication. Please make a note of Application Id Uri and tenant details. In .Net 6/.Net Core Web API project install Microsoft.AspNetCore.Authentication.JwtBearer.dll so AddJwtBearer method will be available. In app settings.json file, you have to configure multi tenants (in this example two tenants) Issuer, Authority and Audience details. This you can get from Azure AD app registration. It is clearly demonstrated in the video. ================================================ In Program.cs, we need to write AddAuthentication() middleware on the services then we need to write AddJwtBearer for each tenant. In AddJwtBearer configuration, we have to mention all the parameters that we want to validate like ValidateIssuer, ValidateAuthority, ValidateIssuerSigningKey and ValidateLifeTime. We have to do it for each tenant. Later we need to add a policy scheme, which has options.ForwardDefaultSelector func. In this we need to write code to select the JWT Bearer scheme that the application have to select for each request. This configuration will allow the app to decide which jwt bearer configuration to select for each request. Because, we have added multiple tenants in the .Net6 Web API Multi Tenant Authentication. Next, we need to add the policy builders and use RequireAuthenticatedUser and we need to add this in builder.Services.AddAuthorization middleware. Add Authorize attribute on the controller which needs authentication. After doing all these, We have successfully implemented Multi Tenant Azure AD authentication on .Net6 Web API. Next is Testing. For Testing Azure AD Multi Tenant Authentication for .Net6 Web API, we need to create client App registrations in each tenant and provide permissions on Api App in multi tenants. We need to assigns scopes on the client application. After doing all these, you can use Postman to generate the token from Oauth2.0 endpoint of Microsoft Azure AD and use it access the web api. =========================================== Chapters 00:00 .Net6 Azure AD Multi Tenant Authentication -Intro 01:00 Azure Ad .Net6 MultiTenant- Create Api App Reg 03:25 .Net6 Multi Tenant Azure AD- Configurations 05:46 Add Authentication, Jwt Bearer Multi Tenant 14:03 Add Authorization - Azure Ad Multi Tenant 16:45 Client App reg - Web Api Azure AD Multi Tenant 17:20 Testing Azure AD Multitenant Api-Postman #azure #MultTenant #.Net6Authentication

You May Also Like

Upgrade Your Gaming Audio

AI-recommended products based on this video

Loading...
New SteelSeries Arctis Nova Pro for Xbox Multi-System Gaming Headset - Premium Hi-Fi Drivers - Hi-Res Audio - 360° Spatial - GameDAC Gen 2 - Quad-DAC - ClearCast Gen 2 Mic - Xbox, PC, PS5/PS4, Switch

New SteelSeries Arctis Nova Pro for Xbox Multi-System Gaming Headset - Premium Hi-Fi Drivers - Hi-Res Audio - 360° Spatial - GameDAC Gen 2 - Quad-DAC - ClearCast Gen 2 Mic - Xbox, PC, PS5/PS4, Switch

(517)
$209.41$122.65
PrimeFREE delivery Sat, Jun 14
Loading...
NEW SteelSeries Arctis Nova 3 Multi-Platform Gaming Headset - Signature Arctis Sound - ClearCast Gen 2 Mic - PC, PS5/PS4, Xbox Series X|S, Switch, Mobile

NEW SteelSeries Arctis Nova 3 Multi-Platform Gaming Headset - Signature Arctis Sound - ClearCast Gen 2 Mic - PC, PS5/PS4, Xbox Series X|S, Switch, Mobile

(9,500)
$99.98$67.37
PrimeFREE delivery Sat, Jun 14
100+ bought in past month
Loading...
HyperX Cloud II - Gaming Headset, 7.1 Surround Sound, Memory Foam Ear Pads, Durable Aluminum Frame, Detachable Microphone, Works with PC, PS5, PS4, Xbox Series X|S, Xbox One – Red

HyperX Cloud II - Gaming Headset, 7.1 Surround Sound, Memory Foam Ear Pads, Durable Aluminum Frame, Detachable Microphone, Works with PC, PS5, PS4, Xbox Series X|S, Xbox One – Red

(73,207)
$89.99
FREE delivery Thu, Aug 21
500+ bought in past month
Loading...
Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black
Best Seller

Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black

(17,871)
$27.98$22.38
FREE delivery Tue, Oct 14 on your first order
500+ bought in past month
Loading...
Logitech G305 LIGHTSPEED Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

Logitech G305 LIGHTSPEED Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

(21,223)
$44.98
FREE delivery Tue, Oct 14
1K+ bought in past month
Loading...
Logitech K400 Plus Wireless Touch TV Keyboard With Easy Media Control and Built-in Touchpad, HTPC Keyboard for PC-connected TV, Windows, Android, Chrome OS, Laptop, Tablet - Black
Best Seller

Logitech K400 Plus Wireless Touch TV Keyboard With Easy Media Control and Built-in Touchpad, HTPC Keyboard for PC-connected TV, Windows, Android, Chrome OS, Laptop, Tablet - Black

(38,516)
$39.98$35.98
FREE delivery Thu, Sep 4
500+ bought in past month
Loading...
Logitech M185 Wireless Mouse, 2.4GHz with USB Mini Receiver, 12-Month Battery Life, 1000 DPI Optical Tracking, Ambidextrous, Compatible with PC, Mac, Laptop - Black

Logitech M185 Wireless Mouse, 2.4GHz with USB Mini Receiver, 12-Month Battery Life, 1000 DPI Optical Tracking, Ambidextrous, Compatible with PC, Mac, Laptop - Black

(43,809)
$14.99$11.99
FREE delivery Mon, Sep 22 on your first order
1K+ bought in past month
Loading...
Bose QuietComfort Wireless Noise Cancelling Headphones, Bluetooth Over Ear Headphones with Up to 24 Hours of Battery Life, Moonlight Grey - Limited Edition

Bose QuietComfort Wireless Noise Cancelling Headphones, Bluetooth Over Ear Headphones with Up to 24 Hours of Battery Life, Moonlight Grey - Limited Edition

(12,251)
$269.00
FREE delivery Tue, Oct 14
Loading...
New SteelSeries Arctis Nova Pro for Xbox Multi-System Gaming Headset - Premium Hi-Fi Drivers - Hi-Res Audio - 360° Spatial - GameDAC Gen 2 - Quad-DAC - ClearCast Gen 2 Mic - Xbox, PC, PS5/PS4, Switch

New SteelSeries Arctis Nova Pro for Xbox Multi-System Gaming Headset - Premium Hi-Fi Drivers - Hi-Res Audio - 360° Spatial - GameDAC Gen 2 - Quad-DAC - ClearCast Gen 2 Mic - Xbox, PC, PS5/PS4, Switch

(517)
$209.41$122.65
PrimeFREE delivery Sat, Jun 14
Loading...
NEW SteelSeries Arctis Nova 3 Multi-Platform Gaming Headset - Signature Arctis Sound - ClearCast Gen 2 Mic - PC, PS5/PS4, Xbox Series X|S, Switch, Mobile

NEW SteelSeries Arctis Nova 3 Multi-Platform Gaming Headset - Signature Arctis Sound - ClearCast Gen 2 Mic - PC, PS5/PS4, Xbox Series X|S, Switch, Mobile

(9,500)
$99.98$67.37
PrimeFREE delivery Sat, Jun 14
100+ bought in past month
Loading...
HyperX Cloud II - Gaming Headset, 7.1 Surround Sound, Memory Foam Ear Pads, Durable Aluminum Frame, Detachable Microphone, Works with PC, PS5, PS4, Xbox Series X|S, Xbox One – Red

HyperX Cloud II - Gaming Headset, 7.1 Surround Sound, Memory Foam Ear Pads, Durable Aluminum Frame, Detachable Microphone, Works with PC, PS5, PS4, Xbox Series X|S, Xbox One – Red

(73,207)
$89.99
FREE delivery Thu, Aug 21
500+ bought in past month
Loading...
Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black
Best Seller

Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black

(17,871)
$27.98$22.38
FREE delivery Tue, Oct 14 on your first order
500+ bought in past month
Loading...
Logitech G502 HERO High Performance Wired Gaming Mouse, HERO 25K Sensor, 25,600 DPI, RGB, Adjustable Weights, 11 Programmable Buttons, On-Board Memory, PC / Mac, Black
Best Seller

Logitech G502 HERO High Performance Wired Gaming Mouse, HERO 25K Sensor, 25,600 DPI, RGB, Adjustable Weights, 11 Programmable Buttons, On-Board Memory, PC / Mac, Black

(54,445)
$49.98$44.98
FREE delivery Tue, Oct 14
1K+ bought in past month
Loading...
Logitech G305 LIGHTSPEED Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

Logitech G305 LIGHTSPEED Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

(21,223)
$44.98
FREE delivery Tue, Oct 14
1K+ bought in past month
Loading...
Logitech K400 Plus Wireless Touch TV Keyboard With Easy Media Control and Built-in Touchpad, HTPC Keyboard for PC-connected TV, Windows, Android, Chrome OS, Laptop, Tablet - Black
Best Seller

Logitech K400 Plus Wireless Touch TV Keyboard With Easy Media Control and Built-in Touchpad, HTPC Keyboard for PC-connected TV, Windows, Android, Chrome OS, Laptop, Tablet - Black

(38,516)
$39.98$35.98
FREE delivery Thu, Sep 4
500+ bought in past month
Loading...
Sony WH-CH720N Noise Cancelling Wireless Headphones Bluetooth Over The Ear Headset with Microphone and Alexa Voice Control, Black
Best Seller

Sony WH-CH720N Noise Cancelling Wireless Headphones Bluetooth Over The Ear Headset with Microphone and Alexa Voice Control, Black

(10,648)
$148.00$118.10
PrimeFREE delivery Sat, Jun 14
500+ bought in past month
Loading...
AC Power Cord Cable Fit for Sony PS5 PS4 PS3 Slim PlayStation 5 4 3, Xbox Series X/S, Xbox One X/S, TV, Printer Universal 2 Prong Supply Replacement - (ETL Listed Cable)

AC Power Cord Cable Fit for Sony PS5 PS4 PS3 Slim PlayStation 5 4 3, Xbox Series X/S, Xbox One X/S, TV, Printer Universal 2 Prong Supply Replacement - (ETL Listed Cable)

(5,351)
$8.49
Prime
500+ bought in past month
Loading...
SmallRig FX3 / FX30 HawkLock Quick Release Camera Cage Kit for Sony with Cable Clamp, Bulit-in QR Cold Shoe NATO Rail/QR Plate for Arca, Modular Design Compatible with Original XLR Handle - 4770

SmallRig FX3 / FX30 HawkLock Quick Release Camera Cage Kit for Sony with Cable Clamp, Bulit-in QR Cold Shoe NATO Rail/QR Plate for Arca, Modular Design Compatible with Original XLR Handle - 4770

(35)
$124.94
FREE delivery Thu, Jun 19
Loading...
SmallRig ZV-E1 Camera Baseplate for Sony ZV-E1, Built-in Cold Shoe Mount and QR Plate (for Arca) Quick Switch Between Tripod and Stabilizer for DJI RS 2 / RSC 2 / RS 3 / RS 3 Pro - 4314

SmallRig ZV-E1 Camera Baseplate for Sony ZV-E1, Built-in Cold Shoe Mount and QR Plate (for Arca) Quick Switch Between Tripod and Stabilizer for DJI RS 2 / RSC 2 / RS 3 / RS 3 Pro - 4314

(3)
$44.99
FREE delivery Thu, Jun 19
Loading...
Bose QuietComfort Wireless Noise Cancelling Headphones, Bluetooth Over Ear Headphones with Up to 24 Hours of Battery Life, Moonlight Grey - Limited Edition

Bose QuietComfort Wireless Noise Cancelling Headphones, Bluetooth Over Ear Headphones with Up to 24 Hours of Battery Life, Moonlight Grey - Limited Edition

(12,251)
$269.00
FREE delivery Tue, Oct 14
Loading...
Lightning to 3.5mm Audio Jack Adapter Apple MFi Certified iPhone Headphone Jack Adapter Lightning to Aux Adaptor Dongle for iPhone 14 13 12 11 XS XR X 8 7 2 Pack

Lightning to 3.5mm Audio Jack Adapter Apple MFi Certified iPhone Headphone Jack Adapter Lightning to Aux Adaptor Dongle for iPhone 14 13 12 11 XS XR X 8 7 2 Pack

(40)
$10.79
Prime
500+ bought in past month
Loading...
Deeyaple USB C to Aux, 4FT/1.2M, Type C to 3.5mm Audio Cable Headphone Jack Cable for Car Mobile Phone, iPhone 16 15, iPad Pro, Samsung Galaxy S24 S23 S2010, Google Pixel,Oneplus Grey (1)
Best Seller

Deeyaple USB C to Aux, 4FT/1.2M, Type C to 3.5mm Audio Cable Headphone Jack Cable for Car Mobile Phone, iPhone 16 15, iPad Pro, Samsung Galaxy S24 S23 S2010, Google Pixel,Oneplus Grey (1)

(78)
$6.99
FREE delivery Fri, Sep 5 on your first order
1K+ bought in past month
Loading...
ACEMAGIC Laptop Computer AMD Ryzen 7 5700U Windows Laptop 16.1-in IPS 16GB DDR4 512GB NVMe SSD Backlit & Numeric Input WiFi 6 HDMI Type-C USB-3.2 Webcam 3.5mm Audio Office Laptops Home Laptops

ACEMAGIC Laptop Computer AMD Ryzen 7 5700U Windows Laptop 16.1-in IPS 16GB DDR4 512GB NVMe SSD Backlit & Numeric Input WiFi 6 HDMI Type-C USB-3.2 Webcam 3.5mm Audio Office Laptops Home Laptops

(161)
$899.99
FREE delivery Sat, Jun 21
50+ bought in past month
Loading...
Lemorele 10 in 1 USB C Docking Station Dual Monitor, Laptop Dock USB C Hub Multiport Adapter Triple Monitor W/2 HDMI 4K, VGA, 3 USB 3.0/2.0, PD, SD/TF, 3.5MM Audio for Lenovo, Surface, MacBook

Lemorele 10 in 1 USB C Docking Station Dual Monitor, Laptop Dock USB C Hub Multiport Adapter Triple Monitor W/2 HDMI 4K, VGA, 3 USB 3.0/2.0, PD, SD/TF, 3.5MM Audio for Lenovo, Surface, MacBook

(9,588)
$36.99
FREE delivery Tue, Jun 17
500+ bought in past month
Loading...
Hard Carrying Case for Meta Quest 3S, VR Gaming Headset and Touch Controllers Accessories Travel Case, Small Hard Shell Storage Case for Oculus Quest 3S/Quest 3/Vision Pro, Gray

Hard Carrying Case for Meta Quest 3S, VR Gaming Headset and Touch Controllers Accessories Travel Case, Small Hard Shell Storage Case for Oculus Quest 3S/Quest 3/Vision Pro, Gray

(131)
$29.99
100+ bought in past month
Loading...
Syntech Hard Carrying Case Compatible with Meta Quest 3S/Quest 3/Oculus Quest2/VP/Pico4, Accessories VR Gaming Headset with Elite Strap, Touch Controllers, Ultra-Sleek Design for Travel Storage, Gray

Syntech Hard Carrying Case Compatible with Meta Quest 3S/Quest 3/Oculus Quest2/VP/Pico4, Accessories VR Gaming Headset with Elite Strap, Touch Controllers, Ultra-Sleek Design for Travel Storage, Gray

(3,545)
$37.99
FREE delivery Tue, Jun 17
50+ bought in past month