Get started with Mobile Services
This tutorial shows you how to add a cloud-based backend service to a Windows Phone 8 app using Azure Mobile Services. In this tutorial, you will create both a new mobile service and a simple To do list app that stores app data in the new mobile service.
If you prefer to watch a video, the clip to the right follows the same steps as this tutorial. In the video, Nick Harris provides an introduction to Mobile Services and walks through creating your first mobile service and connecting to it from a Windows Store app.
A screenshot from the completed app is below:
To complete this tutorial, you need an Azure account. If you don't have an account, you can sign up for an Azure trial and get up to 10 free mobile services that you can keep using even after your trial ends. For details, see Azure Free Trial. To create a new Windows Phone 8.1 app, you must have Visual Studio 2013 Update 2, or a later version.
Create a new mobile service
Follow these steps to create a new mobile service.
Log into the Management Portal.
At the bottom of the navigation pane, click +NEW.
Expand Compute and Mobile Service, then click Create.
This displays the New Mobile Service dialog.
In the Create a mobile service page, select Create a free 20 MB SQL Database, select Node.js runtime, then type a subdomain name for the new mobile service in the URL textbox and wait for name verification. Once name verification completes, click the right arrow button to go to the next page.
This displays the Specify database settings page.
As part of this tutorial, you create a new SQL Database instance and server. You can reuse this new database and administer it as you would any other SQL Database instance. If you already have a database in the same region as the new mobile service, you can instead choose Use existing Database and then select that database. The use of a database in a different region is not recommended because of additional bandwidth costs and higher latencies.
In Name, type the name of the new database, then type Login name, which is the administrator login name for the new SQL Database server, type and confirm the password, and click the check button to complete the process.
When the password that you supply does not meet the minimum requirements or when there is a mismatch, a warning is displayed.
We recommend that you make a note of the administrator login name and password that you specify; you will need this information to reuse the SQL Database instance or the server in the future.
You have now created a new mobile service that can be used by your mobile apps.
Create a new Windows Phone app
Once you have created your mobile service, you can follow an easy quickstart in the Management Portal to either create a new app or modify an existing app to connect to your mobile service.
In this section you will create a new Windows Phone 8 app that is connected to your mobile service.
In the Management Portal, click Mobile Services, and then click the mobile service that you just created.
In the quickstart tab, click Windows Phone 8 under Choose platform and expand Create a new Windows Phone 8 app.
This displays the three easy steps to create a Windows Phone app connected to your mobile service.
If you haven't already done so, download and install Visual Studio 2012 Express for Windows Phone on your local computer.
To create a Windows Phone 8.1 app, you must have Visual Studio 2013 Update 2 installed.
Click Create TodoItem table to create a table to store app data.
Under Download and run app, click Download.
This downloads the project for the sample To do list application that is connected to your mobile service. Save the compressed project file to your local computer, and make a note of where you save it.
Run your Windows Phone app
The final stage of this tutorial is to build and run your new app.
Browse to the location where you saved the compressed project files, expand the files on your computer, and open the solution file in Visual Studio.
(Optional) If you are creating a Windows Phone 8.1 app, right-click the project in Solution Explorer, click Properties, set Target Windows Phone OS Version to Windows Phone 8.1, then click Yes to upgrade the project.
Press the F5 key to rebuild the project and start the app.
In the app, type meaningful text, such as Complete the tutorial and then click Save.
This sends a POST request to the new mobile service hosted in Azure. Data from the request is inserted into the TodoItem table. Items stored in the table are returned by the mobile service, and the data is displayed in the list.
You can review the code that accesses your mobile service to query and insert data, which is found in the MainPage.xaml.cs file.
Back in the Management Portal, click the Data tab and then click the TodoItems table.
This lets you browse the data inserted by the app into the table.
Now that you have completed the quickstart, learn how to perform additional important tasks in Mobile Services: