Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Azure Mobile Services per Windows Phone e smartphones
1. Azure Mobile Services per
Windows Phone e Smartphones
Edizione AppDays
Fiera del Radioamatore/2014
Marco Parenzan
2. 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
4. 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
5. 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?
6. 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à
11. Windows Azure
Comprehensive set of services that
enable you to quickly build, deploy and
manage applications across a global
network of Microsoft-managed
datacenters
18. 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
Services
Applications
Data
Auth
Notifications
19. 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
20. 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
26. Mobile Services
Easily build cloud back-ends
Data, identity, push notifications, and
scheduled scripts
Windows Store, Windows Phone, iOS, and
Android
29. 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
30. 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
https://Mobileservice.azure-mobile.net/tables/*
31. 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)
32. 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
33. The User object
User.level
Anonymous
Authenticated
Admin
User.userId
Provider:id or undefined
User.getIdentities()
UserId
Provider Access Token / Secret
35. 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
36. 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)
43. 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
44. 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
46. 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
Speaking Points:There are numerous terms and definitions floating around in the industry for “the cloud”, “cloud computing”, “cloud services”, etc.Microsoft thinks of the cloud as simply an approach to computing that enables applications to be delivered at scale for a variety of workloads and client devices.The cloud can help deliver IT as a standardized service…freeing you up to focus on your business
Speaking Points:There are numerous terms and definitions floating around in the industry for “the cloud”, “cloud computing”, “cloud services”, etc.Microsoft thinks of the cloud as simply an approach to computing that enables applications to be delivered at scale for a variety of workloads and client devices.The cloud can help deliver IT as a standardized service…freeing you up to focus on your business
Speaking Points:Windows Azure itself is deployed around the worldWith Windows Azure, we have a concept of regions, which is where you choose to place your code and run. In each of the regions, we have a Microsoft datacenter. These datacenters are massive facilities that host 10s or in some cases hundreds of thousands of serversWe have currently four regions in North America, two regions in Europe, and two in AisaAs you can see on this slide we also have a number of CDN edge points, which we can use to cache your content and deliver it even faster for customers. %What you’re going to see in the next couple months and years is that we will rapidly expand our datacenter footprint around the world, so you will have more options for running your applications. Once you build an application, you can choose where you want to run in the world and you can move your workloads from region to region. You can also run your application in multiple regions simultaneously and just direct traffic and customers to whichever version of the app is closest to them. That gives you a global footprint and a chance to reach a bigger customer base or audience in new marketsNotes:Windows Azure services such as compute and storage are now available in 8 worldwide datacenters with an additional 24 Content Delivery Network endpoints. You can’t have a real cloud without a data center.
Speaking Points:The final thing I’ll mention about Windows Azure, before we dive into the tour of services is the approach we’re taking with paying for services.This maybe different for many of you who are familiar with hosting providers and on-premises systems. With Windows Azure you pay only for what you use.There are no upfront costThere is no need to buy any up front server licenses, that’s just included in the priceLikewise if you use a SQL database, through our SQL Database feature in Windows Azure, you don’t have to buy a SQL Server license, that’s also included in the price. For compute services such as Virtual Machines and Web Sites you only pay by the hour. This gives you the flexibility to run your applications very cost effectively. You can scale up and scale down your solutions or even turn them on and off as necessary. This also opens up a ton of possibilities in terms of the new types of apps you can build
Microsoft believes that PaaS provides the best foundationfor creating, running and managing custom applicationsWindows Azure Websites is a scalable, secure and flexible platform for building powerful web applications to run your business, drive your brand or reach new customers.
Slide Objectives:Detail the differing compute options and scenarios where each would be used
Slide Objectives:Explain the three scale choices on Windows Azure Web Sites.Notes:Both free and shared are the same architecture. With standard you isolate your application to your own virtual machines that you can use and pay for whatever resources you choose.Online Resources:If you’d like more details on Web Site pricing and quota, see the Windows Azure pricing page here: http://www.windowsazure.com/en-us/pricing/details/web-sites/
Speaking Points:Transition:So we’ve seen three ways to run your code in Windows Azure - Virtual machines, Web Sites, and Cloud ServicesNow let’s look at the fourth compute service called Windows Azure Mobile Services.DefinitionMobile Services is an exciting new service that we introduced about three months ago and we’ve rapidly been updating with new features and services. I’m sure that many of you today are building device applications that need connectivity to services and data. Mobile Services are designed specifically to make it really simply for you to build cloud back-ends that power mobile device applications by providing common functionality you need as configurable services. Features:Mobile Services provides the ability to easily store and retrieve data, manage users with several different identify providers including Microsoft Account, Twitter, Facebook, and Google accounts, and the ability to send push notifications to devices. Today Mobile Services has native SDKs for Windows 8 Store applications, Windows Phone apps, and iOS applications. We’re also adding Android and HTML5 support in the near future.
Slide Objectives:Explain what a Backend-as-a-service isExplain the features (at a high level) that Mobile Services offersTransition:Let’s answer the question, what is Mobile Services?Speaking Points:Mobile Services is a Backend-as-a-Service (BaaS).Instead of coding, testing, deploying, and maintaining your own backend, you spin up a Mobile Service and can instantly take advantage of a ton of great features.These features include:Data storage powered by SQL Database (but not requiring you to be a DBA)Simple and easy to use push notificationsUser authentication and data authorizationServer side logic so you can craft how your application will function on the server.Scaling – so you can meet the demand of your mobile apps when they get featuredLogging and Diagnostics so you can get insight into how your Mobile Service is workingBackend processing using something called SchedulerNotes:You may want to mention at this time that support exists for other platforms as well (Win Store, Win Phone, Android, iOS, HTML/JS, Xamarin, etc)
Slide Objectives:Explain how Mobile Services is backed by SQL Database and how that data is accessibleTransition:We just saw a great example of how our apps can make use of the data storage capabilities of Mobile ServicesSpeaking Points:Without having to do more on the server side than say we wanted a table named TodoItem, we were able to start storing data in our databaseWe created a new DB for this Mobile Service, but, we can use the same database for multiple mobile services. This is possible because each table created has it’s schema (sort of like a prepended name) set to the name of that mobile service.We just saw in the portal that you can see your data. You can also delete individual rows or clear out (truncate) whole tables. Additionally you can access the data from:The SQL Portal – a silverlight tool used to do DB administration SQL Management Studio – the windows based DB administration toolThe REST API – automatically used by the Mobile Services SDK, can also be accessed from anything capable of doing HTTP callsCommand Line Interface tools – we’ll look more at these later.Notes:
Slide Objectives:Explain the REST APIContinue to point out that the REST API allows anything capable of HTTP to talk to your Mobile Service even if there isn’t an SDKTransition:Let’s talk more about the REST APISpeaking Points:Whenever you generate a table, the REST API is auto created for youEach of the operations for your table are available from https://yourmobileservice.azure-mobile.net/tables/*Operations match up like so:Create – POSTRead – GETUpdate – PATCHDelete – DELETEFor reading items, you can use the SDK to generate a filter (as we did to filter out completed items) which will automatically be converted to an ODATA filter in the query string and then to a SQL query on the server side.Notes:
Slide Objectives:Explain how Mobile Services maps data types sent over as JSON to SQL types when it uses dynamic schematization to create new columnsTransition:Let’s talk about how Mobile Services creates new DB columns nextSpeaking Points:As we said before, Mobile Services uses Dynamic Schematization to inspect the data you send over to create new columnsThis is the mapping it uses:Numbers are stored as float(53)Booleans are stored as a bitDateTime are stored as DateTimeOffset(3)Strings are stored as nvarchar(max)Notes:You may want to point out that we’re looking to add other types (i.e. GEO) in the future
Slide Objectives:Detail Auth optionsSpeaking Points:Windows Azure Mobile Services enables you to set the following permissions on table operations: Everyone: This means that any request for the operation against the table is accepted. This option leaves your data wide-open for everyone to access. Anybody with the Application Key: Only the correct application key is required to perform the operation. The application key is distributed with the application. Because this key is not securely distributed, it cannot be considered a security token. To secure access to you mobile service data, you must implement authentication. Only Authenticated Users: Only authenticated users are permitted to perform the operation. In this preview release, clients are authenticated by Live Connect services. Scripts can be used to further restrict access to tables based on an authenticated user. Only Scripts and Admins: The operation requires the service master key, which limits the operation only to registered scripts or to administrator accounts. The user parameter is available in all server side scripts methods and can be used to add more granular auth polices on you CRUD operationsNotes:
Slide Objectives:Review what the User object gets you access to inside your scriptsTransition:n/aSpeaking Points:You may have noticed earlier that one of the parameters to my scripts is a user objectThis user object has a few important properties and methodsFirst the level property tells us if the calling user is Anonymous, Authenticated, or an AdminThe userId will give us their ID which is either undefined or provider:idLastly, there is a method call getIdentites() which will give us both the User ID but also the provider access token / secretSo if you need to get the actual information back from the provider (i.e. Twitter) to do something (i.e. Tweet on behalf of the user) that method is how you would do itNotes:
Slide Objectives:Detail the types of notifications available with WNSDetail how WNS Authcredentails are captured Detail the API namespace for pushSpeaking Points:Talk through slideRaw notification support coming soon. Notes:
Slide Objectives:Explains how notifications work without Service Bus Notification HubSpeaker Notes:Main challengesPlatform dependency – code multiple interfaces in the backendScale – PNS handle needs to be refreshed when app is launched; Most PNSs don’t support multicastingRouting – not able to filter messages by custom criteriahttp://msdn.microsoft.com/en-us/library/windowsazure/jj927170.aspx
Slide Objectives:Start talking about server side scriptsTransition:Speaking Points:In addition to creating a REST API when you generate a table, Mobile Services also creates scripts which intercept CRUD requests against your tableAs Mobile Services is built off of Node.js, these scripts are Node style scriptsBy default these scripts just pass through whatever you have sent over to SQL DBHowever, you can customize your own logic in these scripts to do whatever you wantNotes:
Slide Objectives:Mention some of the modules available out of the box in the server side scriptsTransition:There is a ton of stuff you can do in the scripts and we’ve exposed several modules already to make doing things easySpeaking Points:Some of the modules available out of the box areRequest – for performing http requests to third party servicesPush.* - for doing push notifications with APNS, GCM, WNS, MPNSConsole – for logging informationMSSQL – for performing custom SQL queries and calling stored proceduresstatusCodes – for returning a status code other than what is expectedAzure – for getting access to Windows Azure Table and Blob storage, queues, service bus, etcWe also have several partners in the Windows Azure store who offer you other abilitiesSendgrid – allows sending emailsPusher – facilitates web socket style real time communication down to mobile apps and websitesTwilio – sends SMS messages and offers some other voice capabilitiesIn addition to the modules available out of the box. If you enable source control on your mobile service you can then use the node package manager npm install to install any available node package (e.g twitter, imageprocesing, anything) into your mobile service.Notes:
Slide Objectives:Explains how notifications work withService Bus Notification HubSpeaker Notes:Main benefitsMultiple-platforms – common interface to send notifications to all supported platformsPub/Sub routing – devices specify tags when register with notification hubScale – notification hubs scale to millions of devices without the need of architecting or shardinghttp://msdn.microsoft.com/en-us/library/windowsazure/jj927170.aspx
Slide Objectives:Review Custom APITransition:Earlier we saw how to execute scripts during a CRUD operation against a table. Sometimes you don’t want to hit a table because you’re not necessarily doing anything with SQLSpeaking Points:This is easy to accomplish with Custom APIA Custom API is a non-table based script that is exposed by a REST API with the following methods:GETPOSTPUTPATCHDELETEYou can set permissions on these operations just like with table operationsNotes:
Slide Objectives:Detail the storage options available within Windows Azure
Slide Objectives:Review Script Source Control, Shared Scripts, and NPM supportTransition:When Mobile Services was launched, you were limited to editing scripts in the portal and using only the modules we made availableSpeaking Points:Thankfully now, we’ve opened things up so you can do so much more.Script source control allows you to:Create a Git repo where you can pull and push your table, scheduler, custom API scripts and permissionsEnables you to work on your scripts locally and push them to your Mobile ServiceShared Scripts enable you to:Put functionality you need in several places into a single script which you then mark as exportedYou can then require these scripts from your table, scheduler, and custom API scriptsJust like creating an NPM moduleNPM support allows you to install from the vast array of NPM modules publicly available and then use from your other scriptsNotes:
Slide Objectives:Review tiersTransition:Let’s look at the tiers in more detailSpeaking Points:Review each tier and how it differsFor SQL Database, explain there is a 20mb free DB you can use (one per sub) but SQL is charged SEPARATELY from Mobile ServicesNotes:Pricing has been left off of this slide in case of changes but you should have a good idea of what the pricing per unit should be going into this