Month: October 2013

Azure Active Directory Spike


  • Create a simple web app that uses MVC5 and Azure Active Directory.

So That

  • I can determine if Azure Active Directory is the right thing for this application.


  1. Create a web app that allows two users to log in.
  2. Create an Admin user
  3. Create a regular user
  4. On the web app display a control for only the Admin user


The existing documentation for doing this is based on VS2012 and older versions of WIF and the Azure portal. I have to translate this to the newer portal.


10:08 First problem… when I run the wizard to create the MVC5 app I chose to use an organizational account.  When I click OK it asks me to sign in to the organizational account.  The Azure Management portal has created an account for me based on my Microsoft Account so great – I tried to sign in using this ID but no luck.

I’m going to create another identity in the directory and try to use that one.  Creating the test account got the wizard working.

10:30 Published the website to Windows azure – first attempt to run it ran into an error Server Error in ‘/’ Application.  Now to update the web.config to see what I can get.

10:32 Published again after changing web.config to set <customErrors mode=”Off” /> but still not getting an error message.  Changed the wrong <system.web> section of the config file.  Trying again.

The error seems to be a problem with SQL Server. Of course, I didn’t configure SQL Server for anything in this app.  Not sure where this is coming from.  Going to try a local debug.

10:42 The local debug worked just fine.  I suspect that the problem is the DefaultConnection string.  I updated the app to have a connection string to a Sql Azure server and database – now everything is working.

10:59 Not sure if AD is the right move.  I’m experimenting with Facebook Auth as well. I can sign in on Facebook but the app encounters an error after the handshake.

The error is probably due to the SQL Connection string.  It doesn’t happen when used locally.

11:20 When I started this spike I was pretty sure I wanted to use Azure AD for this app.  Now I’m not so sure.  I really like the idea of allowing people to use whatever digital identity that they want.  I think this is probably the way to go for now.

My next tutorial to examine is Deploy a Secure ASP.NET MVC app with Membership, OAuth, and SQL Database to a Windows Azure Web Site