Putting the Cloud in Your Pocket with Azure Mobile Services (.NET)

Post on 19-Dec-2014

223 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Azure Mobile Services provides developers a valuable tool that can be leveraged to quickly create rich and robust mobile apps in the current Mobile First, Cloud First environment. This session will review the capabilities offered by the Azure Mobile Services tools, specifically focusing on the new .NET-based backend. The talk will show how Azure Mobile Services can be used to quickly stand up cloud-based API support and provide the various cloud service integration needs of most mobile apps, including data storage and manipulation, authentication and authorization, connection to notification services, offline data synchronization, and custom server-based job scheduling.

Transcript

Consulting/Training

John Garland

Principal Consultant

jgarland@wintellect.com

@dotnetgator

Putting the Cloud in Your PocketUsing Azure Mobile Services (.NET)

Consulting/Training

Cloud and mobile are in fact one and the same.

The mobile devices that users are flocking to are useless without the cloud.

And the cloud…is just a theory until you have a device that's both powerful enough to run apps that can take advantage of it and mobile enough that those apps are with you all the time, and working on your behalf.

Paul ThurrottWill IT Ever Buy into “Mobile First, Cloud First”? 4/29/2014http://j.mp/1jjFzs2

Consulting/Training

Microsoft AzureMedia

Services

Access Control

Azure Active

DirectoryService

Bus

Content Delivery Network

Azure SQL Database

Azure Storage

Virtual Machines

Web SitesCloud Services

Azure Mobile Services

Consulting/Training

"If you wish to make an apple pie from scratch, you must first invent the universe." - Carl Sagan

Ease-of-use

Control

Consulting/Training

Introducing Mobile Services (.NET Backend)

Data Storage

Server-Side Logic

Authentication & Authorization

Push Notifications with Notification Hubs

Prices & Tiers

Agenda

Consulting/Training

A factory for creating REST APIs that can access several back-end services:Provisioning and Management of Storage

Server-Side Business Logic with Source Control Integration

Authentication & Authorization

Push Notification Integration

Scheduled Script Execution

The Two Parts of Azure Mobile Services

Client libraries Simplify using the REST APIs provided by the serverClient-side tooling (WAB, Offline Data Sync with SQLite)Source code for the client libraries is available on GitHub:

http://github.com/WindowsAzure/azure-mobile-services

Consulting/Training

Getting Started with the Windows Azure Mobile Services Portal

Consulting/Training

Out of the box support for SQL Azure, Azure Tables, Mongo DB

For SQL AzureAccess via EF6 Code-First

Automapper support is included to provide DB Entity to DTO Conversions

Use DB Migrations for schema updates

3 Steps: Data Model, Data Context, Data Controller

Data Storage

Consulting/Training

With the .NET client library, apps can either use strongly typed data objects or dynamic JSON objects

With strongly-typed data, object/table and property/column names can be aliased Using the DataTable attribute or the JsonProperty attribute

Table operations includeQuery(where, skip/take, orderby/thenby)

Lookup (find by id)

Insert

Update

Delete

Consuming Data Tables (.NET apps)

Consulting/Training

3 Execution Models for Server CodeTable Controller Methods (CRUD)

Custom API REST Endpoints

Scheduler Jobs

Services property provides access to Log, Push, Settings, Properties

Functionality can be extended with NuGet or other Assembly references

Server-Side Business Logic

Consulting/Training

Working with Data

Consulting/Training

Authentication & Authorization

Out of box supportMicrosoft Account, Twitter, Google, Facebook, Azure Active Directory

“Secret Values” stored on the server in the Portal, behind the firewall

Authentication FlowsServer-Flow: Server (Mobile Services) manages the authentication process

Client-Flow: Client authenticates on its own, passes token to server

AuthorizationScoped within the Controllers – entire controller or individual methods

Levels: Anonymous, Application, User, Administrator

Custom Authentication Extensibility

Consulting/Training

Facebook, Google, Microsoft Account

Specify in the portal’s “app settings” section

The authentication token that is obtained during login then supports requests for additional information from the identity provider

Available ValuesMicrosoft Account Scopes - http://j.mp/MicrosoftAccountScopes

Facebook Login Permissions - http://j.mp/FacebookPermissions

Google Authorization Scopes - http://j.mp/GoogleScopes

AuthN – Custom Scopes in the Server Flow

Consulting/Training

Using Authentication & Authorization

Consulting/Training

Support for Windows (WNS), Windows Phone (MPNS), iOS (APNS), Android (GCM)

Notification Hub provisioned alongside your Mobile Service

Register for Push either via the Client API or relayed through the server

Optionally provide tags with registration

Server sends platform-specific push messages to the Notification Hub along with optional tags to filter targets

Push Notifications

Consulting/Training

1) The app requests and is issued a notification channel

2) The app registers this channel information and optionally some tags with the Mobile Service’s Notification Hub

3) An external event occurs that causes the Internet service to decide it should send notifications

4) The Internet service tells the Notification Hub to send notifications, optionally supplying one or more tags and optionally indicating a template to use

5) The Notification Hub iterates over its own list of applicable registrations, composes the payload appropriately, and sends the correct request to the notification services, managing failures, expired registrations, etc.

6) The notification services route notifications to the appropriate devices, where the payload and device settings determine how it should be displayed

Notification Hub Push Notification LifecycleApp App Service

Device OS Notification Service

3

Notification Hub

1

6

2 4

5

Consulting/Training

Push Notifications

Consulting/Training

OtherOffline Sync in the Client

SignalR Integration for Real-Time Communication

Resource Broker for Azure Storage Access

Integration With Azure API Management (Apiphany)

Integration with SQL Azure Auditing

DataSupport for Hybrid Connections

Azure Tables, MongoDB

AuthNClient-Flow Authentication

Custom Scopes

Custom Authentication Provider

NotificationsNotification Hub Templates

Other Topics

Consulting/Training

Pricing and Scaling Options

Free Instance Basic Instance Standard Instance

Price Free (up to 10 services/month)

$14.99/unit/month $139.99/unit/month

API Calls 500K/mo (prorated daily) 1.5M/unit/month (pr. daily) 15M/unit/month (pr. daily)

Active Devices

500 devices/day Unlimited

Scale 1 unit (no AutoScale) Up to 6 units Unlimited units

Notifications Free Tier included (up to 1M)

Basic Tier Incl (up to 10M) Standard Tier Incl (up to 10M)

Scheduled Jobs

1 scheduled job1 execution/hour

Up to 10 scheduled jobs50K job executions

Up to 10 scheduled jobs500K job executions

Other 60 CPU minutes/day165 MB outbound data/day

SQL Database

1 20 MB database (free for 12 months) can be created per subscription, pay for other DB tiers

Dev/Test Production Deployment

Consulting/Training

Pricing and Scaling Options – Notification Hubs

Free Instance Basic Instance Standard Instance

Price Freefor 1 million pushes

$10 base charge / monthfor 10 million pushes+ $1 for 10M-100M+ $1 for 100M+

$200 base charge / monthfor 10 million pushes+ $10 for 10M-100M+2.50 for 100M+

Broadcast size

Up to 3,000 tags, up to 10,000 devices per tag Unlimited devices & tags

Active Devices

Unlimited

Other Queryable AudienceScheduled PushTelemetryBulk ImportMulti-Tenancy

Consulting/Training

Code Samples:

Windows: http://j.mp/MobileServicesWindowsStoreSamples

Windows Phone: http://j.mp/MobileServicesWindowsPhoneSamples

iOS:http://j.mp/MobileServicesIOSSamples

Android:http://j.mp/MobileServicesAndroidSamples

Videos:

Channel 9 mini-videos:http://j.mp/MobileServicesChannel9Series (38)

Build 2014: http://j.mp/MobileServicesBuild2014 (3)

TechEd NA: http://j.mp/MobileServicesTENA2014 (3)

Documentation:

Tutorials / Resources: http://azure.microsoft.com/en-us/develop/mobile/

Team Blog(s): http://blogs.msdn.com/b/azuremobile/ (prior to

7/8/2014)

http://azure.microsoft.com/blog/

Resources

Consulting/Training

Thank You

John Garland

Principal Consultant

jgarland@wintellect.com

@dotnetgator

top related