How to add Azure AD Authentication to Existing ASP.NET MVC Application? - asp.net-mvc

I have an existing ASP.NET MVC application using Visual Studio 2013. I followed this walk-through but it only concerns itself with a new greenfield project while selecting Change Authentication in project template: Developing ASP.NET Apps with Windows Azure Active Directory
I am not interested in using OWIN and OpenID Connect Katana modules as these components have lots of issues so I am waiting for that technology to mature and render out all the current problems.
I aim is understand how to manually add all the components and configuration to my existing ASP.NET MVC application to achieve the same Azure AD authentication model in Rick Anderson's article.

The tooling in VS 2013 doesn't support adding this to an existing project. At the bottom of the link you referenced in the More Information section is a deep dive article where I dissect the code and configuration that gets added. So, you could use that as a reference to find the deltas and apply them to your project.
Now, Visual Studio 2015 offers us some hope in this scenario. It's in preview of course, but you may give it a try. In Solution Explorer, right click on your existing project and select the Configure Azure AD Authentication option.

In Visual Studio 2017 the option to enable Authentication with Azure Active Directory is in Connected Services:

Related

Application not auto creating AccountController

I am creating an MVC project in VS2017 and in VS2015, when you create an MVC templated ASP.NET Web App, it will automatically build an account controller for you which adds register and log in functionality. It will add an AccountController.cs and ManageController.cs to controllers with the appropriate views.
But in VS2017, when I create an MVC project it doesn't add this to the project. I've tried importing the files from an old VS2015 project, but It didn't seem to work. How can I get around this? Is there a way to create a project with the account controller or did they remove that in VS2017?
You need to select some form of authentication when you create the app.
My issue/resolution was slightly different than the accepted answer. I was choosing the "Web API" template while checking the "MVC" checkbox and I DID select Individual User Accounts, but the account controller/views were still not created. It appears the Account boilerplate doesn't get generated with the Web API option, regardless of what you choose for Authentication.
Had this problem myself today creating an ASP.NET Core Web Application with identity. changing the version from ASP.NET Core 2.1 to ASP.NET Core 2.0 fixed the problem.
I am using visual studio version 15.7.6, .NET Framework version 4.7.03056
You can easily execute this command in the nuget console and your problem will be solved:
Install-Package Microsoft.AspNet.Identity.Samples -Version 2.2.0-alpha1

Why webmatrix create mvcforum site as website and not web application

I created web app of mvcforum with webmatrix and now when i create
again its website and not soloution project how i can create web
soloution project of mvcforum with webmatrix?
WebMatrix doesn't support the Web Application project type. Therefore it is not the correct tool for ASP.NET MVC development. You should use Visual Studio instead. The Community edition is free for single users and includes the same feature set as the Developer version (https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx).

Adding Azure Single-Sign-On to an existing MVC application, in VS2013

I've been exploring the Azure Active Directory services and was pleased with how easy it was to hook up an arbitrary ASP.NET MVC website to it. I've experimented with this in Visual Studio 2012 and all works well. Especially using the Identity and Access Tool extension for VS2012.
Now here comes the tricky part: This tool is however deprecated and not supported on, nor available for Visual Studio 2013.
There are several MSDN documents on the matter, like this excellent tutorial, only I find them all targeting VS2012 and the forementioned tool. For new projects the process is "simplified when creating a new web application". But I don't want a new application - I want to hook up existing applications in VS2013.
Now the question is: is there a 'decent' way to integrate Azure ActiveDirectory, especially the Single Sign-On feature, to an existing ASP.NET MVC 5 web application in Visual Studio 2013?
At least with the same ease as the I&A Tool, but without the need to recreate or migrate my entire application, of course.
Depending on the complexity of your project, you can either create a new project and import your project files to the new project or import the identity settings to your existing project.
Since the identity controls are really just a set of files and configuration, you should be able to create a project with the identity settings you want and then copy over the files / configuration to your existing project. You may also need to add references to things like Microsoft.AspNet.Identity.Owin and any security providers you need. Files to take a look at include:
App_Start/IdentityConfig.cs
App_Start/Startup.Auth.cs
Controllers/AccountController.cs
Startup.cs
Web.config
Yes, it's a pain, and hopefully there will be an easier way of adding or changing identity later, but this is the best I've come up with for now.

MVC 3 on windows azure

i am developing a SAAS and want to use MVC on windows Azure. To get started i need how i can set it all up in Visual Studio 2010? Can i create the MVC 3 project locally and later integrate with Azure?
I will be using the cloud emulator
cheers
The Windows Azure Tools update from Augustus 2010 has now integrated MVC3 support so there shouldn't be anything else you need to do besides making a Azure Solution and adding a MVC3 Web Role.
http://blogs.msdn.com/b/windowsazure/archive/2011/08/03/announcing-the-august-2011-release-of-the-windows-azure-tools-for-microsoft-visual-studio-2010.aspx
I just had to do this recently. You can create an MVC3 web app just like you normally would, and then later, you can add a new Azure project to your solution and then add a WebRole for the existing MVC3 app. It worked without any issues.
Hope this helps.

Move MVC application in VS2008 to windows azure

I am new to Azure.I have MVC application build in VS 2008. It does not uses any database. How can I migrate the application to windows azure.
Which SDK and tool kit i should use.
Do i need to upgrade my app to 2010 before migrating
Is there any built in support for MVC
What role I should use
Thanks
Ank
Windows Azure hosts various roles, one of which is a WebRole. You can easily place an MVC project into this role for hosting on Azure.
Firstly, you will need to upgrade to VS2010 as I believe the latest SDK (Version 1.4) only supports VS2010. Download that from here http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7a1089b6-4050-4307-86c4-9dadaa5ed018&displaylang=en
Once you have it installed, you create a Cloud project in VS. You then add your existing MVC projects to this solution. You then add a web role to the Cloud project you created and select your MVC project as the target.
There are a few things extra you need, such as setting copy-local on some referenced assemblies.
Here is an excellent post on the subject: http://blogs.msdn.com/b/jnak/archive/2008/10/28/asp-net-mvc-projects-running-on-windows-azure.aspx
Which SDK and tool kit i should use.
1.4 is the latest download link
Do i need to upgrade my app to 2010 before migrating
yes, SDK 1.4 does not support 2008
Is there any built in support for MVC
yes you will find a ASP.NET MVC 2 WebRole template`
What role I should use
this depends, try starting with Extra Small

Resources