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 http://www.microsoft.com/en-us/download/details.aspx?id=44921
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.