Mobile Services for Windows Azure
-
Upload
abhishek-sur -
Category
Technology
-
view
122 -
download
1
Transcript of Mobile Services for Windows Azure
![Page 1: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/1.jpg)
Solution Building Blocks
Abhishek SurMicrosoft MVP
Microsoft Azure
![Page 2: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/2.jpg)
My PublicationsA comprehensive book on .NET Expert guide book
with expert advices on development.
Part 1 includes Visual Studio, Memory Management,
Windows 8, ASP.NET, WPF, Architecture etc.
A comprehensive book on .NET Expert guide book
with expert advices on development.
Part 2 includes Debugging, WCF, Windows Phone, Testing
TFS, Extensibility, Windows Azure etc.
![Page 3: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/3.jpg)
Agenda
3
Mobile Services Features and Demos
Advanced Features Scaling and Pricing
Questions
![Page 4: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/4.jpg)
What is Mobile Services?
4
Storage
Authentication
Logic
Push
Scheduler
![Page 5: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/5.jpg)
Demo: Getting StartedYour first Mobile Service
![Page 6: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/6.jpg)
Structured Storage
• Powered by SQL Database
• Supports rich querying capabilities
• Dynamic Schematization
• Data management in:• Azure Portal
• SQL Portal (Silverlight)
• SQL Management Studio
• REST API
• Azure CLI Tools
• SQL CLI
6Microsoft Azure
![Page 7: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/7.jpg)
The REST API
7
Action HTTP Method URL Suffix
Create POST /TodoItem
Read GET /TodoItem?filter=id%3D42
Update PATCH /TodoItem/id
Delete DELETE /TodoItem/id
Microsoft Azure
Base Endpoint: https://MobileService.azure-
mobile.net/tables/*
![Page 8: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/8.jpg)
JSON to SQL Type Mappings
8
JSON Type T-SQL Type
Numeric values (integer, decimal,
floating point)
Float(53)
Boolean bit
DateTime DateTimeOffset(3)
String Nvarchar(max)
Microsoft Azure
![Page 9: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/9.jpg)
Auto-generated Columns
• id – unique guid
• __createdAt – date
• __updatedAt – date
• __version – timestamp• Helps with concurrency and offline
9Microsoft Azure
![Page 10: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/10.jpg)
Backend Logic:JavaScript & .NET
![Page 11: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/11.jpg)
Server Side Table Scripts
11
Node.js scripts
Intercept CRUD
requests to tables
Passes through to SQL
by default
Fully customizable
.NET Web API
backend in
Visual Studio
MongoDB, Table
Storage, SQL out of the
box
![Page 12: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/12.jpg)
Node Modules
12
request push.*
console mssql
tables azure
sendgrid
pusher
twilio
![Page 13: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/13.jpg)
Demo: Customizing LogicAdding Data Validation
![Page 14: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/14.jpg)
.NET Backend
• Web API based w/ additional functionality, developed in and deployed from Visual Studio
• TableController data context can map to SQL, Table Storage, Mongo, etc
• Pull in NuGet modules and other .NET libraries
• Set permissions with attributes on classes
• Local Debug
14Microsoft Azure
![Page 15: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/15.jpg)
Custom API
• Non-table based endpoints
• Accessible from• GET
• POST
• PUT
• PATCH
• DELETE
• For node.js logic in scripts like table endpoints
• For .NET delivered through a WebAPI
• Expose any functionality you want
15Microsoft Azure
![Page 16: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/16.jpg)
File Storage
• Don’t store files in Mobile Services DB
• Use Mobile Service to provide a Valet Key Pattern to Blob Storage, aka BLOB SAS• Create table / custom API script to talk to Blob Storage
• Script generates Shared Access Signature (SAS) URL
• Script returns SAS URL to client app
• Client app uploads data to blob storage directly
• Store file URL in Mobile Service DB as needed
• Blob storage costs less and is built for redundant file storage
• Resource Broker extension for .NET and Node backends
16Microsoft Azure
![Page 17: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/17.jpg)
Push Notifications
![Page 18: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/18.jpg)
Push Notification Flow
18Microsoft Azure
![Page 19: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/19.jpg)
Demo: Adding Push Notifications
![Page 20: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/20.jpg)
Notification Hubs
• Separate from Mobile Services• Can be used regardless of whether you’re storing data in Azure
• Extremely scalable push notifications
• Cross platform support• Push to iOS, Android, Kindle, Windows Phone, Windows Store
• Tags (i.e. tie my registration to this topic or user ID)
• Templates (i.e. when I get a push, send it in this format)
• Server SDKs for .NET, Java, and Node (also open as REST API)
20Microsoft Azure
![Page 21: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/21.jpg)
Authorization
&
Authentication
![Page 22: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/22.jpg)
Data Authorization
Per HTTP method auth options:• App Key Required
• Not ideal for production use
• Everyone
• Authenticated Users
• Admins and other scripts• Requires Master Key as header
401 Unauthorized response if security check fails
22Microsoft Azure
![Page 23: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/23.jpg)
User Auth Flow (server)
23Microsoft Azure
MOBILE SERVICE
DEVICE
MICROSOFT
ACCOUNT
AAD
![Page 24: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/24.jpg)
User Auth Flow (client)
24Microsoft Azure
MOBILE SERVICE
DEVICE
MICROSOFT
ACCOUNT
AAD
![Page 25: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/25.jpg)
The User object
User.level• Admin
• Authenticated
• Anonymous
User.userId• Provider:id or undefined
User.getIdentities() • UserId
• Provider Access Token / Secret
• Basic user information (i.e. name, username, locale, picture, link)
25Microsoft Azure
![Page 26: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/26.jpg)
Demo: Adding AuthLock Down and Login
![Page 27: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/27.jpg)
Offline Sync
![Page 28: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/28.jpg)
Offline support
TableController
(with optimistic
concurrency)
Mobile ServiceDevice
SQL Database
BYOD
MongoDB
Table Storage
SQLite
Explicit Push/Pull
Conflict resolution
![Page 29: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/29.jpg)
Offline Sync: Potential Uses
• Improve app responsiveness by caching server data locally on the device
•Make apps resilient against intermittent network connectivity
• Allow end-users to create and modify data even when there is no network access, supporting scenarios with little or no connectivity
• Sync data across multiple devices and detect conflicts when the same record is modified by two devices
29
![Page 30: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/30.jpg)
Scheduler
![Page 31: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/31.jpg)
Scheduled Jobs
• Executes a script on defined schedule
• Can be run on demand
• Ideal for any backend data processing job
• Length / frequency based of Mobile Service tier
31Microsoft Azure
![Page 32: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/32.jpg)
Script
Source
Control
![Page 33: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/33.jpg)
Script Source Control
• Creates a Git repo in Azure
• Node.js only, turned on by default
• Access table, scheduler, custom API, shared scripts and permissions
• Pushing changes triggers a redeploy of your Mobile Service
• Enables installing NPM modules (for Node backends)
• Shared Scripts• Create scripts that can be used from all other scripts in your Service
33Microsoft Azure
![Page 34: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/34.jpg)
Diagnostics
Logging
Scale
![Page 35: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/35.jpg)
Diagnostics, Logging, Scale
35
API Calls, # of Devices,
Data Out
Console Logging (auto
error logging)
Scale Service Based off API
CallsAuto-scale to Save Money
Free Tier for Mobile Free Tier for SQL
![Page 36: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/36.jpg)
Mobile Service Scaling
Free: 500k calls / month / subscription
Basic: 1.5M calls / unit (6) / month
Standard: 15M calls / unit (10) / month
Microsoft Azure
![Page 37: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/37.jpg)
Demo: ScalingLeaving Free Mode and Turning on AutoScale
![Page 38: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/38.jpg)
Command
Line
Interface
![Page 39: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/39.jpg)
CLI
39
Create / Delete Services Inspect / Delete Table Data
Create / Update / Delete
Tables and Permissions
Create / Upload / Delete
Scripts
Scale Up / Down Services Much More Across Azure
![Page 40: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/40.jpg)
Demo: Using the CLI
![Page 41: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/41.jpg)
Mobile Service Tiers
41
General Availability
99.9%
Free Basic Standard
Usage
Restrictions
Up to 10 services,
Up to 500 Active
Devices*
N/A N/A
API Calls 500K
(per subscription)
1.5M
(per unit)
15M
(per unit)
Scale N/A Up to 6 (in portal) Up to 10 (in portal)
Scheduled
Jobs
Limited Included Included
SQL
Database
(required)
20MB free DB 20MB free DB 20MB free DB
*Active devices refers to the number of physical devices and emulators that make at least one call to or receive a push notification from your mobile service.
![Page 42: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/42.jpg)
Azure Mobile Services
42
Storage
Authentication
Logic
Push
Scheduler
![Page 43: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/43.jpg)
Resources
• Get a FREE Microsoft Azure Trial Account:• http://azure.microsoft.com
• Videos, Tutorials, and More• http://azure.microsoft.com/mobile
• SDK Source Code on GitHub• https://github.com/Azure/azure-mobile-services
• Contact Details• <Contact Info>
43Microsoft Azure
![Page 44: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/44.jpg)
Get startedVisit azure.microsoft.com
![Page 45: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/45.jpg)
![Page 46: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/46.jpg)
Azure
footprint
16 regions worldwide in 2014
![Page 47: Mobile Services for Windows Azure](https://reader030.fdocuments.us/reader030/viewer/2022032422/55a8ec5a1a28abbf2b8b465b/html5/thumbnails/47.jpg)
Fortune 500 using Azure
>57% >250kActive websites
Greater than
1,000,000SQL Databases in Azure
>20TRILLIONstorageobjects >300 MILLION
AD users
>13 BILLIONauthentication/wk>2
MILLIONrequests/sec >1
MILLIONDevelopers
registered with
Visual Studio
Online