Photo by chuttersnap / Unsplash (Modified)

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

When Node.js launched it was not supporting the Windows environment. Later Microsoft brought Node.js to Windows Azure. So that Microsoft users could build and deploy Node.js apps

Now we can use Node.js on Windows, we can develop and test Node.js app on the windows machine too. To do that you need to use PowerShell command prompt. First of all you need Windows Azure SDK for Node.js. and some more essential tools to work on Azure and Node.js

Azure SDK for Node.js

Azure Storage Explorer (It's an license free tool to see the data tables of Azure on you local machine)

On you finish installing, 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 <service name>
2. Add-AzureNodeWebRole
3. Start-AzureEmulator -launc
4. Get-AzurePublishSettings [filepath]
5. Import-AzurePublishSettings
6. Publish-AzureServiceProject –ServiceName <name of service> –Location <Geography location> -Launch
7. Stop-AzureService
8. Remove-AzureService*

It's good to remember these commands while working with Windows Azure (Node.js)

To start with the first Node.js app on Windows Azure you have to start with the first two commands

New-AzureService <service name>

"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 <name of service> –Location <Geography 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