real world architectures using windows azure mobile services
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.TRANSCRIPT
Kristof Rennen
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?
Windows Azure Global Bootcamp
Over 100 community-led Windows Azure training events worldwide!
http://globalwindowsazure.azurewebsites.net
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
Why Bother?
• 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?
Powerful Building Blocks
Data
Notifications
Auth
Server Logic
Scale
Logging
Diagnostics
Inside Data
• 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
• 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?
• 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
Being Secure
• Schema separation• User separation
Database
• 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?
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
Real World Scenarios
• 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
• 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
• 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
• 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
• 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
• 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
Advice From The Trenches
• 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)
• Version your server side scripts• Automate script deployment using
Powershell• Test your scripts• Use DEV, TEST and PROD environments
Application Lifecycle Management
• 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
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
Windows Azure Global Bootcamp
Over 60 community-led Windows Azure training events worldwide!
http://globalwindowsazure.azurewebsites.net