bash-azure

In my previous post (http://thinkfirstcodelater.com/blog/?p=3329) I showed you how to delete a table associated with a Windows Azure Mobile Service. In this post I’m going to shift away from working with Windows Azure Mobile Service tables and data and start focusing on schedule jobs. Scheduled jobs allow you define server scripts that are executed either on a schedule you define or on demand.

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.

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

azure mobile job create -h

Screen Shot 2013-10-14 at 6.47.37 PM

As you can see the azure mobile job create command is the command to use when you want to create a job. There are several parameters/options you can use

  • servicename, the name of the service you want to create the job for
  • jobname, the name of the job
  • -i, –interval, the job interval
  • -u, –intervalUnit, the unit associated with the interval (can be minute, hour, day, month, or none for on-demand jobs)
  • -t, –startTime, time of the first run of the scheduled job, the default is now

For this exercise we’ll create a job that runs every fifteen minutes. Type the following into your CLI, substituting where appropriate:

azure mobile job create -i 15 -u ‘day’ ‘[YOUR MOBILE SERVICE NAME]‘ ‘myFirstJob’

I used the following:

azure mobile job create -i 15 -u ‘day’ ‘zumo-00005′ ‘myFirstJob’

Screen Shot 2013-10-14 at 6.57.07 PM

You can verify the command was successful by going to the Windows Azure Management Portal and navigating to the Scheduler portion of your Windows Azure Mobile Service.

Screen Shot 2013-10-14 at 6.58.28 PM

In upcoming posts I’ll show you how to do the following:

  1. List your scheduled jobs
  2. Modify the script associated with a scheduled job
  3. Update a scheduled job
  4. Delete a scheduled job

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

bash-azure

In my previous two posts I showed you how to use the Windows Azure cross platform command line tools to:

In this post I’ll show you how to use the command line tools to delete a table associated with a 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.

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

azure mobile table delete -h

Screen Shot 2013-10-14 at 1.41.39 PM

As you can see the azure mobile table delete command is the command to use to delete a table associated with a Windows Azure Mobile Service. To use the command you need to provide the name (servicename) of your mobile service and the name (table name) of the table you want to delete. Optionally, you can also specify if you want to bypass the confirmation prompt by using the -q or –quiet option.

Before proceeding to delete a table, first get a list of tables associated with your mobile service by entering the following, substituting where appropriate:

azure mobile table list ‘[YOUR MOBILE SERVICE NAME]‘

I used the following command:

azure mobile table list ‘zumo-00005′

Screen Shot 2013-10-14 at 1.46.09 PM

As you can see, my mobile service has three tables. To delete a table from your mobile service, enter the following into your CLI:

azure mobile table delete -q ‘[YOUR MOBILE SERVICE NAME]‘ ‘[YOUR TABLE NAME]‘

Since I wanted to delete the GenreMovie table, I used the following:

azure mobile table delete -q ‘zumo-00005′ ‘GenreMovie’

Screen Shot 2013-10-14 at 1.48.45 PM

Once the command completes you can verify the table was deleted by once again using the following, substituting where appropriate:

azure mobile table list ‘[YOUR MOBILE SERVICE NAME]‘

Once again I used the following:

azure mobile table list ‘zumo-00005′

Screen Shot 2013-10-14 at 1.50.29 PM

That’s it for using the Windows Azure Cross Platform Command Line tools to work with tables and data associated with a Windows Azure Mobile Service. In my next post I’ll start looking at how to use the tools to work with schedule jobs associated with a Windows Azure Mobile Service.

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

bash-azure

In my last post (http://thinkfirstcodelater.com/blog/?p=3310) I showed you how to read data from a table associated with your Windows Azure Mobile Service using the cross platform command line tools. In this post I’ll show you how to use those tools to truncate, or delete all of the data, from a table associated with your 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.

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

azure mobile data truncate -h

Screen Shot 2013-10-12 at 9.35.19 AM

As you can see from the above screenshot the azure mobile data truncate command is the command to use when you want to delete all of the data from a table. For this particular command there are three parameters/options to know about:

  • servicename, the name of the service containing the table you want to truncate
  • tablename, the name of the table you want to truncate
  • -q, –quiet, whether or not you want to prompt for confirmation prior to truncating the table

Before we truncate a table, let’s use the azure mobile table list command to get a list of all the tables associated with our mobile service. Enter the following int your CLI, substituting where appropriate

azure mobile table list ‘[YOUR MOBILE SERVICE NAME]‘

I entered the following:

azure mobile table list ‘zumo-00005′

Screen Shot 2013-10-12 at 10.18.07 AM

As you can see, my particular mobile service has three tables. For this exercise, I’ll truncate the GenreMovie table. Enter the following into your CLI, once again substituting where appropriate:

azure mobile data truncate -q ‘[YOUR MOBILE SERVICE NAME]‘ ‘[YOUR TABLE NAME]‘

I entered the following:

azure mobile data truncate -q ‘zumo-00005′ ‘GenreMovie’

Screen Shot 2013-10-12 at 10.21.50 AM

Notice I used the -q option to suppress confirmation of the operation. You can verify the success of the truncation operation by entering the following int your CLI, substituting where appropriate

azure mobile table list ‘[YOUR MOBILE SERVICE NAME]‘

I entered the following:

azure mobile table list ‘zumo-00005′

Screen Shot 2013-10-12 at 10.23.14 AM

Notice the GenreMovie table now contains 0 rows.

That’s it for now. In the next post I’ll show you how to delete a table from your Windows Azure Mobile Service.

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

bash-azure

In my last post (http://thinkfirstcodelater.com/blog/?p=3297) I mentioned that I would use my next post, that’s this one, to show you how to delete a table associated with a Windows Azure Mobile Service. However, I then realized that there are two things I want to show you how to do prior to deleting a table. The first of which is how to read data from a table using the Windows Azure cross platform command line tools. I’ll use this post to show you how to do exactly that.

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.

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

azure mobile data read -h

Screen Shot 2013-10-11 at 9.09.26 AM

The mobile data read command is the command to use to view data in a table. As you can see there are several options and parameters you can use to define the data that gets displayed.

Options:

  • -k, –skip, skips the first specified number of rows
  • -t, –top, returns the first specified number of rows
  • -l, –list, displays the results in list format

Parameters:

  • servicename, the name of the mobile service containing the table you want to read data from (required)
  • table, the name of the table you want to read data from (required)
  • query, the query you want to execute (not required)
  • Let’s start using the command to simply read data from a table. Enter the following into your CLI, substituting where appropriate:

    azure mobile data read “[YOUR MOBILE SERVICE NAME]” “[YOUR TABLE NAME]“

    In my case I entered the following:

    azure mobile data read “zumo-00005″ “Movie”

    Screen Shot 2013-10-11 at 9.18.44 AM

    As you can see from the above screenshot, the data is returned in a nice table. If you’d prefer to see the data in a list format, enter the following:

    azure mobile data read -l “[YOUR MOBILE SERVICE NAME]” “[YOUR TABLE NAME]“

    I entered the following:

    azure mobile data read -l ‘zumo-00005′ ‘Movie’

    Screen Shot 2013-10-11 at 9.21.43 AM

    You can also have the data formatted as json using the standard –json option by using the following:

    azure mobile data read –json “[YOUR MOBILE SERVICE NAME]” “[YOUR TABLE NAME]“

    I entered the following:

    azure mobile data read –json ‘zumo-00005′ ‘Movie’

    Screen Shot 2013-10-11 at 9.22.35 AM

    If you want to just return the first record you can use the -t or –top option like this:

    azure mobile data read –top 1 “[YOUR MOBILE SERVICE NAME]” “[YOUR TABLE NAME]“

    I used:

    azure mobile data read –top 1 ‘zumo-00005′ ‘Movie’

    Screen Shot 2013-10-11 at 9.43.16 AM

    If you want to return the last record you could use the -s or –skip option like this:

    azure mobile data read –skip 4 –top 1 “[YOUR MOBILE SERVICE NAME]” “[YOUR TABLE NAME]“

    I used:

    azure mobile data read –skip 4 –top 1 ‘zumo-00005′ ‘Movie’

    Screen Shot 2013-10-11 at 9.45.17 AM

    That’s it for now. In my next post I’ll show you how to truncate the data in a table.

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

    bash-azure

    In my previous post (http://thinkfirstcodelater.com/blog/?p=3290) I showed you how to view details for a specific table in your Windows Azure Mobile Service using the Windows Azure cross platform command line tools. In this post I’ll show you how to modify an existing table in your 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.

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

    azure mobile table update -h

    Screen Shot 2013-10-04 at 9.56.46 AM

    The mobile table update command is the command to use if you want to modify a table. You need to specify two parameters in order to use the command:

    1. The name of your Windows Azure Mobile Service
    2. The name of the table you want to update

    You can use the following options to perform various update operations on a table:

    • -p, –permissions. Update the permissions associated with the table’s operations (insert, read, update, delete).
    • –deleteColumn. Delete columns from the table.
    • –addIndex. Add indexes to the table.
    • –deleteIndex. Delete indexes from the table.

    For this post, we’ll simply add an index to a table. Enter the following command into your CLI to view the details for a specific table, substituting where appropriate:

    mobile table show ‘[YOUR MOBILE SERVICE NAME]‘ ‘[YOUR TABLE NAME]‘

    In my case I entered the following:

    mobile table show ‘zumo-00005′ ‘Movie’

    Screen Shot 2013-10-04 at 10.04.48 AM

    Currently my Movie table has a single index on the id column. To add an index to a column enter the following into your CLI, once again substituting where appropriate:

    azure mobile table update –addIndex ‘[YOUR COLUMN NAME]‘ ‘[YOUR MOBILE SERVICE NAME]‘ ‘[YOUR TABLE NAME]‘

    In my case I entered the following:

    azure mobile table update –addIndex ‘title’ ‘zumo-00005′ ‘Movie’

    Screen Shot 2013-10-04 at 10.08.02 AM

    Once the operation completes successfully, run the mobile show command again using the following:

    mobile table show ‘[YOUR MOBILE SERVICE NAME]‘ ‘[YOUR TABLE NAME]‘

    In my case I entered the following:

    mobile table show ‘zumo-00005′ ‘Movie’

    Screen Shot 2013-10-04 at 10.09.19 AM

    We now see the second index has been added to the table. This can also be verified by going to the Windows Azure Management Portal, navigating to your Mobile Service, going to the data tab, and clicking on the table you just updated.

    Screen Shot 2013-10-04 at 10.10.47 AM

    That’s it for now. In my next post I’ll show you how to delete a table from your Windows Azure Mobile Service using the 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.

    bash-azure

    In my previous post (http://thinkfirstcodelater.com/blog/?p=3283) I showed you how to list the tables associated with your Windows Azure Mobile Service. In this post I’ll show you how to view the details for a single table in your 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.

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

    azure mobile table show -h

    Screen Shot 2013-10-04 at 9.37.50 AM

    As you can see the mobile table show command shows the details for a mobile service table. To use the command you need to specify two parameters:

    1. The name of your mobile service
    2. The name of the table

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

    azure mobile table show ‘[YOUR MOBILE SERVICE NAME]‘ ‘[YOUR TABLE NAME]‘

    In my case I entered the following:

    azure mobile table show ‘zumo-00005′ ‘GenreMovie’

    Screen Shot 2013-10-04 at 9.41.40 AM

    The detailed information returned for the table includes:

    • The table’s statistics, including number of records in the table.
    • The table’s operations. This shows each CRUD operation (insert, read, update, delete) the permission associated with the operation, and whether or not a custom script has been defined for the operation.
    • The table’s columns. For each column in the table, your are given the name, data type, and whether or not the column is indexed.

    That’s it for now. In the next post I’ll show you how to update a table in your Windows Azure Mobile Service.

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

    bash-azure

    In my previous two posts I showed you how to use the Windows Azure cross platform command line tools to:

    In this post I’ll show you how to list the tables associated with your 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.

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

    azure mobile table list -h

    Screen Shot 2013-10-04 at 9.19.06 AM

    As you can see, this is a very straightforward command to use. All you need to do is provide the name of the Windows Azure Mobile Service you want to list tables for.

    Next, entering the following into your CLI, substituting where appropriate:

    azure mobile table list ‘[YOUR MOBILE SERVICE NAME]‘

    In my case I entered the following:

    azure mobile table list ‘zumo-00005′

    Screen Shot 2013-10-04 at 9.23.09 AM

    Assuming your mobile service has some tables in it, you’ll see a list of your tables that includes the name of each table and the number of indexes and rows each table contains.

    That’ it for now. In my next post I’ll show you how to get detailed information for a specific table in your Windows Azure Mobile Service.

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

    bash-azure

    In my previous post (http://thinkfirstcodelater.com/blog/?p=3261) I showed you how to create a table in a SQL database for a Windows Azure Mobile Service using the cross platform command line tools. In this post I’ll show you how to create a table and assign operation specific permissions.

    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.

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

    azure mobile table create -h

    Screen Shot 2013-09-22 at 4.58.10 PM

    This should look familiar as its the same command we used in the previous post to create a table. In this exercise we’re going to take a look at the -p or –permissions option. This option allows you to assign operation specific permissions to a table. To assign a permission you simply need to provide the name of the operation along with permission. The available operations are:

    • insert
    • read
    • update
    • delete

    The available permissions are:

    • user: Only authenticated users are permitted access to the requested resources. Server-side code can be used to further restrict access to tables based on an authenticated user.
    • public: Any request is accepted. This option leaves the specific resource wide-open for everyone to access.
    • application: The application key is required to access the requested resource.
    • admin: The service master key is required to access the requested resources. This limits access to code running on the service and administrator accounts, which includes the Windows Azure management portal.

    When you create a table and do not specify permissions, the application permission is applies to all operations. It is important to note that the operation and permission names are case sensitive.

    For this exercise, we’re going to create a new table named “BlogPost” and assign the following permissions to it:

    • Anyone can read data from the table.
    • Only authenticated users can insert and update data in the table.
    • Only administrators can delete data from the table.

    Enter the following into your CLI, substituting where appropriate:

    azure mobile table create -p “insert=user,update=user,delete=admin,read=public” “[YOUR WINDOWS AZURE MOBILE SERVICE]” “BlogPost”

    In my case I entered the following:

    azure mobile table create -p “insert=user,update=user,delete=admin,read=public” “zumo101″ “BlogPost”

    Screen Shot 2013-09-22 at 5.16.09 PM

    Once the command completes you can verify the permissions by doing the following:

    1. Open your Internet browser and navigate to the Windows Azure management portal (https://manage.windowsazure.com).
    2. Navigate to your Mobile Service’s dashboard.
    3. Click the DATA link.
    4. Click the BlogPost link to get to the table you just created.
    5. Click the PERMISSIONS link.

    Screen Shot 2013-09-22 at 5.21.09 PM

    That’s it. In the next post I’ll show you how to list the SQL database tables associated with a Windows Azure Mobile Service.

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

    bash-azure

    In my previous two posts I showed you how to:

    1. View a list of preview features available to a Windows Azure Mobile Service( http://thinkfirstcodelater.com/blog/?p=3242)
    2. Enable a preview feature for a Windows Azure Mobile Service(http://thinkfirstcodelater.com/blog/?p=3242)

    In this post I’m going to start showing you how to work with data by creating a table in a SQL database using the Windows Azure cross platform command line tools.

    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.

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

    azure mobile table create -h

    Screen Shot 2013-09-21 at 3.26.48 PM

    The azure mobile table create command will create a table in the SQL database associated with the Windows Azure Mobile Service. There are only two required parameters:

    1. [servicename] – the name of the service you want to create the table for
    2. [tablename] – the name of the table to create

    An additional option (-p or –permissions) allows you to set granular level permissions for the table. We’ll look at this option in the next post.

    Enter the following into your CLI to create a table named “ToDoItem”, substituting where applicable:

    azure mobile table create “[YOUR MOBILE SERVICE NAME]” “ToDoItem”

    In my case I entered the following:

    azure mobile table create “zumo101″ “ToDoItem”

    Screen Shot 2013-09-21 at 3.35.12 PM

    To verify the table has been created, go to the Windows Azure management portal by opening your Internet browser and navigating to https://manage.windowsazure.com” and sign in. Once signed in, go to the Mobile Services portion of the Windows Azure management, click on your Mobile Service, then click on the Datalink. The ToDoItem should display in the list of tables.

    Screen Shot 2013-09-21 at 3.36.50 PM

    If you click on the ToDoItem table, then click the Permissions link you’ll see that all operations are restricted to only those users with the application key.

    Screen Shot 2013-09-21 at 3.41.06 PM

    In the next post I’ll show you how to create a table and specify different permissions for different operations.

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

    bash-azure

    In my previous post (http://thinkfirstcodelater.com/blog/?p=3242) I showed you how to view the list of preview features available to a Windows Azure Mobile Service. In this post I’ll show you how to enable a preview feature.

    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.

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

    azure mobile preview enable -h

    Screen Shot 2013-09-21 at 2.56.24 PM

    In order to enable a preview feature you need to provide two parameters:

    1. The name of the service you want to enable the feature for
    2. The name of the preview feature you want to enable

    At the time of this writing the only preview feature available is SourceControl. This feature allows you to use the popular distributed version control system Git to manage source code for your Windows Azure Mobile Service. Enter the following into your CLI, substituting where appropriate:

    azure mobile preview enable “[YOUR WINDOWS AZURE MOBILE SERVICE]” “SourceControl”

    In my case I entered the following:

    azure mobile preview enable “zumo101″ “SourceControl”

    Screen Shot 2013-09-21 at 3.04.25 PM

    Of particular importance is the data.repository value that is returned. This allows you to clone the Git repository to your local machine.

    You can verify the feature is enabled by entering the following command into your CLI:

    azure mobile preview list “[YOUR MOBILE SERVICE NAME]“

    In my case I entered the following:

    azure mobile preview list “zumo101″

    Screen Shot 2013-09-21 at 3.08.10 PM

    As you can see from the results the SourceControl preview feature has been enabled.

    That’s it for now. In the next post I’ll show you how to start working with data by creating a table.

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