
- An Azure App Service Web App implemented in node.js
- A GitHub repo that is synchronized with the Web App (every commit to the master branch publishes a new version of the Web App using a GitHub hook)
- A local git repo setup to push to the GitHub repo as a remote
- A Visual Studio Code workspace configured to use the local git repo
- The end result? When I hit the git push menu item in Code, my live Azure Cloud application changes!
System Requirements
To make the magic happen, you will need to have to following components installed \ available to you:- An Azure Subscription (get one here)
- Visual Studio Code (install instructions)
- Git (download)
- Curl, used to create your GitHub repository (install)
- Azure CLI (install instructions). Note: The Azure CLI is an optional component, you can choose to create your Web App and configure it with GitHub by using one of the Azure Portals or Powershell.
- GitHub account Note: for this initial version of Code, the GitHub account I used is not using SSH or two factor authentication.
Putting it all together
For the purpose of this demo we will build a very simple node.js application comprised of only one file, server.js. Steps are: 1. Create an empty folder, this will become the location of the Code workspace. In my case I have chosen to go with “C:\websites\CodeWebApp” 2. Launch Code, hit the File | Open Folder menu and select your new folder
var http = require('http'); http.createServer(function (req, res) { console.log('Got request for ' + req.url); res.writeHead(200, {'Content-Type': 'text/html'}); res.end('<h1>Hello Code and Azure Web Apps!</h1>'); }).listen(process.env.PORT);
Hit Save. Make sure that you name the file server.js and that you save it in the folder created in step 1.
4. Now it is time to create a local git repo that you will later sync with GitHub. In Code, hit the git icon on the left nav bar and hit the “Initialize git repository” button. Note: you may need to hit the File | Open Folder… menu item and select workspace folder (created in step 1) if the Initialize git repository button doesn’t show up.

curl -u USER https://api.github.com/user/repos -d '{ "name": "NAME" }'Note: replace USER with your GitHub user name. Note: replace NAME with the name for your new GitHub repo.


git remote add origin https://github.com/USER/NAME.gitNote: replace USER with your GitHub user name. Note: replace NAME with the name of the GitHub repo your created. 8. Now you will configure git to save your credentials locally and automatically append them to push commands generated from Code (I suspect the Code team will improve auth support in future releases). Type the below in Git Bash:
git config credential.helper store9. This step will be the initial push to GitHub, after that, you will be able to do all the push commands from Code. In Git Bash type:
git push –u origin master
Note: you will be prompted for your GitHub user name and password.
Since you have configured the credentials helper in the previous step, you will not need to provide the credential next time you push from either Git Bash or Code.
10. By now we have a local repo synchronized to a GitHub repo. It is time to create an Azure App Service Web App! There are several ways to create Web Apps, you can do that in the Preview Portal (“Ibiza”) or the “Classic” portal. Powershell commandlets are also available. If you use one of the portals, create a new Web App and pick GitHub from the Continuous Deployment UI. You will then pick the repo you have created in step 6 (master branch).
In this example, we will use the Azure CLI to create an Azure Web App and link it to your GitHub repo. In a command window (running as administrator) type:
azure site create NAME -- githubNote: replace NAME with a unique name for your Web App Note: you will be prompted for data center and GitHub repo.





