Skip to content
Browse files

New mobile CLI topic ready for initial review

  • Loading branch information...
1 parent d7ebd1f commit 1968c0df27861d8b761ebeac42a0cb4fbc44f65f @ggailey777 ggailey777 committed Jan 4, 2013
View
84 DevCenter/Mobile/Tutorials/mobile-services-command-prompt-administration.md
@@ -9,27 +9,22 @@ This topic shows you how to use use the Windows Azure command-line tools to auto
- [Create a new mobile service]
- [Create a new table]
- [Register a script to a table operation][Register a new table script]
-- Get the site master key
-- Run a simple client test that verifies the property was added. We will need they key that we fetched in step 4 to be able to write this script. As we had talked, probably curl the URL and check the status code and/or compare the payload to make sure the calculated property was added as expected.
+- [Delete an existing table]
- [Delete an existing mobile service]
When combined into a single script or batch file, these individual commands automate the creation, verfication, and deletion process of a mobile service.
-This topic covers a selection of common administration tasks supported by the Windows Azure command-line tools. For more information, see [Windows Azure command-line tools documentation][reference-docs].
-
-## Prerequisites
+To use the Windows Azure command-line tools to manage Mobile Services, you need a Windows Azure account that has the Windows Azure Mobile Services feature enabled.
-The following are required to complete the tasks in this tutorial:
-
-+ To use the Windows Azure command-line tools to manage Mobile Services, you need a Windows Azure account that has the Windows Azure Mobile Services feature enabled.
++ If you don't have an account, you can create a free trial account in just a couple of minutes. For details, see <a href="http://www.windowsazure.com/en-us/pricing/free-trial/?WT.mc_id=A0E0E5C02" target="_blank">Windows Azure Free Trial</a>.
- + If you don't have an account, you can create a free trial account in just a couple of minutes. For details, see <a href="http://www.windowsazure.com/en-us/pricing/free-trial/?WT.mc_id=A0E0E5C02" target="_blank">Windows Azure Free Trial</a>.
++ If you have an existing account but need to enable the Windows Azure Mobile Services preview, see <a href="../create-a-windows-azure-account/#enable" target="_blank">Enable Windows Azure preview features</a>.
- + If you have an existing account but need to enable the Windows Azure Mobile Services preview, see <a href="../create-a-windows-azure-account/#enable" target="_blank">Enable Windows Azure preview features</a>.
+This topic covers a selection of common administration tasks supported by the Windows Azure command-line tools. For more information, see [Windows Azure command-line tools documentation][reference-docs].
-+ You must download and install the Windows Azure command-line tools to your local machine. To do this, follow the instructions in the first section of this topic.
+<!--+ You must download and install the Windows Azure command-line tools to your local machine. To do this, follow the instructions in the first section of this topic.
-+ (Optional) To be able to execute HTTP requests directly from the command-line, you must use cURL or an equivalent tool. cURL runs on a variety of platforms. Locate and install cURL for your specific platform from the <a href=http://go.microsoft.com/fwlink/p/?LinkId=275676 target="_blank">cURL download page</a>.
++ (Optional) To be able to execute HTTP requests directly from the command-line, you must use cURL or an equivalent tool. cURL runs on a variety of platforms. Locate and install cURL for your specific platform from the <a href=http://go.microsoft.com/fwlink/p/?LinkId=275676 target="_blank">cURL download page</a>.-->
<h2><a name="install"></a><span class="short-header">Install the tools</span>Install the Windows Azure Command-Line Tools</h2>
@@ -82,35 +77,85 @@ After importing your publish settings, you should delete the `.publishsettings`
You are now ready to begin creating and managing Windows Azure Mobile Services from the command line or in batch files.
-<h2><a name="create-service"></a><span class="short-header">Create service</span>Create a new mobile service</h2>
+<h2><a name="create-service"></a><span class="short-header">Create service</span>How to create a new mobile service</h2>
You can use the command-line tools to create a new mobile service instance. While creating the mobile service, you also create a new database instance in a new SQL Database server.
-To create a new mobile service instance in your subscription, run the following command, where `<service-name>` is the name of the new mobile service, `<server-admin>` is the login name of the new server, `<server-password>` is the password for the new login:
+The following command creates a new mobile service instance in your subscription, where `<service-name>` is the name of the new mobile service, `<server-admin>` is the login name of the new server, and `<server-password>` is the password for the new login:
azure mobile create <service-name> <server-admin> <server-password>
<div class="dev-callout"><strong>Security Note</strong>
<p><code>&lt;server-admin&gt;</code> and <code>&lt;server-password&gt;</code> are important security credentials. Because of this, we recommend that you take additional steps to encrypt any file or folder where these credentials are persisted. When you do not supply values for <code>&lt;server-admin&gt;</code> and <code>&lt;server-password&gt;</code> in the <code>mobile create</code> command, you are prompted to supply the values during execution.</p>
</div>
-<h2><a name="delete-service"></a><span class="short-header">Delete service</span>Delete an existing mobile service</h2>
+The `mobile create` command fails when the specified mobile service already exists. In your automation scripts, you may want to attempt to delete a mobile service before attempting to recreate it.
-The `mobile create` command fails when the specified mobile service already exists. Because of this, you may want to attempt to delete the mobile service before attempting to recreate it from an automation script. You can use the command-line tools to delete an existing mobile service, along with the related SQL Database and database server.
+<h2><a name="delete-service"></a><span class="short-header">Delete service</span>How to delete an existing mobile service</h2>
-The following command deletes the mobile service, where `<service-name>` is the name of the mobile service to delete:
+You can use the command-line tools to delete an existing mobile service, along with the related SQL Database and server. The following command deletes the mobile service, where `<service-name>` is the name of the mobile service to delete:
azure mobile delete <service-name> -a -q
-This command also deletes the SQL Database and server used by the mobile service.
+By including `-a` and `-q` parameters, this command also deletes the SQL Database and server used by the mobile service without displaying a prompt.
<div class="dev-callout"><strong>Note</strong>
<p>If you do not specify the <code>-q</code> parameter along with <code>-a</code> or <code>-d</code>, execution is paused and you are prompted to select delete options for your SQL Database. Only use the <code>-a</code> parameter when no other service using the database or server; otherwise use the <code>-d</code> parameter to only delete data that belongs to the mobile service being deleted.</p>
</div>
+<h2><a name="create-table"></a><span class="short-header">Create table</span>How to create a new table in the mobile service</h2>
+
+The following command creates a new table in the specified mobile service, where `<service-name>` is the name of the mobile service and `<table-name>` is the name of the table to create:
+
+ mobile table create <service-name> <table-name>
+
+This creates a new table with the default permissions, `application`, for the table operations: `insert`, `read`, `update`, and `delete`. The following command creates a new table with `read` permission set to public and `delete` permission set to only adminstrators:
+
+ mobile table create <service-name> <table-name> -p read=public,delete=admin
+
+The following table shows the script permission value compared to the permission value in the [Windows Azure Management Portal].
+
+<table border="1" width="100%"><tr><th>Script value</th><th>Management Portal value</th></tr>
+<tr><td><code>public</code></td><td>Everyone</td></tr>
+<tr><td><code>application</code> (default)</td><td>Anybody with the application key</td></tr>
+<tr><td><code>user</code></td><td>Only authenticated users</td></tr>
+<tr><td><code>admin </code></td><td>Only scripts and admins</td></tr></table>
+
+The `mobile table create` command fails when the specified table already exists. In your automation scripts, you may want to attempt to delete a table before attempting to recreate it.
+
+<h2><a name="delete-table"></a><span class="short-header">Delete table</span>How to delete an existing table from the mobile service</h2>
+
+The following command deletes a table from the mobile service, where `<service-name>` is the name of the mobile service and `<table-name>` is the name of the table to delete:
+
+ azure mobile table delete <service-name> <table-name> -q
+
+In automation scripts, use the `-q` parameter to delete the table without displaying a confirmation prompt that blocks execution.
+
+<h2><a name="register-script"></a><span class="short-header">Register a script</span>How to register a script to a table operation</h2>
+
+Mobile Services enables you to register a JavaScript function to a given table operation, where the script is run when the table operation occurs. The following command uploads and registers a function to an operation on a table, where `<service-name>` is the name of the mobile service, `<table-name>` is the name of the table, and `<operation>` is the table operation, which can be `read`, `insert`, `update`, or `delete`:
+
+ azure mobile script upload <service-name> table/<table-name>.<operation>.js
+
+Note that this operation uploads a JavaScript (.js) file from the local computer. The name of the file must be composed from the table and operation names, and it must be located in the `table` subfolder relative to the location where the command is executed. For example, the following operation uploads and registers a new `insert` script that belongs to the `TodoItems` table:
+
+ azure mobile script upload todolist table/todoitems.insert.js
+
+The function declaration in the script file must also match the registered table operation. This means that from the above example, the uploaded script contains a function with the following signature:
+
+ function insert(item, user, request) {
+ ...
+ }
+
+For more information about registering scripts, see [Mobile Services server script reference].
+
+<!--<h2><a name="test-service"></a><span class="short-header">Test the service</span>Test the new mobile service</h2>
+
+When you are automating the creation of your mobile service, you can optionally use cURL or another command-line request generator to
+
## <a name="nextsteps"> </a>Next Steps
Next steps here....
-
+-->
<!-- Anchors. -->
[Download and install the command-line tools]: #install
[Download and import publish settings]: #import
@@ -120,6 +165,7 @@ Next steps here....
[Register a new table script]: #register-script
[Delete an existing table]: #delete-table
[Delete an existing mobile service]: #delete-service
+[Test the mobile service]: #test-service
[Next steps]: #next-steps
<!-- Images. -->
View
26 Shared/Chunks/win-az-command-line-tools.md
@@ -1,5 +1,5 @@
#Windows Azure command-line tool for Mac and Linux
-This tool provides functionality for creating, deploying, and managing virtual machines and websites from Mac and Linux desktops. This functionality is similar to that provided by the Windows PowerShell cmdlets that are installed with the Windows Azure SDKs for .NET, Node.JS, and PHP.
+This tool provides functionality for creating, deploying, and managing virtual machines, websites and Windows Azure Mobile Services from Mac and Linux desktops. This functionality is similar to that provided by the Windows PowerShell cmdlets that are installed with the Windows Azure SDKs for .NET, Node.JS, and PHP.
To install the tool on a Mac, download and run the [Windows Azure SDK installer](http://go.microsoft.com/fwlink/?LinkId=252249).
@@ -21,6 +21,7 @@ In addition to command-specific optional parameters documented here, there are t
* [Commands to manage your Windows Azure cloud services](#Commands_to_manage_your_Azure_cloud_services)
* [Commands to manage your Windows Azure certificates](#Commands_to_manage_your_Azure_certificates)
* [Commands to manage your websites](#Commands_to_manage_your_web_sites)
+* [Commands to manage Windows Azure Mobile Services](#Commands_to_manage_mobile_services)
* [Manage tool local settings](#Manage_tool_local_settings)
##<a id="Manage_your_account_information_and_publish_settings"></a>Manage your account information and publish settings
@@ -591,6 +592,29 @@ This command stops a website.
info: Site mysite has been stopped
info: site stop command OK
+<span id="Commands_to_manage_mobile_services"></span>
+##Commands to manage Windows Azure Mobile Services
+
+Windows Azure Mobile Services
+
+###Commands to manage mobile services
+
+###Commands to manage configuration
+
+###Commands to manage logs
+
+###Commands to manage keys
+
+###Commands to manage tables
+
+<table border="1" width="100%"><tr><th>Script value</th><th>Management Portal value</th></tr>
+<tr><td><code>public</code></td><td>Everyone</td></tr>
+<tr><td><code>application</code> (default)</td><td>Anybody with the application key</td></tr>
+<tr><td><code>user</code></td><td>Only authenticated users</td></tr>
+<tr><td><code>admin </code></td><td>Only scripts and admins</td></tr></table>
+
+###Commands to manage table scripts
+
<span id="Manage_tool_local_settings"></span>
##Manage tool local settings
Local settings are your subscription ID and Default Storage Account Name.

0 comments on commit 1968c0d

Please sign in to comment.
Something went wrong with that request. Please try again.