Windows Azure platform overview for Windows Phone
[This documentation is preliminary and is subject to change.]
June 28, 2012
Applies to: Windows Phone 8 Developer Preview | Windows Phone OS 7.1
The Windows Azure platform is an Internet-scale cloud services platform hosted through Microsoft data centers. It provides highly scalable processing and storage capabilities, a relational database service, and premium data subscriptions that you can use to build compelling Windows Phone applications.
See the Windows Azure Toolkit for Windows Phone for additional resources for building mobile applications that use cloud services running in Windows Azure. The toolkit includes Visual Studio project templates for Windows Phone and Windows Azure, class libraries optimized for use on the device, sample applications, and documentation.
This topic provides an overview of the Windows Azure platform features that you can use with the Windows Phone application platform. For information about how to use the Windows Azure platform, see Overview of Creating a Hosted Service for Windows Azure. For information about using web services with your Windows Phone applications, see Communications for Windows Phone.
This topic contains the following sections.
A hosted service in Windows Azure is a runtime execution environment for managed and native code. An application built on a hosted service is structured as one or more roles. When it executes, the application typically runs two or more instances of each role, with each instance running as its own virtual machine (VM).
You can use Windows Azure roles to offload work from your Windows Phone applications and perform tasks that are difficult or not possible with the Windows Phone application platform. For example, a web role could directly query a SQL Azure relational database and expose the data via a Windows Communication Foundation (WCF) service. For more information about writing Windows Phone applications that consume web services, see Communications for Windows Phone.
There are several benefits to using a Windows Azure hosted service in conjunction with your Windows Phone application:
Programming options: When writing managed code for a Windows Azure role, developers can use many of the .NET Framework 4 libraries common to server and desktop applications. Although a substantial number of Silverlight and XNA Framework components are available for developing a Windows Phone application, there are limits to what can be done with those components.
Availability: Windows Azure roles run in a highly available Internet-scale hosting environment built on geographically distributed data centers. Considering that the phone can be turned off, a Windows Azure role may be a better choice for long-running tasks or code that needs to be running all the time.
Processing capabilities: The processing capabilities of a Windows Azure role can scale elastically across servers to meet increasing or decreasing demand. In contrast, on a Windows Phone, a single processor with finite capabilities is shared by all applications on the phone.
A Windows Azure web role can provide Windows Phone applications access to data by hosting multiple web services including Windows Communication Foundation (WCF) services and WCF data services. WCF is a part of the .NET Framework that provides a unified programming model for rapidly building service-oriented applications. WCF Data Services enables the creation and consumption of Open Data Protocol (OData) services from the Web (formerly known as ADO.NET Data Services). For more information, see the WCF Developer Center and the WCF Data Services Developer Center.
Storage resources on the phone are limited. To optimize the user experience, Windows Phone applications should minimize the use of isolated storage and store only what is necessary for subsequent launches of the application. One way to minimize the use of isolated storage is to use Windows Azure storage services instead. For more information about isolated storage best practices, see Isolated storage best practices for Windows Phone.
The Windows Azure storage services provide persistent, durable storage in the cloud. As with the Windows Azure Compute service, Windows Azure storage services can scale elastically to meet increasing or decreasing demand. There are three types of storage services available:
Blob service: Use this service for storing files, such as binary and text data. For more information, see Blob Service Concepts.
Queue service: Use this service for storing and delivering messages that may be accessed by another client (another Windows Phone application or any other application that can access the Queue service). For more information, see Queue Service Concepts.
Table service: Use this service for structured storage of non-relational data. A Table is a set of entities, which contain a set of properties. For more information, see Table Service Concepts.
For examples showing how to use these services with your Windows Phone application, see the Windows Azure Toolkit for Windows Phone on CodePlex.
To access Windows Azure storage services, you must have a storage account, which is provided through the Windows Azure Platform Management Portal. For more information, see How to Create a Storage Account.
We do not recommend that Windows Phone applications store the storage account credentials on the phone. Rather than accessing the Windows Azure storage services directly, we recommend that Windows Phone applications use a web service to store and retrieve data. The exception to this recommendation is for public blob data that is intended for anonymous access. For more information about using Windows Azure storage services, see Storing Data in the Windows Azure Platform for Windows Phone.
Microsoft SQL Azure Database is a cloud-based relational database service built on SQL Server technologies. It is a highly available, scalable, multi-tenant database service hosted by Microsoft in the cloud. SQL Azure Database helps to ease provisioning and deployment of multiple databases. Developers do not have to install, set up, update, or manage any software. High availability and fault tolerance are built-in and no physical administration is required.
Similar to an on-premise instance of SQL Server, SQL Azure exposes a tabular data stream (TDS) interface for Transact-SQL-based database access. Because the Windows Phone application platform does not support the TDS protocol, a Windows Phone application must use a web service to store and retrieve data in a SQL Azure database.
SQL Azure enables a familiar development environment. Developers can connect to SQL Azure with SQL Server Management Studio and create database tables, indexes, views, stored procedures, and triggers. For more information about SQL Azure, see SQL Azure Database Concepts.
Windows Azure Marketplace DataMarket is an information marketplace that simplifies publishing and consuming data of all types. The DataMarket enables developers to discover, preview, purchase, and manage premium data subscriptions. For more information, see the Windows Azure Marketplace DataMarket home page.
The DataMarket exposes data using OData feeds. OData is a web protocol for querying and updating data. The DataMarket OData feeds provide a consistent Representational State Transfer (REST)-based API across all datasets to help simplify development. Because DataMarket feeds are based on OData, your Windows Phone application can consume them with the OData Client Library for Windows Phone. For more information, see How to consume an OData service for Windows Phone.
There are two types of DataMarket datasets: those that support flexible queries and those that support fixed queries. Flexible query datasets support a wider range of REST-based queries. Fixed query datasets support only a fixed number of queries and supply a C# client library to help client applications work with data. For more information about these query types, see Fixed and Flexible Query Types.