29
Kristof Rennen Real World Architectures Using Windows Azure Mobile Services

Real World Architectures Using Windows Azure Mobile Services

Embed Size (px)

DESCRIPTION

With Windows Azure Mobile Services, Microsoft has made available an amazing service to easily build mobile solutions on a solid API, offering a lot of important components out of the box. Starting from data running on a Windows Azure SQL Database, exposed through a REST API and supported by javascript-enabled server side logic and scheduled tasks, a mobile backend can be set up in only minutes. Adding the extra power of authentication using various well known identity providers and the free notification services to serve push notifications make it a solid solution for all mobile platforms, including Android, iOS, Windows Phone and Windows 8. In this session we will show you how Windows Azure Mobile Services can already be applied in real world architectures and projects, even while it is still in preview. We will talk through a few Windows 8 and Windows Phone apps, already or soon available in the Windows Store and we will show you how to combine the SDK and REST possibilities offered by the service to build solid solutions on all mobile platforms.

Citation preview

Page 1: Real World Architectures Using Windows Azure Mobile Services

Kristof Rennen

Real World Architectures Using Windows Azure Mobile Services

Page 2: Real World Architectures Using Windows Azure Mobile Services

• Kristof Rennen

• Managing Partner / Solution Architect at AppStory• Microsoft Extended Experts Team Member• Crew Member of Azug, the Belgian Windows Azure

User Group• Windows Azure Insider / Mobile Services Advisory

Board Member

• @kristofrennen / @AppStoryBe• [email protected]

Who Am I?

Page 3: Real World Architectures Using Windows Azure Mobile Services

Windows Azure Global Bootcamp

Over 100 community-led Windows Azure training events worldwide!

http://globalwindowsazure.azurewebsites.net

Page 4: Real World Architectures Using Windows Azure Mobile Services

Agenda• Mobile Services?• Inside data• Being secure

• Real world scenarios• Data synchronization between

apps• Data aggregation &

consolidation• Identity integration using

Windows Live

• Advice from the trenches• Data(base)• ALM• Architecture

• Wrap up & conclusion

Page 5: Real World Architectures Using Windows Azure Mobile Services

Why Bother?

Page 6: Real World Architectures Using Windows Azure Mobile Services

• Powerful building blocks• All needed components available out of the

box• Solid back ends in seconds• Cross platform support for all major

platforms: Windows 8, Windows Phone, Android, iOS, HTML5

• Fully REST capable if needed• Focus on apps, not on infrastructure

Why Mobile Services?

Page 7: Real World Architectures Using Windows Azure Mobile Services

Powerful Building Blocks

Data

Notifications

Auth

Server Logic

Scale

Logging

Diagnostics

Page 8: Real World Architectures Using Windows Azure Mobile Services

Inside Data

Page 9: Real World Architectures Using Windows Azure Mobile Services

• Windows Azure SQL Database• Create tables through portal or API• Dynamic schema• One database, multiple services possible• Security is schema based• DBA user only to create new service,

restricted user for further access• Throttling and failures are handled and

retried

Solid Foundation

Page 10: Real World Architectures Using Windows Azure Mobile Services

• Relations (and therefor joins) are not possible

• But … views are “possible” but not advised• Create view directly on the database• Create a table with the same name• Tadaaaaa

• You can still aggregate data from multiple tables

What About Relations?

Page 11: Real World Architectures Using Windows Azure Mobile Services

• Server scripts can execute http requests• Any http based service can be called• Table storage• Blog storage• Service bus• Third party API (Facebook, Twitter, Live, …)

Custom Sources

Page 12: Real World Architectures Using Windows Azure Mobile Services

Being Secure

Page 13: Real World Architectures Using Windows Azure Mobile Services

• Schema separation• User separation

Database

Page 14: Real World Architectures Using Windows Azure Mobile Services

• Think of it as the Application Identifier• Only remains private during development• Don’t rely on it to remain private in

production• Don’t use it as a security mechanism• Can still be used as a tracking mechanism

Application Key?

Page 15: Real World Architectures Using Windows Azure Mobile Services

Dealing With Permissions• Everyone• For read• For anonymous access

• Anybody with the Application Key• For read• For insecure inserts• For tracking

• Only Authenticated Users• Only option for secure systems• For client > server communication

• Only Scripts and Admins• Use the master key• Not for client > server

communication!!• For server > server

communication

Page 16: Real World Architectures Using Windows Azure Mobile Services

Real World Scenarios

Page 17: Real World Architectures Using Windows Azure Mobile Services

• Apps have data which can be shared over multiple devices & platforms: settings, user data, …

• Mobile Services can easily be the store in between

Data Synchronization Between Apps

Page 18: Real World Architectures Using Windows Azure Mobile Services

• Windows 8 and Windows Phone share settings and session favorites

Microsoft TechDays Belux 2013 Apps

Windows 8XAML + C#

MVVMWAMS SDK

Windows Phone 7/8XAML + C#Live SDK

REST

(3 Instances)

(1GB Web)(Microsoft Account)

Favorites

Filters

Page 19: Real World Architectures Using Windows Azure Mobile Services

• Data comes from many sources: databases, feeds, CMS, website, …

• You have a solution or app that visualizes all this data

• Risk of tightly coupling to various sources• Concerns• What if a source structure changes• What if the source is down• What if the source data is too large• What if new sources need to be added

Data Aggregation And Consolidation

Page 20: Real World Architectures Using Windows Azure Mobile Services

• Cross platform apps visualizing training data from:• PTF• MPN• DPE• MIC• …

• One Data Model• One “interface”• Reusability

Microsoft Partner Training App

Partner Training Framework

(Sharepoint + XML)

Microsoft Partner Network

(SQL Database)

Microsoft Innovation Center

(XML Feed)

Developer & Platform Evangelism(XML Feed)

?

Integration Services(Windows Azure Worker Role / Mobile Services Scheduler / $͙ )

Upsert

Windows 8 Windows Phone Android iOS Web

Page 21: Real World Architectures Using Windows Azure Mobile Services

• Live SDK and Mobile Services integrate well• Except … if you use Live SDK on one app

and Mobile Services on the other > token mismatch

• But ... there is a pretty “simple” solution• Authenticate using Live SDK the normal way: token 1 received• Use token 1 to call the Live API to fetch the real user id• Authenticate using Mobile Services the normal way: token 2 received• Use a server side script to call the Live API to fetch the real user id• Even if token 1 != token 2, user id 1 == user id 2

Identity Integration Using Windows Live

Page 22: Real World Architectures Using Windows Azure Mobile Services

• Windows 8 uses Mobile Services authentication using Live directly

• Windows Phone uses Live SDK authentication

Microsoft TechDays Belux 2013 Apps

Live SDK

Mobile Service SDK

Auth

Auth Custom Read ScriptMobile Services Access Token

Win

dows

Live API

Live Access Token

Live Access Token

Page 23: Real World Architectures Using Windows Azure Mobile Services

Advice From The Trenches

Page 24: Real World Architectures Using Windows Azure Mobile Services

• Multiple mobile services, one database• Each mobile service has its own database

user• Use dynamic schema• Use views for complex queries• Duplicate and optimize data if needed• Other data sources are possible: table

storage, queues, another API, …

Data(base)

Page 25: Real World Architectures Using Windows Azure Mobile Services

• Version your server side scripts• Automate script deployment using

Powershell• Test your scripts• Use DEV, TEST and PROD environments

Application Lifecycle Management

Page 26: Real World Architectures Using Windows Azure Mobile Services

• Abstract the implementation and loosely couple it

• Make sure you can grow into it• Reuse the abstraction by using IoC and DI• Consider PCLs to optimize reusability• Think about multi tenancy• Standard API concerns and best practices

still apply• Versioning• Data formats• Data optimization and duplication

Architecture

Page 27: Real World Architectures Using Windows Azure Mobile Services

Is It Worth It?

Easy to start, even for free, and grow into

it

Killer components and building

blocks, all out of the box

Focus on apps, not

infrastructure

Cross platform

But … it is still an API and you have to consider and architect it thoroughly

Page 28: Real World Architectures Using Windows Azure Mobile Services

Windows Azure Global Bootcamp

Over 60 community-led Windows Azure training events worldwide!

http://globalwindowsazure.azurewebsites.net

Page 29: Real World Architectures Using Windows Azure Mobile Services