I’ve recently spent some time working with the Visual Studio Online API creating an ASP.NET application. The benefit of have visibility into VSO Work items on the go was too much to pass up on for a series. So over the next several blogs we will show you how to create your own Visual Studio Online App via the RESTful API, authenticate with Azure Active Directory then Continuously Deploy it using Build vNext. We will also add custom Instrumentation via Azure Application Insights.
For this first episode we will show you how to quickly create an ASP.NET application and configured it for sign-on with Azure Active Directory
For the following steps I’m using Visual Studio 2015.
- Open up Visual Studio, click File and then New Project. On the New Project dialog, select the Visual C# / Web / ASP.NET Web Application project template, name your application. Don’t check or uncheck the Add Application Insights, we will come back to this in a later blog. You will want to select the Add to source control option in order to implement the Continuous Deployment process in the next blog. Click OK.
- In the next dialog (New ASP.NET Project), select MVC, Add unit tests, and then click Change Authentication.
- In the Change Authentication dialog, select Work And School Accounts. This option will be used to register your application with Azure AD in addition to configuring the application to integrate with Azure AD. Cloud - Single Organization should be selected in the dropdown. Check the Read directory data checkbox. Select or enter the domain for your Azure AD directory, it will look something like mysubscription.onmicrosoft.com or a custom domain you have setup prior to this. Click OK to drop back into the New ASP.NET Project.
- Now that we are back in the New ASP.NET Project dialog, check the Host in the cloud option then click OK.
- In the next dialog (Configure Microsoft Azure Web App), Type a name in the Web App Name text box. If the name is available you will get a green checkmark to the right of the box. Finish filling out this dialog with the appropriate information related to the Subscription, App Service pan, Resource Group and Region, If you don’t have a Azure Database Server, choose Create new server and fill in the Database Server, Database username, Database password and Confirm password.
NOTE: use lower case for your Database Server name. I have seen it error if you don’t. Now click OK to continue.
Visual Studio will now create you project and Enable Organizational Authentication. If you watch the dialogs closely you can see it go by.
If you run the application locally now you can login using an Azure Active Directory Identity. You may be prompted to allow the application access to Active Directory. Click Accept.
Let’s look at several other areas before we finish. Take a look at your Output in Visual Studio and notice the libraries, addresses, tokens and process.
The second place to look is under Azure Active Directory. The application should be listed with https://localhost:someport as the APP URL.
The application should also show up under Azure Web Apps
The next stop in our journey is Episode 2 - Continuous Delivery with Visual Studio Online Build vNext
NOTE: I used Visual Studio 2015, if you are using 2013 or older take a look at this blog by Rick Anderson, as your process may look different and have a few extra steps to get up and running.
Do you have an EA with Microsoft? You could be eligible for thousands of dollars in free ALM or Azure consulting! Contact us to learn how.