Publish to Azure Website using Git

Paul van Brenk edited this page Dec 12, 2017 · 3 revisions

🎵Note: This documentation is outdated at this point, especially when using the Node tools in Visual Studio 2017. We're working on update docs, and will redirect you to those when they're ready.

Publish to Microsoft Azure Website using Git

Visual Studio 2013 has integrated Git support, so it's easy to deploy to Azure using Git, no command-line necessary.

🎵Note: Git integration is also available for Visual Studio 2012 as an extension on the Visual Studio gallery.

From the Azure portal, create a new Website.

Create Website

Click on the newly created Website, and choose Set up deployment from source control.

Set up deployment

Then select Local Git Repository.

Select Local Git repository

The URL to the repository can be copy/pasted from the portal.

Repository ready

In Visual Studio, create a new Node.js project or load an existing project which isn't associated with source control.

🎵Note: Git deployment to Azure does not require the use of the Azure project types. You may want to use them anyway, as you get a default web.config which you can configure. If you Git deploy a project without a web.config, Azure will detect that it's a Node.js application and use an appropriate web.config for it.

Select File->Add to Source Control.

Add to Source Control

Then select Git as the source control system.

Choose Source Control

A Git repository will be created for your solution. It will be listed in the Team Explorer window, under Local Git Repositories.

Team Explorer Local Git Repositories

From Team Explorer, click on the Home button on the toolbar. You may see a prompt to install Git command prompt tools. You may choose to install them, but they are not necessary.

Team Explorer Home

Click on Changes to see your pending changes. Review the files that will be included in the commit, enter a comment and click Commit.

🎵Note: When using Git, by default the node_modules are checked in to the repository. You can choose to exclude it from the repository. When Azure detects a new deployment, it will automatically npm install the modules specified in package.json on the Azure machine.

Team Explorer Pending Changes

Once it's done, you'll see a notification for your commit.

Team Explorer Commit Notification

In the notification message, click Sync to bring up the Unsynced Commits page.

Team Explorer Publish

Enter the URL for the Git repository, as displayed in the Azure Portal. Click Publish. Enter your credentials when prompted.

The Deployments page for your Website will show the commit information.

Deployment History

You can click the Browse button at the bottom of the Deployments page to navigate to your site.

Web Browser

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.