Deploy Node.js web apps in Azure App Service using Azure CLI

If you are not read the first article about BUILD POWERFUL NODE.JS WEB APPS WITH AZURE APP SERVICES please go through the article which is published few days before. Then only you will get a clear picture of the follow-up article ?

azure

So let’s deal with the Azure CLI to deploy the application to the azure app services.

Now we need to login to azure subscription using the command line interface. for that we need to use the below command

azure login

Screen Shot 2016-04-21 at 12.57.28 PM

This will redirect it to the web browser to authenticate the azure CLI.

Screen Shot 2016-04-21 at 12.56.46 PM

 

Now we are good to go , The CLI is authenticated and now we can start playing with it 🙂 now we need to make sure that we are in the root directory of our application by typing the command in the terminal.

ls

Screen Shot 2016-04-21 at 12.57.28 PM

 

Now Create the App Service app resource in Azure with a unique app name with the next command. Your web app’s URL will be http://<appname>.azurewebsites.net.

azure site create --git <appname>

if you are using the azure subscription for the first time, then you need to create following things in it.

  1. location

  2. git

Screen Shot 2016-04-21 at 1.17.15 PM

So,we successfully created a web app in azure cloud.

Screen Shot 2016-04-21 at 1.18.55 PM

Now we need to setup our node.js application production ready.

open the config/config.js file in a text editor and remove the production port || condition from the json.

production: {
root: rootPath,
app: {
name: 'safilsample'
},
port: process.env.PORT,
}

Save the document and commit the code to the git using a commit message

git add .
git commit -m ""
git push azure master

Screen Shot 2016-04-21 at 1.31.05 PM

 

Finally, we need to check our app in the browser

azure site browse

 

Screen Shot 2016-04-21 at 1.33.48 PM

Leave a Reply

Your email address will not be published. Required fields are marked *