Inspired by one of the Windows Azure gods (Wade Wegner), Maarten and Panos decided to order a homebrewing starter kit. Being total cloud fanboys, they decided to hook their delicious creations to the cloud. Join us and discover how you can connect a variety of devices (like *duino) and USB temperature sensors to Windows Azure to monitor brewing and fermentation temperatures. We'll show you how to do distributed brewing in this fun yet practical session on an interesting use case for the cloud: beer.
Generative AI for Technical Writer or Information Developers
Brewing Beer with Windows Azure API
1. #londonazure
Brewing Beer with Windows Azure
Maarten Balliauw
@maartenballiauw
SEPTEMBER 24, 2012 | SLIDE 1
2. #londonazure
Who am I?
Maarten Balliauw
www.realdolmen.com
AZUG
Focus on web
ASP.NET MVC, Windows Azure, SignalR, ...
MVP Windows Azure & ASPInsider
http://blog.maartenballiauw.be
@maartenballiauw
SEPTEMBER 24, 2012 | SLIDE 3
3. #londonazure
Shameless commercial plug
Pro NuGet:
http://amzn.to/pronuget
MyGet - NuGet-as-a-Service:
http://www.myget.org
SEPTEMBER 24, 2012 | SLIDE 4
4. #londonazure
Agenda
Brewing beer
BrewBuddy
Windows Azure Websites
Service Bus & Access Control Service (ACS)
We need an API
Q&A
SEPTEMBER 24, 2012 | SLIDE 5
5. #londonazure
Turn water into beer
BREWING BEER
SEPTEMBER 24, 2012 | SLIDE 6
12. #londonazure
Maarten…
What does this have
to do with Windows Azure?
SEPTEMBER 24, 2012 | SLIDE 13
13. #londonazure
Azurifying the home brewer
WWW.BREWBUDDY.NET
SEPTEMBER 24, 2012 | SLIDE 14
14. #londonazure
BrewBuddy
View public recipes
Manage your own recipes
Manage your own brews
Monitor brew fermentation
SEPTEMBER 24, 2012 | SLIDE 15
15. #londonazure
BrewBuddy
Social brewing at a glance
demo
SEPTEMBER 24, 2012 | SLIDE 16
16. #londonazure
Architecture
Sensor Public website
Windows Azure Web Sites
Whatever…
Database
SQL Azure database
Sensor data Sensor data processing
Service Bus topic Windows Azure Worker Role
SEPTEMBER 24, 2012 | SLIDE 17
17. #londonazure
Scale-fast has just become more interesting
WINDOWS AZURE WEB SITES
SEPTEMBER 24, 2012 | SLIDE 18
18. #londonazure
Windows Azure Web Sites
Build with ASP.NET, Node.js or PHP
Deploy in seconds with FTP, Git or TFS
Start for free, scale up as your traffic
grows
SEPTEMBER 24, 2012 | SLIDE 19
19. #londonazure
Windows Azure Web Sites
shared 1
SHARED INSTANCES
SEPTEMBER 24, 2012 | SLIDE 20
20. #londonazure
Windows Azure Web Sites
shared 2
SHARED INSTANCES
SEPTEMBER 24, 2012 | SLIDE 21
21. #londonazure
Windows Azure Web Sites
reserved 0
1
SHARED INSTANCES RESERVED INSTANCE
SEPTEMBER 24, 2012 | SLIDE 22
23. #londonazure
Windows Azure Web Sites
reserved 2
RESERVED INSTANCE RESERVED INSTANCE
SEPTEMBER 24, 2012 | SLIDE 24
24. #londonazure
A perfect ramp-up!
Start small
Web Sites are cheap
Scale to 3 reserved instances
Grow big!
Hosted Service – PaaS
Scale at will
SEPTEMBER 24, 2012 | SLIDE 25
25. #londonazure
Windows Azure Web Sites
Creating a new web site in seconds
demo
SEPTEMBER 24, 2012 | SLIDE 26
26. #londonazure
Connecting sensors
SERVICE BUS &
ACCESS CONTROL SERVICE
SEPTEMBER 24, 2012 | SLIDE 27
27. #londonazure
Windows Azure Service Bus
2 features
Relay
Queues, Topics, Subscriptions
SEPTEMBER 24, 2012 | SLIDE 28
30. #londonazure
Characteristics
Workers can scale independently
Workers can fail independently
Sensors connect to service bus directly
No layer in between
Cheaper
SEPTEMBER 24, 2012 | SLIDE 31
31. #londonazure
What about authN / authZ?
Access Control Service to the rescue!
SB authenticates clients over ACS
ACS provides “Send” claim to sensor
Claims can be granted/revoked easily
SEPTEMBER 24, 2012 | SLIDE 32
32. #londonazure
Access Control Service
Claims for authZ on Service Bus
demo
SEPTEMBER 24, 2012 | SLIDE 33
33. #londonazure
Architecture
Sensor Public website
Windows Azure Web Sites
Whatever…
Sensor management Database
Access Control Service SQL Azure database
Sensor data Sensor data processing
Service Bus topic Windows Azure Worker Role
SEPTEMBER 24, 2012 | SLIDE 34
34. #londonazure
How do you link a sensor?
Every sensor has its sensor ID
Add it as an identity to ACS
Grant a “Send” claim
SEPTEMBER 24, 2012 | SLIDE 35
35. #londonazure
Linking a a sensor with Access Control
Registering sensor to a brew
Service
demo
SEPTEMBER 24, 2012 | SLIDE 36
36. #londonazure
<french>Make everyone API!</french>
WE NEED AN API
SEPTEMBER 24, 2012 | SLIDE 37
37. #londonazure
Consuming the web
2000-2008: Desktop browser
2008-2012: Mobile browser
2008-2012: iPhone and Android apps
2010-2014: Tablets, tablets, tablets
2014-2016: Your fridge (Internet of Things)
SEPTEMBER 24, 2012 | SLIDE 38
41. #londonazure
What is an API?
Software-to-Software interface
Contract between software and
developers
Functionalities, constraints (technical / legal)
Programming instructions and standards
Open services to other software
developers (public or private)
SEPTEMBER 24, 2012 | SLIDE 42
42. #londonazure
Expose services to 3rd parties
Valuable
Flexible
Managed
Supported
Have a plan
SEPTEMBER 24, 2012 | SLIDE 43
43. #londonazure
Reach More Clients
SEPTEMBER 24, 2012 | SLIDE 44
44. #londonazure
ASP.NET Web API
Part of ASP.NET MVC 4
Framework to build HTTP Services (REST)
Solid features
Modern HTTP programming model
Content negotiation (e.g. Xml, json, ...)
Query composition (OData query support)
Model binding and validation (conversion to .NET objects)
Routes
Filters (e.g. Validation, exception handling, ...)
And more!
SEPTEMBER 24, 2012 | SLIDE 45
46. #londonazure
ASP.NET Web API
Let’s craft a quick API
demo
SEPTEMBER 24, 2012 | SLIDE 47
47. #londonazure
What about authN / authZ?
API access through OAuth2
Access Control Service to the rescue!
Client authorized in BrewBuddy.net
Access/refresh tokens through ACS
SEPTEMBER 24, 2012 | SLIDE 48
48. #londonazure
What about authN / authZ?
API Consumer BrewBuddy.net
client_id and client_secret access API
authorize Initial authorization (yes/no)
API implementation
access/refresh token register delegation
Access Control Service
Access/Refresh Token
SEPTEMBER 24, 2012 | SLIDE 49
49. #londonazure
Install-Package WindowsAzure.Acs.Oauth2 -IncludePrerelease
Access Control Service for API’s
OAuth2 delegation
demo
SEPTEMBER 24, 2012 | SLIDE 50
50. #londonazure
TAKEAWAYS
SEPTEMBER 24, 2012 | SLIDE 51
51. #londonazure
Keep in mind…
Web Sites start cheap / scale fast
Combine/grow at will (IaaS, PaaS, SaaS)
Service bus for asynchrony and scale
Access Control for devices
Web API & Access Control
SEPTEMBER 24, 2012 | SLIDE 52
52. #londonazure
Cloud Burst 2012 - Sweden
September 27 – 28, 2012
Stockholm
http://www.azureug.se/CloudBurst2012
There will be live streaming!
http://bit.ly/cloudburststream
SEPTEMBER 24, 2012 | SLIDE 53
Don’t show everythingyet. Just log in, show themaround the recipes, brewsand public recipes. Feel free to show the monitoring but no needto display the linking of sensors.
Show Windows Azure Web SitesShow scaling / reservedinstances
Show peoplearound the ACS porta. Show identities, claims andrulegroups.
Link a sensor to a brew. Show the effect on ACS. Show the code.
A couple of years ago, having a web-based application was enough. Users would navigate to it using their computer’s browser, do their dance and log out again. Nowadays, a web-based application isn’t enough anymore. People have smartphones, tablets and maybe even a refrigerator with Internet access on which applications can run. Applications or “apps”. We’re moving from the web towards apps.
A great example of an API is Twitter. They have a massive data store containing tweets and data related to that. They have user profiles. And a web site. And an API. Are you using www.twitter.com to post tweets? I am using the website, maybe once a year. All other tweets come either from my Windows Phone 7’s Twitter application or through www.hootsuite.com, a third-party Twitter client which provides added value in the form of statistics and scheduling. Both the app on my phone as well as the third-party service are using the Twitter API. By exposing an API, Twitter has created a rich ecosystem which drives their real value: data.
If you want to expose your data and services to external third-parties, you may want to think about building an API. Having an API gives you a giant advantage on the Internet nowadays. Having an API will allow your web application to reach more users. App developers will jump onto your API and build their app around it. Other websites or apps will integrate with your services by consuming your API. The only thing you have to do is expose a valuable, managed and supported API and get people to know it. Apps will come. Integration will come.
The mainidea of API’s is tobroadenyourreach. Youcan’tcreateappsthatcanbeused on every fridge out there, it’s way toocostly. But ifyou have a valuable service which is supported, peoplewillbuildappsaround it. Andifitmakes sense toanyonetocreate a fridge app on top of your API, itwill happen.
Be detailed! Usegood status code responses. 201 CREATED is probablybetterthanjust 200 OK whencreating a new entity.+ demo Fiddleragainst HTCPCP deployment out there
Link a sensor to a brew. Show the effect on ACS. Show the code.
Show peoplearound the ACS porta. Show identities, claims andrulegroups.