Антон Бойко (microsoft azure mvp, ukrainian azure community founder) «azure mobile...

26
Cloud Powered Mobile Apps with Azure Boyko Anton Microsoft Azure MVP [email protected] Microsoft Azure

Upload: dataart

Post on 19-Feb-2017

292 views

Category:

Education


2 download

TRANSCRIPT

Page 1: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

Cloud Powered Mobile Apps with AzureBoyko AntonMicrosoft Azure [email protected] Microsoft Azure

Page 2: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

What is Mobile Services?

2

Storage

AuthenticationLogic

Push

Scheduler

Page 3: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

3

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

Microsoft Azure

Page 4: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

4

The REST API

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://my-service.azure-mobile.net/tables/*

Page 5: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

5

JSON to SQL Type MappingsJSON Type T-SQL TypeNumeric values (integer, decimal, floating point)

Float(53)

Boolean bit

DateTime DateTimeOffset(3)

String Nvarchar(max)

Microsoft Azure

Page 6: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

6

Auto-generated Columns• id – unique guid• __createdAt – date• __updatedAt – date• __version – timestamp

• Helps with concurrency and offline

Microsoft Azure

Page 7: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

Backend Logic:JavaScript & .NET

Page 8: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

8

Server Side Table ScriptsNode.js scripts

Intercept CRUD requests to tables

Passes through to SQL by default

Fully customizable

.NET Web APIbackend in

Visual Studio

MongoDB, Table Storage, SQL Azure

Page 9: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

9

Node Modulesrequest push.*

console mssql

tables azure

sendgrid

pusher

twilio

Page 10: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

10

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

Microsoft Azure

Page 11: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

11

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

Microsoft Azure

Page 12: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

Push Notifications

Page 13: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

13

Push Notification Flow

Microsoft Azure

1.

2.

3.

4.

Client(1)

(2)

(3)(4)

Page 14: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

14

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)

Microsoft Azure

Page 15: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

Authorization&Authentication

Page 16: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

16

Data AuthorizationPer 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 failsMicrosoft Azure

Page 17: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

17

User Auth Flow

Microsoft Azure

GOOGLE

FACEBOOK

TWITTER

MOBILE SERVICE

DEVICE

CREDENTIALS

(via

oAuth/WebView)

MICROSOFT ACCOUNT

IDENTITY

AUTH

TOKE

N

AAD

Page 18: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

18

The User objectUser.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)

Microsoft Azure

Page 19: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

Scheduler

Page 20: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

20

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

Microsoft Azure

Page 21: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

ScriptSourceControl

Page 22: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

22

Script Source Control• Creates a Git repo in Azure• 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

Microsoft Azure

Page 23: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

DiagnosticsLoggingScale

Page 24: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

24

Diagnostics, Logging, ScaleAPI Calls, # of Devices,

Data OutConsole Logging (auto

error logging)

Scale Service Based off API Calls

Auto-scale to Save Money

Free Tier for Mobile Free Tier for SQL

Page 25: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

Mobile Service Scaling Free: 500k calls / month / subscription Basic: 1.5M calls / unit (6) / month Standard: 15M calls / unit (10) / month

Microsoft Azure

Page 26: Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure Mobile Services — создаем backend для мобильного приложения со

Q & ABoyko [email protected]

facebook.com/groups/azure.ua