In this note I want to document what I learned today and I would like to start with Azure Web Sites. Yeah, that is a good start!
Creating Web Sites: Azure Site and Source Repository
For this note I am using Visual Studio and Team Foundation Server online, One thing that I learned the hard way today was that to create a TFS Online repository the relationship between the web site repository and the Azure Web Site must be One-to-One. This makes perfect sense to me now because when creating the site the tooling does not ask you for a specific project of your repository, it just asks for the repository name.
IN order to create an Azure Web Site a workflow that I found convenient was to condition a TFS Online account first containing the source code of the site follow by creating the web site in Azure
Conditioning a Repository in TFS Online
Creating a repository on TFS Online is very simple. Login to your account and create the repository.
After you press the Create Account button you need to create a project. Note that you have an opportunity to use Git or Team Foundation as version control. I selected Team Foundation.
Note that the account repository created for this project is "https://a1manblog.visualstudio.com/" and we are going to need this URL when linking the Azure Web Site to its source control. After creating the account TFS Online offers the following dashboard.
If you have Visual Studio 2013 then you can click on "Open in Visual Studio" link to open the project in Visual Studio. Do not trouble yourself in the case that you do not have Visual Studio 2013 installed because you can always install Visual Studio 2013 Community Edition, which the same as the Professional Edition (wow!) with licencing limitations; then click "Get Visual Studio" to learn more.
But assume that you do have VS 2013 and that you opened the project.
| It is very convenient to map your project to a local directory at this time. |
Creating the Project in Visual Studio
You can now create a project. Visual Studio will ask you to choose to add this new project to Source Control and you need to select that option.
Complete the project creation, build it and run in locally just to make sure it is all nice and dandy. Once you are satisfied check in the project.
A Drops Directory
Optionally you can create a "drops" directory directory where successful builds are deployed. I could not create the "Drops" directory directly on TFS Online (Visual Studio Online) and could only create this directory on my local copy of Visual Studio. In Visual Studio > Source Control Explorer tab right click on the project and create a new directory named "Drops".
| Create Drops directory and Check in |
You can place builds here by editing the Build Definition file
| The created Build Definition file is already set to Continuous Integration under "Triggers" by default when it is created using TFS online. |
Azure Web Site
It is time to create the web site in your Azure dashboard. Login into your account and select the "Web Sites" tab. Note that Microsoft Azure is working on a new dashboard, however for this note I am using the current one:
Click on "New" on the lower left corner and select Custom Create.
In the Custom Dialog window provide a unique name for your site and select checked "Publish from source control"
In the next step Select the Visual Studio source control provider and advance in the wizard. Now it is time to authorize the connection by providing the address of the project in TFS and clicking the Authorize Now and accept the authorization link... you are almost there!
After finishing the wizard Azure created the web site. This takes a couple of minutes and after a successful creation the Web Sites dashboard shows the newly created site.
Click on the name of the web site and the tools view now show all the thing that you can do to tune and configure your web site. Note the "Configure" tab which offers common features available through IIS Manager: be curious and explore and you will recognize the functionality available right away.
Go crazy and click around; how else would you learn what is there! Explore! You can scale your site; take a look at the features which are self explanatory and have help notes associated to them.
Go crazy and click around; how else would you learn what is there! Explore! You can scale your site; take a look at the features which are self explanatory and have help notes associated to them.
However, we are not done yet and to finish our deployment we need to do one more thing. On the above screen access the "Deployments" tab. Azure now mentions a few things that you need to do when using TFS like for instance add the project to source control and check it in. I really like how the Azure team provides "how-to" instructions to guide us all the way. There is no way we can fail!
| In the case that you have not linked your project, Azure provides easy steps. |
Wait a minute! We have done our check in already, continuous integration works with a check in (checkin-build-deploy). In that case I went back to Visual Studio, edited my project and check it in.
| Build in Progress after a successful check in. Be patient because it takes awhile before you see this screen! |
This is nuts! TFS online is now building and deploying my site! I did not even had to create a build definition, it is all done for me! The default one is great!
Keep in mind that if you are using the free option for TFS Online we only have 60 building minutes available per months. If we want to increase that then we have to reach for our wallets... but is not scary!
When the build and deployment is completed you see this screen:
Hey! You are right; I have done a couple of check in and with every check in TFS built it for me and deployed it to Azure for me as well!
What about that Drops Directory?
You caught me! Well, yes, one does not really need this directory because TFS and Azure are doing the heavy work for me managing my builds and deployments; all default settings are pretty good and they might be sufficient to get you going. I can use this directory in the case that I create/edit current Build Definition file and indicate that I want to manage a copy of my builds and to place them in that location. This is optional.
Deployment Alternatives
There are other ways to deploy a web site to Azure Web Sites. The site can be created first, then add it to Source Control (TSF Online) followed by deploying to Azure from Visual Studio. This way is very easy as well and you need to have your Azure authentication login handy.What is Next for Web Sites?
Oh man! There is so much we can do and at least this note got me started! By inspection of the Web Site dashboard you can see all the other features that we have not touched in this note. Some of them are:
I do thank Microsoft, BCIT, the BC Dot Net User Group for organizing the event and the speakers... and my good buddies Nora, and Brian, and Medhat, and Jef, and Sergei.
I do thank Microsoft, BCIT, the BC Dot Net User Group for organizing the event and the speakers... and my good buddies Nora, and Brian, and Medhat, and Jef, and Sergei.
Yeah, look at the time I am writing this, I am fired up and not even sleepy!
And there is more, much more! Check out the references section of this post. Another resource is the Microsoft Virtual Academy with very high quality videos and courses.
I will see you around learning Azure and godspeed in this journey!
Conclusion
Getting started using Azure Cloud Web Sites is very simple and there is something for every one. I found that TFS Online, Visual Studio Online, integrates very well with Azure and I had no problems using this integration. I did find that it takes some time for the Azure Web Sites "Deployments" tab to get updated after a check in has completed in Visual Studio. This might create some confusion to the novice, like myself, but once you discover that "issue" it is very easy to use this delay as an excuse to get yourself a cup of coffee after a successful check in... you deserve it anyways!And there is more, much more! Check out the references section of this post. Another resource is the Microsoft Virtual Academy with very high quality videos and courses.
I will see you around learning Azure and godspeed in this journey!
References
- Microsoft Azure: Register and you might be able to enjoy an introductory 3 months free.
- TFS Online: Free TFS offered by Microsoft. Visit the TFS online to learn more about this service.
- Web Site Scaling: http://azure.microsoft.com/en-us/documentation/articles/web-sites-scale/
- Web Slots, Staging: http://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/
- Traffic Manager: https://msdn.microsoft.com/en-us/library/azure/hh744833.aspx
- Hybrid Connections: http://blogs.msdn.com/b/golive/archive/2014/11/21/azure-hybrid-connections-connect-to-protected-resources.aspx
- Redis Cache: http://azure.microsoft.com/en-us/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/
- The World Greates Azure Demo, video by Troy Hunt; excellent! https://www.youtube.com/watch?v=7V8HikBP1vQ
- Microsoft Virtual Academy Courses: http://www.microsoftvirtualacademy.com/Studies/SearchResult.aspx?q=Azure%2bweb%2bsites

