47
Azure Mobile Services per Windows Phone e Smartphones Edizione AppDays Fiera del Radioamatore/2014 Marco Parenzan

Azure Mobile Services per Windows Phone e smartphones

Embed Size (px)

DESCRIPTION

Discover how to easily create services that can improve your app experience, without regarding it is iOS, Android, or, obviously, Windows Phone....

Citation preview

Page 1: Azure Mobile Services per Windows Phone e smartphones

Azure Mobile Services per Windows Phone e Smartphones

Edizione AppDaysFiera del Radioamatore/2014Marco Parenzan

Page 2: Azure Mobile Services per Windows Phone e smartphones

Marco Parenzan

Formazione & Divulgazione con 1nn0va

Ricerca e Innovazione con Servizi Cgn www.slideshare.net/marco.parenzan

marco [dot] parenzan [at] libero/live [dot] it

www.innovazionefvg.net

Developer e Architect in .NET e Web

Cloud Developer

Page 3: Azure Mobile Services per Windows Phone e smartphones

Lo scenario Mobile/Smartphone/Apps

Page 4: Azure Mobile Services per Windows Phone e smartphones

Mobile (oggi)…

…domani ci saranno tanti nomi: Devices

Intelligente Devices

Internet of Things

App è il modello delle applicazioni che provengono da uno «shop» Tipico per questo tipo di dispositivi

Anche nei PC (es. Windows 8) ora si chiamano App

Page 5: Azure Mobile Services per Windows Phone e smartphones

App=Client+Services

Quando parliamo di app, pensiamo subito allo smartphone e alla «grafica»

Una app non funziona mai da sola

Parliamo di applicazioni «connesse» Il valore dello smartphone è essere «online»

Sei online perché comunichiamo con dei servizi Identità (Facebook, live.it, gmail.com, linkedin, …)

Email (Live, Gmail, …)

Storage drives (OneDrive, GoogleDrive, DropBox, ….)

Se tutti percepiamo come scrivere una app, come scriviamo un servizio?

Page 6: Azure Mobile Services per Windows Phone e smartphones

Servizi per le App

I servizi per le app sono composti da due parti fondamentali Il Codice

L’infrastruttura

Il codice è la parte «che fa il lavoro» Lo scriviamo in qualche linguaggio (Javascript+HTML, C# e XAML, Java, PHP, ….)

L’infrastruttura dà gli «attributi» al servizio Qualità

Disponibilità

Funzionalità

Page 7: Azure Mobile Services per Windows Phone e smartphones

Introduzione al Cloud Computing

e Microsoft Azure

Page 8: Azure Mobile Services per Windows Phone e smartphones

Cos’è il Cloud Computing

L’approccio moderno alla implementazione di servizi per le App

Page 9: Azure Mobile Services per Windows Phone e smartphones

Cos’è il Cloud Computing

An approach to computing that’s about internet scale and connecting to a variety of devices and endpoints

Page 10: Azure Mobile Services per Windows Phone e smartphones

Cos’è il Cloud Computing

Time

Dem

an

d Cloud Provisioning

OverprovisionedUnderprovisioned

On-demand, scalable, multi-tenant, self-service compute and storage resources

Page 11: Azure Mobile Services per Windows Phone e smartphones

Windows Azure

Comprehensive set of services that enable you to quickly build, deploy and manage applications across a global network of Microsoft-managed datacenters

Page 12: Azure Mobile Services per Windows Phone e smartphones

Global Footprint

Page 13: Azure Mobile Services per Windows Phone e smartphones

Pay only for what you use

Page 14: Azure Mobile Services per Windows Phone e smartphones

Windows Azure Scenarios

Ideal for Applications Needing:

Scalability

Availability

Fault Tolerance

Common Application Uses:

Web Sites

Compute Intensive apps

Device Applications

Web APIs

Social Games

Page 15: Azure Mobile Services per Windows Phone e smartphones

Types of “cloud” offerings

Software-as-a-Service

consume

SaaSPlatform-as-a-Service

build

PaaSInfrastructure-as-a-

Service

host

IaaS

Page 16: Azure Mobile Services per Windows Phone e smartphones

PaaS for the Modern Web

Paas is secureEnterprise Grade Availability with support for SSL and AD

PaaS is flexibleWeb hosting your way with choice of language, framework, database, and platform

PaaS is scalableScale out or up in seconds on a Load Balanced, Always up to date, Global Infrastructure

Page 17: Azure Mobile Services per Windows Phone e smartphones

web sites virtual machines mobile servicescloud services

The modern offering (2013+)

Page 18: Azure Mobile Services per Windows Phone e smartphones

On-Premises

Models for Building and Running Apps

Virtualization

O/S

Hardware

Native Code

Custom Software

Network

Data

Applications

Firewall

Web Sites

Applications

Data

Cloud Services

Native Code

Startup Tasks

Applications

Firewall Rules

Data

Virtual Network

Virtual Machines

Native Code

Custom Software

Virtual Network

Data

Applications

Firewall Rules

O/S

Mobile ServicesApplications

Data

Auth

Notifications

Page 19: Azure Mobile Services per Windows Phone e smartphones

Go Live

Rapid deployment for quick iteration

Integrated source control with Team Foundation Server (TFS) and Git

Built-in monitoring of perf and usage data

Quick access to request logs, failed requests diagnostics and diagnostics

Page 20: Azure Mobile Services per Windows Phone e smartphones

Enterprise grade

High availability with SLA on reserve instances.

A global network of data centers.

Guaranteed SLA and 24/7 support.

Load balanced Up to date Easily scale Economical

Page 21: Azure Mobile Services per Windows Phone e smartphones

Scalability

Scaling up and scaling out

0 1 2 3 4 5 6 7 8

Instances

Throughput

Instance Capacity

Quota

Page 22: Azure Mobile Services per Windows Phone e smartphones

Scaling

Free

Shared

Standard

Multi-tenant. Daily quotas

Multi-tenant. Daily quotas

Dedicated VMs. No quotas

Page 23: Azure Mobile Services per Windows Phone e smartphones

Open and flexible

Choice of languages.

Choice of databases.

Web app gallery. Zero lock in.

Page 24: Azure Mobile Services per Windows Phone e smartphones

Choice of language

Node.js: 0.6.17, 0.6.20, 0.8.2

PHP: 5.3PHP: 5.4

ASP.NETNET: 3.5, 4.5, 4.5.1 Python: 2.7

Bring a stack: FastCGI basedRubyJava

Page 25: Azure Mobile Services per Windows Phone e smartphones

Azure Mobile Services

Page 26: Azure Mobile Services per Windows Phone e smartphones

Mobile Services

Easily build cloud back-ends

Data, identity, push notifications, and scheduled scripts

Windows Store, Windows Phone, iOS, and Android

Page 27: Azure Mobile Services per Windows Phone e smartphones

Mobile Services

Cdn

Services for Cloud and Mobile Applications

Caching

Media

Big data

Analytics

Web Sites

Integration

Service bus

SQL database noSQL DB

Blob storage

Cloud services

Virtual Machines

Identity

Messaging

Networking

Traffic

Storage

Page 28: Azure Mobile Services per Windows Phone e smartphones

What are Mobile Services?

Data

Notifications

Auth

Server Scripts + Custom API

Scheduler

Logging & Diag

Scale

Page 29: Azure Mobile Services per Windows Phone e smartphones

Structured Storage

Powered by SQL Database

Same DB – Multiple Mobile Services AppX.Todoitem

AppY.Todoitem

Data management in Windows Azure Portal

SQL Portal, SQL Management Studio

REST API

CLI Tools

Page 30: Azure Mobile Services per Windows Phone e smartphones

The REST API

Action HTTP Verb URL Suffix

Create POST /TodoItem

Read GET /TodoItem?$filter=id%3D42

Update PATCH /TodoItem/id

Delete DELETE /TodoItem/id

Data Operations and their REST Equivalents

Base REST API Endpoint URL

https://Mobileservice.azure-mobile.net/tables/*

Page 31: Azure Mobile Services per Windows Phone e smartphones

JSON to SQL Type Mappings

JSON Value T-SQL Type

Numeric values (integer, decimal, floating point)

Float(53)

Boolean Bit

DateTime DateTimeOffset(3)

String Nvarchar(max)

Page 32: Azure Mobile Services per Windows Phone e smartphones

Auth*

Authenticate against Microsoft Account, Twitter, Facebook, Google

Table level permissions for each CRUD operation Everyone

Anyone with the Application Key

Only Authenticated Users

Only Scripts and Admins

More granular control with server side scripts user.level: {admin, authenticated, anonymous}

user.userId: id or undefined if not authenticated

Page 33: Azure Mobile Services per Windows Phone e smartphones

The User object

User.level Anonymous

Authenticated

Admin

User.userId Provider:id or undefined

User.getIdentities() UserId

Provider Access Token / Secret

Page 34: Azure Mobile Services per Windows Phone e smartphones

Raggiungere l’utente: push notifications

Page 35: Azure Mobile Services per Windows Phone e smartphones

Push Notifications

Integrates with WNS to provide Toast, Tile, Badge and Raw notifications

Portal captures your WNS client secret and package SID

push.wns.* provides: clean easy object model to compose notifications

Performs auth against WNS for you

Page 36: Azure Mobile Services per Windows Phone e smartphones

How Push Notifications Work

Retrieve device handle

PNS(APNS, WNS, GCM)

Store handle in app back-end Send notification to handle

Device notified (even when app is inactive)

Page 37: Azure Mobile Services per Windows Phone e smartphones

Server Side Scripts

Customizing logic on the server

Node.js scripts

Passes through to SQL by default

Intercept CRUD requests to tables

Fully customizable logic flow

Page 38: Azure Mobile Services per Windows Phone e smartphones

Node Modules

Extensibility through numerous included modules

request

console

push.*

mssql

statusCodes azure

sendgrid

pusher

twilio

Page 39: Azure Mobile Services per Windows Phone e smartphones

How Service Bus Notification Hub Works

Retrieve device handle

PNS

Registration with tagsSend notification to handle

Push notification

Page 40: Azure Mobile Services per Windows Phone e smartphones

Azure Mobile Services:other goodies

Page 41: Azure Mobile Services per Windows Phone e smartphones

More on script options: Custom API

Non-table based scripts

Accessible from Get

Post

Put

Patch

Delete

Same permissions as tables

Page 42: Azure Mobile Services per Windows Phone e smartphones

Storage: What are our options?

Benefits: Non-relational structured storage

Massive scale-out

Tables Storage

Benefits: Big filesBlobs

Benefits: Persistent Async Messaging

Enqueue, Dequeue

Queues

Benefits: Relational database

Highly available

Managed for you as a service

SQL Database

Page 43: Azure Mobile Services per Windows Phone e smartphones

Script Source Control

Handled through GIT repo

• Access to table, scheduler, custom API, shared scripts, and permissions

Shared Scripts

• Make scripts accessible from other scripts

• Just like creating Node.js modules NPM

• Ability to use ‘npm install module’ to download NPM modules

Page 44: Azure Mobile Services per Windows Phone e smartphones

Mobile Services Tiers

Free Standard Premium

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 Standard units

Up to 10 Enterprise units

Scheduled Jobs

Limited Included Included

SQL Database (required)

20MB Included, Standard rates apply for more capacity

20MB Included, Standard rates apply

for more capacity

20MB Included, Standard rates apply for more capacity

Page 45: Azure Mobile Services per Windows Phone e smartphones

Conclusions

Page 46: Azure Mobile Services per Windows Phone e smartphones

Conclusions

il Cloud Computing è la piattaforma di riferimento per complementare la parte «client» di una App

Microsoft Azure è la piattaforma Cloud di riferimento per ricchezza di servizi e molteplicità di modelli per lo sviluppo

Azure Mobile Services sono una piattaforma che semplifica l’acceso al Cloud per chiunque voglia scrivere app… …avendo subito servizi di classe enterprise

…ma potrà scalare a modelli e livelli di servizio ancora più alti

Page 47: Azure Mobile Services per Windows Phone e smartphones

Grazie!

www.slideshare.net/marco.parenzan

marco [dot] parenzan [at] libero/live [dot] it

www.innovazionefvg.net

@marco_parenzan

it.linkedin.com/in/marcoparenzan

www.facebook.com/parenzan.marco

www.marcoparenzan.it

www.slideshare.net/marco.parenzan

github.com/marcoparenzan

www.scoop.it/u/marco-parenzan

Q&A