Running .cmd files using Azure Web Role

Posted: February 13, 2015 in General

Running .cmd file using Azure Web Role was one of the things that I was working on recently which took quite a long time than expected to crack.

This blog post should help some lost soul out there who are trying to google 🙂

STEP 1: First step is download the latest visual studio updates from the Microsoft site, so that you can use the latest fixes that are released in the update. I downloaded the updates from

STEP 2: Make sure that Azure SDK are installed in your machine.

STEP 3: Create a new Azure Cloud Project as shown in the screen shot below and click OK.


STEP 4: In the next screen you will be asked whether you would like to create a web role project along with the cloud service.


STEP 5: For this blog post I have created a TestWebRole project and click on Ok.


STEP 6: In the next screen select a template,


STEP 7: Once you select a template and click ok, the solution explorer should look as the screen shot below.


STEP 8: In the TestWebRole project add a Startup.cmd file. And write the code as shown in the screen. This is for creating a MyTest.txt file in the Azure Paas VM.


STEP 9: Once we add the cmd file we need to change the properties of the file. Right click on the file and go to properties and change the settings as shown in the screen shot below.



STEP 10: Go to serviceDefinition.csdef file to add local resource and StartUp tasks as shown.


STEP 11: Right click on the azure cloud project and click on package.


STEP 12: On click of package you should get the following pop up.


STEP 13: on click of package, configuration and package files will be created as shown below.


STEP 14: Upload the package to the azure portal and publish the vm. Once the package is deployed if you take a RDP to the vm you should find the MyTest file generated in the server in the following location.


Similar to this we can do charms by running .cmd files in azure, like extracting zip file, sending the files from azure to cloud storage etc.

Will be running through this in my next blogs.

Hope this helps someone out there.


Fill handle and Cell Drag and Drop is one of the most commonly used feature or say functionality in excel when dealing with sequences and numbers.

This by far has been the most frequently used functionality in excel throughout my career. Be it writing a formula and applying the same throughout different other cells or writing a common insert/delete script query for SQL and applying the same on other cells in the spreadsheet.

You can enable this feature [Excel 2010] if in case it is not enabled by following steps:

STEP 1: Go to File tab in excel as shown in the screen shot below and click on “Options” below “Help” section



STEP 2: after you click on options in the window that pops up click on “Advanced” section. In this section you can find that there is a check box to “Enable Fill handle and Cell Drag and Drop” as shown below

Advanced Tab

Advanced Tab

STEP 3: Once you enable this write a sequence of number say 1 and 2 in the first two cells. Select the two cells and drag it down till 5th row to see the numbers being filled in a sequence.

Drag Drop

Drag Drop

Well the feature is used very commonly but finding where to enable or disable needs lil bit of “Googling” and this blog serves the purpose 🙂

Aside  —  Posted: January 16, 2014 in Excel

Today when I was attaching a database, I encountered a common error that pops up if there is no proper access rights set for the “mdf” file that you are trying to attach.

I remember few years back when I had encountered same error, I had wasted quite a lot of time than needed on getting this up and running…J

So here goes the step to generate the error and fix it.

I downloaded the adventure work database from

STEP 1: Right click on the databases in SSMS and click “Attach…”

STEP 2: Click on ADD and go to the path where you have your downloaded adventure work database and click ok.

In case you already have the permissions set properly the database will get created.

If the permissions are not set then you will get a pop up as shown in the screen shot below:

Error 1

Error 1

If you click on the hyper link present in the Message section then you will have this popup saying the detail of the error as shown below:

Error 2

Error 2

So by looking at the details in the popup it becomes evident that the error is due to some access rights on the file that you are trying to attach.

Go to the folder where your mdf file is present right click –> Properties and go to Security tab, click on authenticated user and Select the checkbox for “Fill Control” as shown in the screen shot below.

Error 3

Again follow the Step 1 and 2, this time the database gets created without any error.

Hope this helps someone in need.

Aside  —  Posted: October 29, 2013 in SQL Server