Secure a MVC application using Azure Active Directory AD Authentication with Visual Studio 2015


Here is the instruction on using Visual Studio 2015 preview to add Azure Active Directory SSO to an existing MVC Application.

1. Create an Azure Active Directory

2. Add user(s) to directory

3. Right-click the project and click “Configure Azure AD Authentication”

image

4. Enter your Active Directory Domain Name e.g. yourid.onmicrosoft.com  This will integrate an Application to the Active Directory

image

5. Click the Application Link and click the Configure Tab and change the “Reply Url” to your webiste’s Url so Azure AD know where to send the SAML authentication tokens after successfully authenticated the Users.

e.g. https://mywebapp.azurewebsites.net/

6. optional update the [Authorize] attribute in the controllers

7. optional add the login/logout/username html to the view. e.g. add @Html.Partial(“_LoginPartial”) to _layout.cshtml

8. Finally publish the WebApp to Azure. Right click on project and click “Publish…”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s