Connecting to Microsoft Azure Mobile Services (XAML)

[This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation]

What is Mobile Services?

Azure Mobile Services is a Azure service offering designed to make it easy to create highly-functional mobile apps using Azure. Mobile Services brings together a set of Azure services that enable backend capabilities for your app. Integration with Microsoft Visual Studio 2013 makes it easy to connect to Mobile Services without having to log into the Azure Management Portal.

Mobile Services enables the following scenarios in your app:

Scenario Description
Connect to Microsoft Azure

By connecting your app to Mobile Services, you leverage all the benefits of Azure services. You can connect your app right from Visual Studio 2013.

Provision and manage storage tables

Visual Studio 2013 makes it easy to create new tables in your mobile service, right from your Server Explorer. Mobile Services allows you to control who can perform operations against tables.

Easy access from your app

The Mobile Services client library makes it easy to access and change data as objects, authenticate users, and call custom APIs from an app written in C#/Visual Basic.

Send push notifications

Mobile Services integrates with Windows Push Notification Services (WNS) to make it easy to deliver push notifications to your app.

Authenticate users

Mobile Services integrates with well-known identity providers, such as Twitter, Facebook, Google and Microsoft Account. This make it easy for your users to log in using their existing accounts.

Single-sign on with Live Connect

You can use Live Connect to authenticate an already logged-on user with you mobile service without having them retype their credentials.

Send Periodic notifications

Define a custom API that lets you leverage your mobile service to support updating tiles and badges using periodic notifications.

Offload processing to the cloud

Store and execute server-side scripts to inject business logic into data access operations. These scripts can perform data validation and modification, send HTTP requests, send notifications, access Azure SQL Database, authorize user access and other backend tasks.

Schedule remote code execution

Mobile Services has a job scheduler that lets you define a schedule for executing server-side scripts.

Leverage Microsoft Azure services

Server scripts enable integration with other Microsoft Azure services.

 

Developer audience

Developers using VB/C# and XAML who want to use Mobile Services to add cloud data storage, authentication, push notifications, or other Azure functionality to their app.

In this section

Topic Description

Quickstart: Add a mobile service (.NET backend)

This Quickstart walks you through adding a cloud-based backend service to an existing app using Mobile Services. Mobile Services makes it easy to store and query for data, login users with popular identity providers, and send and receive push notifications in your app. To learn more, see the Mobile Services dev center. When you are done, you will have created a new mobile service in your Azure subscription, added Mobile Services code to the starter app project, and run the app to insert data into the new mobile service.

Quickstart: Add a mobile service to a universal app

This Quickstart walks you through adding a cloud-based backend service to an existing Universal Windows app using Mobile Services. Mobile Services makes it easy to store and query for data, login users with popular identity providers, and send and receive push notifications in your app. To learn more, see the Mobile Services Dev Center. When you are done, you will have created a new mobile service in your Azure subscription, added Mobile Services code to the starter app project, and run the app to insert data into the new mobile service.

How to use controllers to access data (.NET backend)

To store and work with data in .NET mobile services, you create a data object that has the fields you want, and then you create a table controller which provides the interface for clients to work with that data. A table controller is a class in a .NET mobile services project that exposes basic data operations as HTTP methods. The HTTP interface is the same as a Web API controller, with HTTP methods for all the basic operations. By following the procedures in this topic, you create a data object and a table controller for clients who use your mobile service to create, read, update, and delete data. You don't have to write the Web API controller code, since Visual Studio has templates that provide default implementations for the most common operations. This default code is a scaffold, meaning that it provides a simple implementation, which you can then modify as needed for your scenario.

How to create custom APIs and scheduled jobs (.NET backend)

A custom API in a mobile service is a function that your client apps can call. See Custom API. When you work with mobile services in Visual Studio, you can add a custom API and edit it in Visual Studio. A custom API is created as an HTTP endpoint in the form of a REST API. Examples of using custom APIs are to return data from a query, and to make updates to a database that require more processing than is possible in a simple update script, or involve more than one data table.

Quickstart: Add push notifications (.NET backend)

This Quickstart walks you through enabling push notifications in a Windows Store app using Mobile Services. Mobile Services makes it easy to send push notifications to your app by using the Windows Push Notification Services (WNS). To learn more, see the Mobile Services dev center. Visual Studio 2013 makes it easy to enable push notifications in your Mobile Services app. This topic builds on the previous topic Quickstart: Adding a mobile service. When you are done, you will have added push notifications to your new mobile service and tested the app by sending a new notification.

How to send push notifications from Visual Studio

When you develop or test apps that use push notifications, you might want to send a notification to your app without having to modify your mobile service code. Visual Studio provides a convenient way to do this through Server Explorer.

How to browse device registrations for notification hubs

You can view the client devices that are registered for your notification hubs by using Server Explorer in Visual Studio. You can browse all registrations, view the tags they are registered for, delete registrations, or edit the tags. The ability to browse registrations is an important part of debugging notifications during the development phase of an app that uses mobile services. It can also be useful for a published mobile service when investigating potential problems with notifications.

Quickstart: Add a mobile service (C++)

This Quickstart shows how to use Mobile Services to add a cloud-based back-end service to an existing Windows Store app that's written in C++. Mobile Services makes it easy to store and query for data, log users in with popular identity providers, and send and receive push notifications in your app. To learn more, see the Mobile Services dev center. When you're done, you will have created a mobile service in your Azure subscription, added Mobile Services code to the starter app project, and run the app to insert data into the new mobile service.

User authentication for C++ apps

Mobile Services enables users to log in by using their credentials not only from a Microsoft account, but also from Facebook, Twitter and Google. This article shows how to support authentication by Google in a Windows store app using C++ and XAML. The steps are essentially the same for all of the supported identity providers.

Quickstart: Add a mobile service (JavaScript backend)

This Quickstart walks you through adding a cloud-based backend service to an existing app using Mobile Services. Mobile Services makes it easy to store and query for data, login users with popular identity providers, and send and receive push notifications in your app. To learn more, see the Mobile Services dev center. When you are done, you will have created a new mobile service in your Azure subscription, added Mobile Services code to the starter app project, and run the app to insert data into the new mobile service.

Quickstart: Add push notifications (JavaScript backend)

This Quickstart walks you through enabling push notifications in a Windows Store app using Mobile Services. Mobile Services makes it easy to send push notifications to your app by using the WNS. To learn more, see the Mobile Services dev center. Visual Studio 2013 makes it easy to enable push notifications in your Mobile Services app. This topic builds on the previous topic Quickstart: Adding a mobile service (for C++, Quickstart: Adding a mobile service using C++). When you are done, you will have added push notifications to your new mobile service and tested the app by sending a new notification.

Quickstart: Working with mobile services in Visual Studio (JavaScript backend)

You can more easily build connected Windows Store and Windows Phone apps by using tools for tMobile Services in Visual Studio 2013. For example, you can use Visual Studio tools to connect to a mobile service, edit the scripts for your mobile services that customize their behavior, and add push notifications to your app.

In this quickstart, you'll create a sample app that's named Photo Liker. In this app, users can like a photo and receive a push notification whenever another user likes a photo that they uploaded.

This topic shows how to work with mobile services with a JavaScript backend. If you want to create a mobile service with a .NET backend, see Quickstart: Add a mobile service (.NET backend) and related topics.

Quickstart: Creating a connected app with mobile services

By starting with the sample that this topic describes, you can create any turn-based game that users play over a network. The TicTacToe sample is a simple Windows Store app that multiple users can play on various devices that are running Windows 8.1. The app stores game state by using mobile services and communicates updates by using push notifications.

How to use scripts to access data (JavaScript backend)

If you create a Azure mobile service that's associated with a Azure SQL database and then create data tables in that database, you can access the data in those tables from any device that can access your service. You can also customize the behavior of your service by editing the server scripts that run when you interact with your data tables. The scripts are associated with events on your mobile service's data tables. For example, you can send messages called push notifications from your mobile service to your client app when data changes.

How to create custom APIs (JavaScript backend)

A custom API in a mobile service is a function that your client apps can call. When you work with mobile services in Visual Studio, you can add a custom API by using the mobile service's node in Server Explorer, and edit the API in Visual Studio. A custom API is created as an HTTP endpoint in the form of a REST API. For example, you can use custom APIs to return data from a query, and to make updates to a database that require more processing than is possible in a simple update script, or involve more than one data table.