Date post: | 20-Nov-2014 |
Category: |
Technology |
Upload: | michael-collier |
View: | 11,562 times |
Download: | 1 times |
Windows Azure Mobile Services: The Perfect Partner!M3
October 26th, 2012
National Architect,
Windows Azure
@MichaelCollier
www.MichaelSCollier.com
Michael Collier
What is the cloud?
An approach to computing that’s about internet scale and connecting to a variety of devices and endpoints
Image courtesy of Windows Azure Training Kit
Elastic Scale
Near-infinite Capacity
Consumption-based Pricing
No Long-Term Commitments
High Reliability
Global Presence
Cloud Computing
vs.
Mobility + Cloud == The Perfect Pair
Mobility Cloud
Limited Compute Virtually Limitless Compute
Limited Storage Virtually Limitless Storage
Connect from Anywhere Services via the internetStandards based accessible APIs
Rapidly Growing Market Scale and Elasticity
Backend for Mobile Applications
Iden
tity
Str
uctu
red
Sto
rage
Mes
sagi
ng
Med
ia
Uns
truc
ture
d S
tora
ge
Windows Azure Mobile ServicesWindows Azure Mobile Services
Add
ition
al S
ervi
ces
What is Windows Azure Mobile Services
Data
Notifications
Auth
Server Logic
Scale
Logging
Diagnostics
http://aka.ms/mobileservicesImage courtesy of Windows Azure Training Kit
• Official SDKs for Windows 8 and iOS
• JavaScript library
• Android and Windows Phone coming soon
Client Support
Image courtesy of http://msdn.microsoft.com/en-us/library/windowsazure/jj554228
demoGetting Started
Application KeyNOT A SECURITY TOKEN/CONTROL
Hint that user is coming from your app (reduce chance of misuse)
Private until you publish the app
Master KeyAll powerful
Do NOT distribute with your application
Use from server-side logic you control
Security
Leverage Windows Azure Storage
Tables: schemaless entity storage; NoSQL
Blobs: storage for any binary object (files . . . whatever you want)
Queues: simple messaging (push/pop)
Access via Windows Azure module for node.jsvar azure = require('azure');
var tableService = azure.createTableService(‘<storage account>',‘<storage key>', 'table.core.windows.net');
tableService.insertEntity(‘<table>’, entity, function(error) { });
Unstructured Data Storage
Leverage strengths of Windows Azure SQL DatabaseNew or Existing Database
Reporting, TSQL support, existing tools, etc.
Manage your way (portal, REST API, SSMS, etc.)
Partition applications by schemaApp1.Users
App2.Users
Dynamic Schema Support (on/off)
Structured Data Storage
DB
REST API
OData Interface
GET, POST, PATCH, DELETE
https://<service>.azure-mobile.net/tables/<table_name>/{<item_id>}
AuthorizationX-ZUM0-{APPLICATION | AUTH | MASTER}
Send JSON in request body
Receive JSON as response
Data Access
DB
demoIt’s Your Data
Never trust the client!
Handled via JavaScript scripts on the server
Intercept CRUD operations and apply your logic
Server-Side Business Logic
Pre
-Scr
iptin
g Scripting
Pre
-Sto
rage
DB
node.js
User authenticationPayload verification
Dynamic schematizationFinal checks
function(item, user, request) {…..}
Known objects and modulesazure
sendgrid
console
mssql
push
statusCodes
table
request
crypto
util
node.js
var SendGrid = require('sendgrid').SendGrid;var sendgrid = new SendGrid(‘<account>', ‘<password>'); sendgrid.send({ to: userItem.EmailAddress, from: '[email protected]', subject: 'New ToDoItem Added!!', text: 'A new MyToDoItem was added: ' + item.text}, function(success, message) { // If the email failed to send, log it as an error. if (!success) { console.error('SendGrid Error! ' + message); } });
Push Notifications
3. M
PNS sen
ds notic
e to
dev
ice 2. A
pp sends notice to MPN
S
1. Register channel with app
MicrosoftPushNotificationService
Mobile ServicesDevice
Obtain WNS client secret and package SID from Windows dev portal.
Enter WNS information to Mobile Services portal.
Ability to send Tile, Toast, Badge, and Raw notifications.
push.wns.*Node.js module to create push notifications
Handles authentication against WNS
Push Notifications
demoServer Scripts
Microsoft Account – Use the Live SDKTight integration with Windows Live services
Authentication
Microsoft Account, Facebook, Twitter, and Google
OAuth
Does not use Windows Azure ACS
Authentication
Table level authorization for CRUD operationsEveryone: any request by anyone is accepted.
Anyone with Application Key: app key distributed w/ the app (default)
Authenticated Users: users authenticated by Live Connect.
Scripts and Admins: registered scripts or requests via the master key
Your application can add whatever other authorization is needed.
Authorization
Server script to match against your table (role-based access, specific user, etc.)
Match against user.userId
Authorization
demoAdding User Authentication
• API Calls
• CPU Time
• Data Out
Diagnostics
console objectlog(formatString, obj, .. .)
info(…)
warn(…)
error(…)
Logging
ComputeScale out number of instances
Scale up the VM size
StorageDedicated SQL Database
Larger sized SQL Database
Scale
demoDiagnostics, Logging, and Scale
Official Android and Windows Phone SDKs coming soon
Official iOS SDK in Preview on GitHub
https://github.com/WindowsAzure/azure-mobile-services
CommunityWindows Phone: https://github.com/kenegozi/azure-mobile-csharp-sdk
MonoTouch (iOS and Android): https://github.com/xamarin/azure-mobile-services
ChrisRisner.com: Windows Azure Evangelist (iOS and Android)
REST API
Other Mobile Clients?
Free Offer at Preview
Running on shared instances
10 Mobile Services 1GB SQL
Database
Must be deployed to US-East or US-West DC
Data transfer is per subscription, not per mobile service
No SLA during Preview. Only small instances available. Can upgrade to a reserved instance at 33% discount from normal Pay-As-You-Go rates during Preview.
From
WA
Free T
rial
Unlimited ingress
165MB daily egress
Source: Windows Azure Training Kit
Pricing and SLAShared Instance Reserved InstanceMultitenant Environment Private VM (3 instance max)
Small Only (1.6GHz, 1.75 GB, 225 GB Storage)
10 mobile service applications 100 mobile service applicationsFree Same rate as Windows Azure Web
Sites
Service Level AgreementPreview – No availability SLAGA – 99.9%
Summary
Data
Notifications
Auth
Server Logic
Scale
Logging
Diagnostics
http://aka.ms/mobileservices
• Windows Azure Mobile Services– http://aka.ms/mobileservices
• SDK and Samples available on GitHub– https://github.com/WindowsAzure/azure-mobile-services
• Inside Windows Azure Mobile Services– http://
channel9.msdn.com/posts/Kirill-Gavrylyuk-and-Josh-Twist-Inside-Windows-Azure-Mobile-Services
• Josh Twist’s Blog– http://www.thejoyofcode.com
• Carlos Figueira’s Blog– http://blogs.msdn.com/b/carlosfigueira/
• Windows Azure FREE Trial– http://bit.ly/MikeAzureTrial
Resources
Q &
A
Ask your questions