This tutorial shows you how to add a cloud-based backend service to a universal Windows app using Azure Mobile Services. Universal Windows app solutions include projects for both Windows Store 8.1 and Windows Phone Store 8.1 apps and a common shared project. For more information, see Build universal Windows apps that target Windows and Windows Phone.
This topic shows you how to create a new mobile service project and universal Windows app by using the Azure Management Portal. By using Visual Studio 2013, you can also add a new mobile service project to an existing Visual Studio solution. For more information, see Add Mobile Services to an existing app.
To add a mobile service to an Windows Phone 8.0 or Windows Phone Store 8.1 app project, see Add Mobile Services to an existing Windows Phone app.
The following are screen captures from the completed app:
Windows Store app
Windows Phone Store app
Completing this tutorial is a prerequisite for all other Mobile Services tutorials for Windows Store and Windows Phone Store apps.
To complete this tutorial, you need the following:
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 Create a Mobile Service dialog.
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.
You have now created a new mobile service that can be used by your mobile apps.
Once you have created your mobile service, you can follow an easy quickstart in the Management Portal to either create a new universal Windows app or modify an existing Windows Store or Windows Phone app project to connect to your mobile service.
In this section you will create a new universal Windows 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 under Choose platform and expand Create a new Windows Store app.
This displays the three easy steps to create a Windows Store app connected to your mobile service.
If you haven't already done so, download and install Visual Studio 2013 Express for Windows on your local computer or virtual machine.
Click Create TodoItem table to create a table to store app data.
Under Download and run your app, select a language for your app, then 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.
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.
Press the F5 key to rebuild the project and start the app.
In the app, type meaningful text, such as Complete the tutorial, in Insert a TodoItem, 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 second column in the app.
(Optional) In a universal Windows solution, change the default start up project to the other app and run the app again.
Notice that data saved from the previous step is loaded from the mobile service after the app starts.
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.
You can review the code that accesses your mobile service to query and insert data, which is found in the MainPage.xaml.cs file.
Now that you have completed the quickstart, learn how to perform additional important tasks in Mobile Services:
Add Mobile Services to an existing app
Learn more about storing and querying data using Mobile Services.
Get started with offline data sync
Learn how to use offline data sync to make your app responsive and robust.
Add authentication to your Mobile Services app
Learn how to authenticate users of your app with an identity provider.
Add push notifications to your app
Learn how to send a very basic push notification to your app.
For more information about universal Windows apps, see Supporting multiple device platforms from a single mobile service.