If you are a regular follower of my blog, you have seen how easily you could get started with Azure websites. Azure website supports continuous deployment using Git and thus you can easily push changes to your Azure website from local git repository whenever you want. Today we will see how easily you could up and run your Azure Website using Git.
Install Git and Git-Extensions:
Create your Azure Website:
- Log in to your Azure Portal.
- Click on New>Website>Custom Create
- Type your preferred URL, choose a Web Hosting Plan and DATABASE (if your site requires one). If you don’t need any database left it as No Database. Check the box for “Publish from source control” and click on the arrow to go to the next step.
- Select Local Git Repository and click on the next arrow.
Note: If this is the first time you are setting up a repository in Azure, you will have to create a login credentials.
Once the website creation process completes, it will appear on the “Website” list.
Getting Git URL :
- Select the website that you have just created. Once you hover on your created website you will see the next arrow(->). Click that arrow. In our image we are selecting the website named “Justdemo“.
- Click on “View Deployments” to get the Git URL.
- Copy the GIT URL in your clip board.
- Create a new folder and open Visual Studio.
- Go to GitText > Clone Repository
- The following dialogue appears, click “Ok”
- Next in Repository to clone, copy the Git URL, and in destination, select the empty folder that you have created a while back.
- Click on “Clone”
- You might have to enter the password (created earlier) several times.
Deploy your website/ push changes to it from local repository :
- Create your visual studio web application in the folder where the repository was cloned.
- Click on Commit
- The following window appears, select the files where changes were made and click on “stage” to stage them.
- Write a comment in the comment box and click on “commit & push”
Note: Never stage bin / obj / Debug files.
- A window will appear, click “Ok”, enter password when prompted.
After a while you will see the following dialogue saying that the deployment was successful:)
I would like to thank Anika Sayara (Intern, Microsoft Bangladesh.) for contributing on this article. She is going to take and demonstrate the whole tutorial on “Azure Cloud Show” hosted by Microsoft Bangladesh.