Skip to content

Latest commit

 

History

History
73 lines (45 loc) · 5.11 KB

vs-active-directory-add-connected-service.md

File metadata and controls

73 lines (45 loc) · 5.11 KB
title description author manager ms.prod ms.technology ms.custom ms.topic ms.date ms.author
Using the Active Directory connected service (Visual Studio)
Connect Microsoft Entra ID (formerly Azure Active Directory) to your application by using Connected Services in Visual Studio on Windows.
ghogen
jillfra
visual-studio-windows
vs-azure
devx-track-csharp
how-to
12/14/2021
ghogen

Add a Microsoft Entra ID by using Connected Services in Visual Studio

[!INCLUDE Visual Studio]

By using Microsoft Entra ID, you can support Single Sign-On (SSO) for ASP.NET MVC web applications, or Active Directory Authentication in web API services. With Microsoft Entra authentication, your users can use their accounts from Microsoft Entra ID to connect to your web applications. The advantages of Microsoft Entra authentication with web API include enhanced data security when exposing an API from a web application. With Microsoft Entra ID, you do not have to manage a separate authentication system with its own account and user management.

This article and its companion articles provide details of using the Visual Studio Connected Service feature for Active Directory. The capability is available in Visual Studio 2015 and later.

At present, the Active Directory connected service does not support ASP.NET Core applications.

Prerequisites

Connect to Microsoft Entra ID using the Connected Services dialog

  1. In Visual Studio, create or open an ASP.NET MVC project, or an ASP.NET Web API project. You can use the MVC, Web API, Single-Page Application, Azure API App, Azure Mobile App, and Azure Mobile Service templates.

  2. Select the Project > Add Connected Service... menu command, or double-click the Connected Services node found under the project in Solution Explorer.

  3. On the Connected Services page, select Authentication with Microsoft Entra ID.

    Connected Services page

  4. On the Introduction page, select Next. If you see errors on this page, refer to Diagnosing errors with the Microsoft Entra Connected Service.

    Introduction page

  5. On the Single-Sign On page, select a domain from the Domain drop-down list. The list contains all domains accessible by the accounts listed in the Account Settings dialog of Visual Studio (File > Account Settings...). As an alternative, you can enter a domain name if you don’t find the one you’re looking for, such as mydomain.onmicrosoft.com. You can choose the option to create a Microsoft Entra app or use the settings from an existing Microsoft Entra app. Select Next when done.

    Single-sign on page

  6. On the Directory Access page, select the Read directory data option as desired. Developers typically include this option.

    Directory access page

  7. Select Finish to start modifications to your project to enable Microsoft Entra authentication. Visual Studio shows progress during this time:

    Active Directory connected service progress

  8. When the process is complete, Visual Studio opens your browser to one of the following articles, as appropriate to your project type:

  9. You can also see the Active Directory domain on the Azure portal.

How your project is modified

When you add the connected service the wizard, Visual Studio adds Microsoft Entra ID and associated references to your project. Configuration files and code files in your project are also modified to add support for Microsoft Entra ID. The specific modifications that Visual Studio makes depend on the project type. See the following articles for details:

Related content