Introduction to Windows Azure with Node.js

Windows Azure with Node.js

Windows azure is a windows based cloud services, you can deploy your code and build your apps on the cloud server. Also it has support for all the OS and not just for WIndows. Also you can setup Virtual machine and you can do a Remote desktop to that machine. Which is a nice feature.

As initially when Node.js was launched it was not supporting the windows environment. But later on to use Node.js on the Windows machine and allow user to build and deploy Node.js apps Microsoft has brought Node.js to Windows Azure.

So now we can use Node.js on Windows, we can develop and test Node.js app on the windows machine too.

To do so powershell command prompt is needed and most importantly Windows Azure SDK for Node.js, other than that there are few more essential tools you need to work on Azure and Node.js

Azure SDK for Node.js

Azure Storage Explorer

Once installation is done then you will see Windows Azure PowerShell for Node.js in your Program files. Run that as “Administrator” to start with your first Node.js app

Few Important commands of Windows Azure

  1. New-AzureService
  2. Add-AzureNodeWebRole
  3. Start-AzureEmulator -launch
  4. Get-AzurePublishSettings [file_path]
  5. Import-AzurePublishSettings
  6. Publish-AzureServiceProject –ServiceName –Location -Launch
  7. Stop-AzureService
  8. Remove-AzureService

Its good to remember these commands while working with Windows Azure (Node.js)

Now to start with the first app of Node.js for Windows Azure you have to start with first two commands

New-AzureService

“This will create a Azure Service on you local”

Add-AzureNodeWebRole

“Once you run this command it will create a WebRole folder inside your service and this is the place where you will keep you Node.js code. When we run these two commands, SDK by default creates a Hello World app for us in Node.js”

Now to run this app use the (3) command in the list

Start-AzureEmulator -launch

“This will launch the web browser with the main page of our app”

If you are done and would like to start with some other code, you can stop the service using command (7)

Stop-AzureService

If you do not need this service and want to remove it then use the command (8)

Remove-AzureService

Now if you are done with your code and want to Publish this app to Windows Azure Cloud then you have to use the command (4), (5) and (6)

To get the AzurePublishSetting on your local so that you could deploy/publish your changes to Cloud, you need to use command (4)

Get-AzurePublishSettings

This will popup a download window, you have to download the file and need to keep in your local folder

After getting the file run the command (5) to import these settings

Import-AzurePublishSettings [File path]

Now this will allow you to publish you code to cloud server.

Finally to Publish your code you have to use the command (6) and this will deploy your code to cloud service

Publish-AzureServiceProject –ServiceName –Location -Launch

To learn more about Windows Azure and Windows Azure for Node.js you can use following links

Windows Azure Development Guide for Node.js

Windows Azure Node.js Cloud Service

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: