Right now I am gearing up for this weeks Winnipeg .NET User Group session “Git by a Git with Marc Jeanson” on September 20th (this Thursday). I am really excited about this session because Git is something that has always interested me but in my professional career I have not crossed paths with Git. That is, until now!
As an Azure Virtual Technical Specialist and overall enthusiast I try and keep up with all the great features of the Azure platform. Not the least of these features is the ability to publish changes to an Azure Website using Git and more specifically GitHub.
So, this is what I plan to accomplish in this post:
- Create a new Azure Website
- Associate my site to GitHub
- Make changes and re-deploy
Sounds simple right? Well lets find out.
Step 1: Setup a new Azure Website
With your Azure subscription you currently get 10 shared websites for free so this should be easy to setup and play with.
Go to http://manage.windowsazure.com and select “New” > “Compute” > “Web Site” > “Quick Create”, type in the Url prefix (in my case it is wpgnetug.azurewebsites.net) and which region and subscription you want this website hosted.
Once you select create it should be completed in no time, maybe a bit longer if this is your first website.
There are two options for source control, TFS and Git. TFS only works with TfsOnline.com (the SaaS hosted TFS service) and right now we are going to focus on Git.
Note: You can only choose one deployment mechanism so if you need to change you may have to re-create your site or try contacting Azure support.
Select the “Set up Git publishing” link and you should eventually see a Git Url.
Step 2: Associate your site to GitHub
So we could normally go through setting up your local Git repository to Azure but I currently want to deploy from a GitHub project and with the GitHub client for Windows I can easily setup local repositories on my machine.
So once you have a project setup in GitHub, click the “Authorize Windows Azure” link under “Deploy from my GitHub project”
Once your authorized select the project you want to deploy.
If your site has code in there the deployment should start right away. Once it shows an active deployment go to your site and check it out (http://wpgnetug.azurewebsites.net/) you should also see this under the “Deployments” tab of your site.
Step 3: Make some changes to the site and re-deploy
So to do this I am going to make sure I have cloned the latest version of the site to my local repository. I use GitHub for Windows to manage the local repositories on my machine.
So to show the the deployment I am going to change the main title of the home page to Tylers .NET User Group – *Evil Laugh*
Now I see that GitHub shows uncommitted changes.
Commit the change with a description and then Sync to your repository. Now go back to the Windows Azure management page. You should see a new deployment.
And finally to verify the change I can see the updated title on http://wpgnetug.azurewebsites.net/
Wow! That was easy.
You can find more information on Git and Azure websites on the Azure in the documentation here: https://www.windowsazure.com/en-us/develop/net/common-tasks/publishing-with-git/
If you are in Winnipeg I hope to see you at this weeks event!
Thanks for reading.