Microsoft & .NETUsing Windows Azure to Store Windows Phone 8 App Data

Using Windows Azure to Store Windows Phone 8 App Data content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Options for Storing Mobile Data to Azure

Windows® Azure™ provides multiple options for data storage and its persistence.

Azure SQL Database: Azure SQL Database is a relational database service that extends core SQL Server features to the cloud. It exposes a Tabular Data Stream (TDS) interface for Transact-SQL based database access. So, in simple language, Azure SQL Databases provide relational data management capabilities through Transact-SQL queries, ACID transactions, and stored procedures that are traditionally executed on the server side. You get many additional benefits, which may not be available in a typical on-premise SQL Database – hassle-free infrastructure, high availability, easy scalability, lower entry barrier in terms of cost, and overall it’s quite cost effective especially for small and medium enterprises. Azure SQL Database also offers features that enable migration, export, and ongoing synchronization of on-premises SQL Server databases with cloud databases.

Typical Azure SQL database server address format: <unique server name>

Azure Table Storage: Azure Table Storage is a very flexible and fault-tolerant NoSQL key-value data store. It is accessible via Table Storage service, which offers simplified key-based access to un-schematized data at a low cost for applications. Additionally, different rows within the same table can have different structures. You can use this very efficiently in applications that need to store large amounts of non-relational data. In the initial phase of application development, when data models are not finalized, it can be leveraged very effectively. This schema-less property of windows Azure Tables also enables you to store and retrieve simple relational data quite efficiently.

URL format: http://< your-storage-account-name><table-name>

Azure Blob storage: Blob storage service is again a key/value store of unstructured data that can be accessed from anywhere in the world via HTTP or HTTPS. It functions like file storage in the cloud. The value stored for any key corresponds to folder and file names, so the retrieval of any file is accomplished not by searching values but by its folder name. This simple data structure makes blob storage very powerful where files such as images, audios, videos, PDFs, documents etc. are not only stored very economically but are also highly scalable. A single storage account can store hundreds of TBs of blob data. Many of Azure’s customers store hundreds of petabytes. Microsoft SkyDrive – re-launched now as “OneDrive” uses blob storage.

URL format: http://<your-storage-account-name>/<container-name>/blob-name

How to Use These Storage Options in a Windows Phone Application

Although these data storage can be accessed through Entity Client or through the services exposed, in the case of phone development, “Mobile Service” and “Windows Azure Storage client” are the preferred options to connect to them.

Mobile Services: Windows Azure Mobile Service is an Azure service offering designed to provide cloud based backend data source capabilities for your phone applications. It makes it very easy to create highly-functional mobile apps using Azure. By default the Mobile Services instance in Azure uses Azure SQL Database to store data; however, binary large object (BLOB) data is more efficiently stored in Windows Azure Blob storage service. This database instance is billed separately from the Mobile Services subscription. Some of the backend capabilities extended by Mobile Services include:

  • Simple provisioning and management of tables for storing app data.
  • Integration with notification services to deliver push notifications to your app.
  • Integration with well-known identity providers for authentication.
  • Granular control for authorizing access to tables.
  • Service monitoring and logging.

Azure Storage Client: Storage Client allows you to perform operations on various Azure Storage Services like blob service for storing binary or large text data, Table Service for storing structured non-relational data or queue service for storing messages. Mobile services uses Azure SQL database by default, and since SQL Database is billed by size, in many scenarios you will find that storing data in blob or table services are most cost effective and efficient. All Storage Services are accessible via REST APIs. Storage Services may be accessed from within a service running in Windows Azure, or directly over the Internet from any application that can send an HTTP/HTTPS request and receive an HTTP/HTTPS response.

Storage Client v3.0.3-preview:

How to Select the Right Data Storage for Your Phone

The fact that no one approach is right for all scenarios also holds true in the case of choosing the right Azure Storage option for your phone application data. You will find advantages and disadvantages of each of the above options. Choosing an approach depends on many parameters such as Data semantic (Type of data), Query support (key based or complex queries), ease of scalability, API Support (Azure Storage Client), reliability (backup, restore, and disaster recovery), and cost. Some of the scenarios would be the following when making this decision:

  • SQL Database: Relational data, complex queries, many tables, more expensive.
  • Table storage: NoSQL non-relational data, more scalable and less expensive, very large data, lower-access frequency or data that can be easily cached.
  • Blob storage: Large binary data such as images, audio, video, documents.

You will often find that the compositional approach, where you use SQL and NoSQL in a single solution works best for many phone application development scenarios. Cloud makes it possible to mix and match data storage quite easy. Despite some notable differences, Windows Azure SQL Database and Table Storage are both highly available with around 99.9% monthly SLA (Service Level Agreement).

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories