SlideShare a Scribd company logo
Windows Azure Active
Directory
Demo
Go to your azure portal and sign in with your Azure subscription
• As of now , Azure Active Directory is not migrated to the new portal
of cloud along with full features. So here , we are going to open Azure
Classic Portal.
http://manage.windowsazure.com
• And sign-in with your Azure Subscription.
Once your
are signed in to
the portal click
on Active
Directory tab.
Once you are in the Active Directory tabClick on New(+) , select
Directory and click on Custom Create
Creating new Custom Directory.
my directory name would be aaddemo and domain name would be
krunalazureuser.onmicrosoft.com
Once you are inside your directory you can see various options like
users,groups,applications, domains, directory integration etc…
Click on user tab and click Add User.
Give username
Creating user…
Generate temporary password.
Copy and save username and temporary generated password for future use.
So here you can see new user is created inside Azure Active Directory.
• Now , open new chrome instance in incognito mode and sign in to Azure portal
with the newly created user.
• Here,as the user account we have created is backed by the Azure we will be able
to login to the azure portal and would be allowed to reset password but that user
is not having any azure subscription so can’t perform anything.
• So go to azure.com and click on portals.
• Give the details and reset the password.
I open new chrome window in incognito mode and provide our Azure AD user and
temporary generated password.
Reset the password for your Azure AD User.
We would be able to reset password successfully but as we know for our Azure AD
user we are not having Azure subscription.
• Now, we will create our new Web Application and will provide
authentication to that application.
• We will write a code in such a way that we can Sign In to our Web
Application using Azure AD.
Open VS 2015 / VS 2013 select New ASP.NET Web Applicaiton
Divide the process in the 5 steps
Create MVC
Web
Application
01
Adding
Authentication
Logic
02
Adding Sign in
and Sign out
Functionality
03
Registering
your start-up
class
04
Registering
your app in
Azure
05
Select MVC template and click on Change Authentication
Change your authentication to No Authentication and click OK.
Once application is created select your application name and go to properties, set
SSL to true and copy the SSL url. This would be our application url.
Right Click on your Application NameGo to Propertiesselect Web category
Replace your project url with the SSL url.
Now open your web.config file and add below mentioned code
• Here , we defined four keys:
• CliendID : that we will get once we register our app with Azure AD
• AADInstance [Azure AD Instance] : That would be always
https://login.microsoftonline.com/{0} , {0} is the country code . Only for China
it is 1.
• Tenant : our Azure AD domain name , which we have created for our user
• PostLogoutRedirectUri : SSL url to run our web application.
Now , open package manager console and install following packages
Install Install-Package Microsoft.Owin.Host.SystemWeb
Install Install-Package Microsoft.Owin.Security.Cookies
Install Install-Package Microsoft.Owin.Security.OpenIdConnect
Install Install-Package System.IdentityModel.Tokens.Jwt -Version 4.0.2.20622135 , use nugget package manger to update it to specif
version
Install Install-Package Microsoft.IdentityModel.Protocol.Extensions
Microsoft.IdentityModel.Protocol.Extensions
• This package provides an
assembly containing classes
which extend the .NET
Framework 4.5 with base
constructs from the OpenId
Connect and WS-Federation
protocols.
System.IdentityModel.Tokens.Jwt
• Includes types that provide
support for creating, serializing
and validating JWT tokens.
• Install it using nuget package
manager and update it to
version 4.02….
Install-Package Microsoft.Owin.Security.OpenIdConnect
• It is an Middleware that enables an application to use OpenIdConnect
for authentication.
Install-Package Microsoft.Owin.Security.Cookies
• It is an Middleware that enables an application to use cookie based
authentication, similar to ASP.NET's forms authentication.
Install-Package Microsoft.Owin.Host.SystemWeb
• OWIN server that enables OWIN-based applications to run on IIS
using the ASP.NET request pipeline.
Once all mentioned packages are installed then right click on App_Start folder and
add new class named StartUp.cs
Import below mentioned namespaces in the StartUp.cs file
• using Owin;
• using Microsoft.Owin;
• using Microsoft.Owin.Security.Cookies;
• using Microsoft.Owin.Security.OpenIdConnect;
• using System.Threading.Tasks;
• using System.Globalization;
• using System.Configuration;
• using Microsoft.Owin.Security;
Import namespaces in the StartUp.cs file
Create five variables inside StartUp.cs file. These
variables will read data from web.config file.
In the same class , create ConfigureAuth method which takes an object of
IAppBuilder Class
Now create Configuration(IAppbuilder app) method that will start your
ConfigureAuth() method.
As per Owin standards register your StartUp class with OwinStartUp assembly.
Go to viewssharedadd new viewselect create as a Partial View
Prepare _Login.cshtml page
Open _Layout.cshtml page and add reference of our partial view called
_LogIn.cshtml
Right click on controllerAdd Empty MVC
ControllerAccountController
Import namespaces in AccountController
Create this two methods in AccountController
Now , we will register our web application with Azure and get the Client Id and place
it in the web.config file
Go to your Active Directory and click on Applications
Once you are inside Applications tab click on Add.
You can give any name, I prefer my webapp name from VS project.
Provide Sign-On Url which is our SSL Url and APP ID URI which is
https://domainname/appname
Once the app is added go inside the app and click on Configure tab.
From the configure section copy Client Id and place it into your web.config
• Build the application and run it in some another browser , not in the
same browser where your Azure subscription is open or log out from
the Azure subscription and run it.
You can see Application is running on the SSL url and if your try to click on Home it
will not allow you to navigate.
Click on SignIn link.
You can see you are redirected to Microsoft’s Azure AD SignIn page and it shows
your web application name which you have registered with your Azure AD.
You can see we are signedin to our web application which is running on our on-prem
environment with an Azure AD user.

More Related Content

What's hot

Brian Desmond - Identity and directory synchronization with office 365 and wi...
Brian Desmond - Identity and directory synchronization with office 365 and wi...Brian Desmond - Identity and directory synchronization with office 365 and wi...
Brian Desmond - Identity and directory synchronization with office 365 and wi...
Nordic Infrastructure Conference
 

What's hot (20)

Azure Active Directory - An Introduction
Azure Active Directory  - An IntroductionAzure Active Directory  - An Introduction
Azure Active Directory - An Introduction
 
Azure Active Directory
Azure Active DirectoryAzure Active Directory
Azure Active Directory
 
Microsoft Azure Identity and O365
Microsoft Azure Identity and O365Microsoft Azure Identity and O365
Microsoft Azure Identity and O365
 
O365Con18 - Azure AD Connect Inside and Out - Sander Berkouwer
O365Con18 - Azure AD Connect Inside and Out - Sander BerkouwerO365Con18 - Azure AD Connect Inside and Out - Sander Berkouwer
O365Con18 - Azure AD Connect Inside and Out - Sander Berkouwer
 
Brian Desmond - Identity and directory synchronization with office 365 and wi...
Brian Desmond - Identity and directory synchronization with office 365 and wi...Brian Desmond - Identity and directory synchronization with office 365 and wi...
Brian Desmond - Identity and directory synchronization with office 365 and wi...
 
Microsoft Azure ad in 10 slides
Microsoft Azure ad in 10 slidesMicrosoft Azure ad in 10 slides
Microsoft Azure ad in 10 slides
 
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-On
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-OnEWUG - Azure AD Pass-through Authentication and Seamless Single Sign-On
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-On
 
Azure AD App Proxy Login Scenarios with an On Premises Applications - TSPUG
Azure AD App Proxy Login Scenarios with an On Premises Applications - TSPUGAzure AD App Proxy Login Scenarios with an On Premises Applications - TSPUG
Azure AD App Proxy Login Scenarios with an On Premises Applications - TSPUG
 
ADFS + IAM
ADFS + IAMADFS + IAM
ADFS + IAM
 
Identity and o365 on Azure
Identity and o365 on AzureIdentity and o365 on Azure
Identity and o365 on Azure
 
Azure AD Presentation - @ BITPro - Ajay
Azure AD Presentation - @ BITPro - AjayAzure AD Presentation - @ BITPro - Ajay
Azure AD Presentation - @ BITPro - Ajay
 
AAD with MVC App
AAD with MVC AppAAD with MVC App
AAD with MVC App
 
Iam
IamIam
Iam
 
Hitchhiker's Guide to Azure AD - SPSKC
Hitchhiker's Guide to Azure AD - SPSKCHitchhiker's Guide to Azure AD - SPSKC
Hitchhiker's Guide to Azure AD - SPSKC
 
Azure Active Directory - An Introduction for Developers
Azure Active Directory - An Introduction for DevelopersAzure Active Directory - An Introduction for Developers
Azure Active Directory - An Introduction for Developers
 
How to provide AD, ADFS, DirSync in Windows Azure and hook it up with Office 365
How to provide AD, ADFS, DirSync in Windows Azure and hook it up with Office 365How to provide AD, ADFS, DirSync in Windows Azure and hook it up with Office 365
How to provide AD, ADFS, DirSync in Windows Azure and hook it up with Office 365
 
Azure Key Vault with a PaaS Architecture and ARM Template Deployment
Azure Key Vault with a PaaS Architecture and ARM Template DeploymentAzure Key Vault with a PaaS Architecture and ARM Template Deployment
Azure Key Vault with a PaaS Architecture and ARM Template Deployment
 
Azure Active Directory Identity
Azure Active Directory IdentityAzure Active Directory Identity
Azure Active Directory Identity
 
Get your site microsoft edge ready
Get your site microsoft edge readyGet your site microsoft edge ready
Get your site microsoft edge ready
 
External collaboration with Azure B2B
External collaboration with Azure B2B External collaboration with Azure B2B
External collaboration with Azure B2B
 

Similar to Windows azure active directory

Azure from scratch part 2 By Girish Kalamati
Azure from scratch part 2 By Girish KalamatiAzure from scratch part 2 By Girish Kalamati
Azure from scratch part 2 By Girish Kalamati
Girish Kalamati
 
Google external login setup in ASP (1).pdf
Google external login setup in ASP  (1).pdfGoogle external login setup in ASP  (1).pdf
Google external login setup in ASP (1).pdf
findandsolve .com
 
Microsoft Azure,AWS Cloud services and it's use
Microsoft Azure,AWS Cloud services and it's useMicrosoft Azure,AWS Cloud services and it's use
Microsoft Azure,AWS Cloud services and it's use
Aslam Diwan
 
Windows azure development setup
Windows azure development setupWindows azure development setup
Windows azure development setup
parallelminder
 

Similar to Windows azure active directory (20)

Azure Web Apps: What it is and how to get started
Azure Web Apps: What it is and how to get started Azure Web Apps: What it is and how to get started
Azure Web Apps: What it is and how to get started
 
Microsoft identity platform and device authorization flow to use azure servic...
Microsoft identity platform and device authorization flow to use azure servic...Microsoft identity platform and device authorization flow to use azure servic...
Microsoft identity platform and device authorization flow to use azure servic...
 
Azure hands on lab
Azure hands on labAzure hands on lab
Azure hands on lab
 
Create and manage a web application on Azure (step to step tutorial)
Create and manage a web application on Azure (step to step tutorial)Create and manage a web application on Azure (step to step tutorial)
Create and manage a web application on Azure (step to step tutorial)
 
Get Started With Microsoft Azure Cloud Service
Get Started With Microsoft Azure Cloud ServiceGet Started With Microsoft Azure Cloud Service
Get Started With Microsoft Azure Cloud Service
 
Spring security jwt tutorial toptal
Spring security jwt tutorial   toptalSpring security jwt tutorial   toptal
Spring security jwt tutorial toptal
 
WordPress + Office 365 | Quick Installation Guide v9.6
WordPress + Office 365 | Quick Installation Guide v9.6WordPress + Office 365 | Quick Installation Guide v9.6
WordPress + Office 365 | Quick Installation Guide v9.6
 
Azure from scratch part 2 By Girish Kalamati
Azure from scratch part 2 By Girish KalamatiAzure from scratch part 2 By Girish Kalamati
Azure from scratch part 2 By Girish Kalamati
 
A Detailed Guide to Securing React applications with Keycloak - WalkingTree ...
A Detailed Guide to Securing React applications with Keycloak  - WalkingTree ...A Detailed Guide to Securing React applications with Keycloak  - WalkingTree ...
A Detailed Guide to Securing React applications with Keycloak - WalkingTree ...
 
DEVNET-1120 Intercloud Fabric - AWS and Azure Account Setup and Utilization
DEVNET-1120	Intercloud Fabric - AWS and Azure Account Setup and UtilizationDEVNET-1120	Intercloud Fabric - AWS and Azure Account Setup and Utilization
DEVNET-1120 Intercloud Fabric - AWS and Azure Account Setup and Utilization
 
Moodle plugininstallguide v1
Moodle plugininstallguide v1Moodle plugininstallguide v1
Moodle plugininstallguide v1
 
Azure - Identity as a service
Azure - Identity as a serviceAzure - Identity as a service
Azure - Identity as a service
 
Integrating Visual Studio Team Services with Active Directory Federation Ser...
Integrating Visual Studio Team Services with  Active Directory Federation Ser...Integrating Visual Studio Team Services with  Active Directory Federation Ser...
Integrating Visual Studio Team Services with Active Directory Federation Ser...
 
Infra Project report2
Infra Project report2Infra Project report2
Infra Project report2
 
Google external login setup in ASP (1).pdf
Google external login setup in ASP  (1).pdfGoogle external login setup in ASP  (1).pdf
Google external login setup in ASP (1).pdf
 
Website with AWS+WORDPRESS
Website with AWS+WORDPRESSWebsite with AWS+WORDPRESS
Website with AWS+WORDPRESS
 
Microsoft Azure,AWS Cloud services and it's use
Microsoft Azure,AWS Cloud services and it's useMicrosoft Azure,AWS Cloud services and it's use
Microsoft Azure,AWS Cloud services and it's use
 
Mulesoft Salesforce Connector - OAuth 2.0 JWT Bearer
Mulesoft Salesforce Connector -  OAuth 2.0 JWT BearerMulesoft Salesforce Connector -  OAuth 2.0 JWT Bearer
Mulesoft Salesforce Connector - OAuth 2.0 JWT Bearer
 
Windows azure development setup
Windows azure development setupWindows azure development setup
Windows azure development setup
 
Microsoft identity manoj mittal
Microsoft identity manoj mittalMicrosoft identity manoj mittal
Microsoft identity manoj mittal
 

More from Krunal Trivedi

Mef with meta data and lazy loading
Mef with meta data and lazy loadingMef with meta data and lazy loading
Mef with meta data and lazy loading
Krunal Trivedi
 

More from Krunal Trivedi (9)

Azure Functions - Serverless Computing
Azure Functions - Serverless ComputingAzure Functions - Serverless Computing
Azure Functions - Serverless Computing
 
Azure App Service for Windows Container
Azure App Service for Windows ContainerAzure App Service for Windows Container
Azure App Service for Windows Container
 
Chat application with Azure SignalR Service
Chat application with Azure SignalR ServiceChat application with Azure SignalR Service
Chat application with Azure SignalR Service
 
Implementing enterprise cloud scenarios with Microsoft cloud services and pla...
Implementing enterprise cloud scenarios with Microsoft cloud services and pla...Implementing enterprise cloud scenarios with Microsoft cloud services and pla...
Implementing enterprise cloud scenarios with Microsoft cloud services and pla...
 
High Availability in Microsoft Azure
High Availability in Microsoft AzureHigh Availability in Microsoft Azure
High Availability in Microsoft Azure
 
Web api 2 With MVC 5 With TrainerKrunal
Web api 2 With MVC 5 With TrainerKrunalWeb api 2 With MVC 5 With TrainerKrunal
Web api 2 With MVC 5 With TrainerKrunal
 
MVC 3-RAZOR Validation
MVC 3-RAZOR ValidationMVC 3-RAZOR Validation
MVC 3-RAZOR Validation
 
Wcf routing kt
Wcf routing ktWcf routing kt
Wcf routing kt
 
Mef with meta data and lazy loading
Mef with meta data and lazy loadingMef with meta data and lazy loading
Mef with meta data and lazy loading
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 

Windows azure active directory

  • 2. Go to your azure portal and sign in with your Azure subscription • As of now , Azure Active Directory is not migrated to the new portal of cloud along with full features. So here , we are going to open Azure Classic Portal. http://manage.windowsazure.com • And sign-in with your Azure Subscription.
  • 3. Once your are signed in to the portal click on Active Directory tab.
  • 4. Once you are in the Active Directory tabClick on New(+) , select Directory and click on Custom Create
  • 5. Creating new Custom Directory. my directory name would be aaddemo and domain name would be krunalazureuser.onmicrosoft.com
  • 6. Once you are inside your directory you can see various options like users,groups,applications, domains, directory integration etc…
  • 7. Click on user tab and click Add User. Give username
  • 9. Generate temporary password. Copy and save username and temporary generated password for future use.
  • 10. So here you can see new user is created inside Azure Active Directory.
  • 11. • Now , open new chrome instance in incognito mode and sign in to Azure portal with the newly created user. • Here,as the user account we have created is backed by the Azure we will be able to login to the azure portal and would be allowed to reset password but that user is not having any azure subscription so can’t perform anything. • So go to azure.com and click on portals. • Give the details and reset the password.
  • 12. I open new chrome window in incognito mode and provide our Azure AD user and temporary generated password.
  • 13. Reset the password for your Azure AD User.
  • 14. We would be able to reset password successfully but as we know for our Azure AD user we are not having Azure subscription.
  • 15. • Now, we will create our new Web Application and will provide authentication to that application. • We will write a code in such a way that we can Sign In to our Web Application using Azure AD.
  • 16. Open VS 2015 / VS 2013 select New ASP.NET Web Applicaiton
  • 17. Divide the process in the 5 steps Create MVC Web Application 01 Adding Authentication Logic 02 Adding Sign in and Sign out Functionality 03 Registering your start-up class 04 Registering your app in Azure 05
  • 18. Select MVC template and click on Change Authentication
  • 19. Change your authentication to No Authentication and click OK.
  • 20. Once application is created select your application name and go to properties, set SSL to true and copy the SSL url. This would be our application url.
  • 21. Right Click on your Application NameGo to Propertiesselect Web category Replace your project url with the SSL url.
  • 22. Now open your web.config file and add below mentioned code
  • 23. • Here , we defined four keys: • CliendID : that we will get once we register our app with Azure AD • AADInstance [Azure AD Instance] : That would be always https://login.microsoftonline.com/{0} , {0} is the country code . Only for China it is 1. • Tenant : our Azure AD domain name , which we have created for our user • PostLogoutRedirectUri : SSL url to run our web application.
  • 24. Now , open package manager console and install following packages Install Install-Package Microsoft.Owin.Host.SystemWeb Install Install-Package Microsoft.Owin.Security.Cookies Install Install-Package Microsoft.Owin.Security.OpenIdConnect Install Install-Package System.IdentityModel.Tokens.Jwt -Version 4.0.2.20622135 , use nugget package manger to update it to specif version Install Install-Package Microsoft.IdentityModel.Protocol.Extensions
  • 25. Microsoft.IdentityModel.Protocol.Extensions • This package provides an assembly containing classes which extend the .NET Framework 4.5 with base constructs from the OpenId Connect and WS-Federation protocols.
  • 26. System.IdentityModel.Tokens.Jwt • Includes types that provide support for creating, serializing and validating JWT tokens. • Install it using nuget package manager and update it to version 4.02….
  • 27. Install-Package Microsoft.Owin.Security.OpenIdConnect • It is an Middleware that enables an application to use OpenIdConnect for authentication.
  • 28. Install-Package Microsoft.Owin.Security.Cookies • It is an Middleware that enables an application to use cookie based authentication, similar to ASP.NET's forms authentication.
  • 29. Install-Package Microsoft.Owin.Host.SystemWeb • OWIN server that enables OWIN-based applications to run on IIS using the ASP.NET request pipeline.
  • 30. Once all mentioned packages are installed then right click on App_Start folder and add new class named StartUp.cs
  • 31. Import below mentioned namespaces in the StartUp.cs file • using Owin; • using Microsoft.Owin; • using Microsoft.Owin.Security.Cookies; • using Microsoft.Owin.Security.OpenIdConnect; • using System.Threading.Tasks; • using System.Globalization; • using System.Configuration; • using Microsoft.Owin.Security;
  • 32. Import namespaces in the StartUp.cs file
  • 33. Create five variables inside StartUp.cs file. These variables will read data from web.config file.
  • 34. In the same class , create ConfigureAuth method which takes an object of IAppBuilder Class
  • 35. Now create Configuration(IAppbuilder app) method that will start your ConfigureAuth() method.
  • 36. As per Owin standards register your StartUp class with OwinStartUp assembly.
  • 37. Go to viewssharedadd new viewselect create as a Partial View
  • 39. Open _Layout.cshtml page and add reference of our partial view called _LogIn.cshtml
  • 40. Right click on controllerAdd Empty MVC ControllerAccountController
  • 41. Import namespaces in AccountController
  • 42. Create this two methods in AccountController
  • 43. Now , we will register our web application with Azure and get the Client Id and place it in the web.config file
  • 44. Go to your Active Directory and click on Applications
  • 45. Once you are inside Applications tab click on Add.
  • 46.
  • 47. You can give any name, I prefer my webapp name from VS project.
  • 48. Provide Sign-On Url which is our SSL Url and APP ID URI which is https://domainname/appname
  • 49. Once the app is added go inside the app and click on Configure tab.
  • 50. From the configure section copy Client Id and place it into your web.config
  • 51.
  • 52. • Build the application and run it in some another browser , not in the same browser where your Azure subscription is open or log out from the Azure subscription and run it.
  • 53. You can see Application is running on the SSL url and if your try to click on Home it will not allow you to navigate. Click on SignIn link.
  • 54. You can see you are redirected to Microsoft’s Azure AD SignIn page and it shows your web application name which you have registered with your Azure AD.
  • 55.
  • 56. You can see we are signedin to our web application which is running on our on-prem environment with an Azure AD user.