Welcome!

Open Source Authors: Tad Anderson, Elizabeth White, Jayaram Krishnaswamy, Michelle Drolet, Ignacio M. Llorente

Blog Feed Post

Azure CLI Day 38 – mobile script upload

bash-azure

In my previous post (http://thinkfirstcodelater.com/blog/?p=3367) I showed you how to use the Windows Azure cross platform command line tools to download a script associated with a Windows Azure Mobile Service’s schedule job. In this post I’ll show you how to modify the script and upload to the Windows Azure Mobile Service.

Once again, just a reminder that I’m using the command line tools on a MacBook Air with OSX (Mountain Lion) installed, and I’m using Google Chrome as my default browser. However, the experience should be identical on Windows and Linux as well.

Start by opening the downloaded script and changing the contents to the following:

function myFirstJob() {
    console.log("This is my first scheduled job!");
}

Save the scripts and close it. Open an instance of your command line (Terminal, Bash, Command Prompt, etc.) and type the following:

azure mobile script upload -h

Screen Shot 2013-10-14 at 8.22.11 PM

As you probably already guessed, the azure mobile script upload command is the command to use to upload a script to a Windows Azure Mobile Service. There are a few parameters/options you need to provide:

  1. servicename, the name of the mobile service
  2. scriptname, the name of the script
  3. -f, –file, the fuel to upload for the script

Now enter the following into your CLI, substituting where appropriate:

azure mobile script upload -f ‘[PATH TO YOUR MODIFIED SCRIPT FILE]‘ ‘[NAME OF YOUR MOBILE SERVICE]‘ ‘[NAME OF YOUR SCRIPT]‘

I used the following:

azure mobile script upload -f ‘/Users/adam/Code/zumo-00005/scheduler/myFirstJob.js’ ‘zumo-00005′ ‘scheduler/myFirstJob’

Screen Shot 2013-10-14 at 8.27.48 PM

You can verify the command by using the following:

azure mobile script download -c ‘[NAME OF YOUR MOBILE SERVICE]‘ ‘[NAME OF YOUR SCRIPT]‘

I used the following:

azure mobile script download -c ‘zumo-00005′ ‘scheduler/myFirstJob’

Screen Shot 2013-10-14 at 8.31.54 PM

That’s it. In my next post I’ll show you how to start a schedule job using the Windows Azure cross platform command line tools.

Did you know you can try Windows Azure for free for 30 days? Just go to http://aka.ms/thecloud and sign up.

Read the original blog entry...

More Stories By Adam Grocholski

Hey there! My name is Adam Grocholski, and I'm a Technical Evangelist at Microsoft where I spend time focusing on Windows, Windows Phone, and Windows Azure. I live in the frozen tundra of Minnesota and run thinkfirstcodelater.com. You can also follow me on twitter at @codel8r.