{"id":2041,"date":"2024-10-17T12:51:28","date_gmt":"2024-10-17T19:51:28","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/identity\/?p=2041"},"modified":"2024-10-17T12:51:28","modified_gmt":"2024-10-17T19:51:28","slug":"integrating-ext-id-using-vs","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/identity\/integrating-ext-id-using-vs\/","title":{"rendered":"Creating an ASP.Net application with External ID using Visual Studio"},"content":{"rendered":"<p>Let\u2019s say you\u2019re building an ASP.NET application in Visual Studio and want to give users the ability to authenticate themselves. As your app grows in complexity, managing user identities can feel like a daunting task. You\u2019re not just concerned about potential security vulnerabilities, but you also have to be mindful of compliance and scalability challenges. Handling all of this on your own can quickly become overwhelming.<\/p>\n<p>Microsoft Entra External ID is a robust identity management solution designed to simplify this critical aspect of application development. Integrating External ID into your ASP.NET applications can bring immense value. It simplifies the often complex and time-consuming task of managing user authentication and security, allowing you to focus on writing the code that drives your application&#8217;s core functionality.<\/p>\n<p>By leveraging External ID, you gain robust, out-of-the-box security features that reduce the risk of vulnerabilities and ensure compliance with industry standards. This, in turn, accelerates your development process, promotes scalability, and enhances the user experience by providing seamless, secure access. Ultimately, it empowers you to deliver high-quality, secure applications more efficiently.<\/p>\n<p>In this guide, we walk you through the process of creating an ASP.Net application with External ID using Visual Studio. Whether you&#8217;re a seasoned developer or new to integrating identity management solutions, this tutorial will equip you with the knowledge and tools needed to harness the power of External ID in your projects.<\/p>\n<h2>Setting up and running your application<\/h2>\n<h3>Prerequisites\u202f<\/h3>\n<ul>\n<li>Install the recommended <a href=\"https:\/\/www.visualstudio.com\/downloads\">Visual Studio<\/a> version (17.11.3), along with ASP.NET and the web development workload. <\/li>\n<li>An external tenant on <a href=\"https:\/\/entra.microsoft.com\/#home\">Microsoft Entra Admin Center<\/a>.\u202f\u202f \n<ul>\n<li>If you don\u2019t have one, you can create one using our <a href=\"https:\/\/aka.ms\/ciam\/freetrial-info\">30-day free trial<\/a> or\u202f<a href=\"https:\/\/aka.ms\/ExternalIDConsumerApps\">create an external tenant<\/a>\u202fwith an Azure subscription.\u202f <\/li>\n<li>If you have one continue reading. <\/li>\n<\/ul>\n<\/li>\n<li>Ensure you have the <a href=\"https:\/\/learn.microsoft.com\/en-us\/entra\/identity\/role-based-access-control\/permissions-reference#application-administrator\">Application Administrator<\/a> role on Microsoft Entra.<\/li>\n<\/ul>\n<p><iframe width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/K-yDkQE63qk?si=5yMLjH8ze9xvBaLw\" allowfullscreen><\/iframe><\/p>\n<h3>Create your project<\/h3>\n<ul>\n<li>Open Visual Studio and create a new project.\u202f \n<ul>\n<li>From the templates, select &#8216;ASP.NET Core Web App (Razor Pages)&#8217; and click <strong>Next<\/strong>. <\/li>\n<li>Enter <strong>Project Name<\/strong>, e.g. \u2018ASP-Application\u2019 and <strong>Location<\/strong> (where you want to create the project) and click <strong>Next<\/strong>.<\/li>\n<li>In the <strong>Framework<\/strong> selection, use \u2018.NET 8.0 (Long Term Support)\u2019 and under <strong>Authentication Type<\/strong>, select \u2018Microsoft identity platform\u2019. <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>Install components<\/h3>\n<ul>\n<li>Install the required component, <code>dotnet msidentity tool<\/code>, and click <strong>Next<\/strong>.\u202f <\/li>\n<\/ul>\n<h3>Configure External ID and Run the Application<\/h3>\n<ul>\n<li>Sign in to External ID with a user that has permission to create an application registration.<\/li>\n<li>Select your trial or external tenant from the <strong>Tenants<\/strong> drop down.<\/li>\n<li>Click <strong>Create new<\/strong> and give your application a name, like \u201cvisual-studio-asp-app\u201d. This will create an application in Microsoft Entra External ID including a linked user flow, fully defining the sign-in and sign-up experience for your users.<\/li>\n<li>Select your \u201cvisual-studio-asp-app\u201d and click <strong>Next<\/strong>.<\/li>\n<li>Review the <strong>Summary of changes<\/strong> and click <strong>Finish<\/strong>.<\/li>\n<li>The dependency configuration process will be ongoing, as shown below. Once done, click <strong>Close<\/strong>.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/identity\/wp-content\/uploads\/sites\/74\/2024\/10\/dependency-configuration-process.png\" alt=\"dependency configuration process\" \/><\/p>\n<ul>\n<li>Navigate to <strong>Debug<\/strong> > <strong>Start Without Debugging<\/strong>.\u202f \n<ul>\n<li>This will start building your application, as shown below: <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/identity\/wp-content\/uploads\/sites\/74\/2024\/10\/building-your-application-in-Visual-Studio.png\" alt=\"building your application in Visual Studio\" \/><\/p>\n<ul>\n<li>Once your build is complete, a new browser window will open at https:\/\/localhost:7124. <\/li>\n<li>Complete the sign-up and sign-in process on the screen shown below:<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/identity\/wp-content\/uploads\/sites\/74\/2024\/10\/demo-sign-in-page.png\" alt=\"demo sign-in page\" \/><\/p>\n<ul>\n<li>On successful sign in, you will be able to see the demo page, as shown below: <\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/identity\/wp-content\/uploads\/sites\/74\/2024\/10\/demo-welcome-page.png\" alt=\"demo welcome page\" \/><\/p>\n<h2>Let\u2019s recap\u202f<\/h2>\n<p>You have now successfully set up your first ASP.NET core Web App and signed in your first user.\u202f<\/p>\n<p>In this blog post, you have learned how to:<\/p>\n<ul>\n<li>Create an ASP.NET application using a built-in Visual Studio template.<\/li>\n<li>Configure External ID with your ASP.NET application directly inside Visual Studio. <\/li>\n<li>Run your application. <\/li>\n<li>Sign in an External ID user with email and password on your application.\u202f <\/li>\n<\/ul>\n<h2>Stay connected\u202f<\/h2>\n<p>To learn more or test out features in the Microsoft Entra portfolio, visit our\u202f<a href=\"https:\/\/aka.ms\/dev\/external-id\">developer center<\/a>. Make sure you subscribe to the\u202f<a href=\"https:\/\/aka.ms\/devblog\/external-id\">Identity developer blog<\/a>\u202ffor more insights and to keep up with the latest on all things Identity. And, follow us on\u202f<a href=\"https:\/\/www.youtube.com\/@MicrosoftSecurity\/playlists\">YouTube<\/a>\u202ffor video overviews, tutorials, and deep dives.<\/p>\n<p>We encourage you share your feedback and <a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=2292418\">tell us what you think<\/a>,\u202for suggest new features to make the External ID extension even better. Also, please <a href=\"https:\/\/ux.microsoft.com\/Panel\/MicrosoftEntraExternalID?utm_campaign=ExternalID&amp;utm_source=AppService&amp;utm_medium=Blog\">join our research panel<\/a> to receive occasional invites to participate in customer research.<\/p>\n<p>\u202f<\/p>\n<p>\u202f<\/p>\n<p>\u202f<\/p>\n<p>\u202f<\/p>\n<p>\u202f<\/p>\n<p>\u202f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Integrate Microsoft Entra External ID into your ASP.NET application using Visual Studio. Learn how External ID simplifies user authentication, improves your security posture, and reduces vulnerabilities. Whether you&#8217;re new to identity management, or more experienced, this tutorial equips you with the guidance to enhance security and efficiency in your applications.<\/p>\n","protected":false},"author":165107,"featured_media":2044,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[48],"tags":[38,44,20,16,47,50,4,64],"class_list":["post-2041","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-authentication","tag-authorization","tag-devex","tag-entra","tag-external-id","tag-identity","tag-security","tag-visual-studio"],"acf":[],"blog_post_summary":"<p>Integrate Microsoft Entra External ID into your ASP.NET application using Visual Studio. Learn how External ID simplifies user authentication, improves your security posture, and reduces vulnerabilities. Whether you&#8217;re new to identity management, or more experienced, this tutorial equips you with the guidance to enhance security and efficiency in your applications.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/identity\/wp-json\/wp\/v2\/posts\/2041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/identity\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/identity\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/identity\/wp-json\/wp\/v2\/users\/165107"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/identity\/wp-json\/wp\/v2\/comments?post=2041"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/identity\/wp-json\/wp\/v2\/posts\/2041\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/identity\/wp-json\/wp\/v2\/media\/2044"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/identity\/wp-json\/wp\/v2\/media?parent=2041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/identity\/wp-json\/wp\/v2\/categories?post=2041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/identity\/wp-json\/wp\/v2\/tags?post=2041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}