31
How to use Windows Azure features on Windows 8 Radu Vunvulea [email protected] http://vunvulearadu.blogspot.com

How to use windows azure features on windows

Embed Size (px)

DESCRIPTION

In this session we are going to take a look of Windows Azure features that can help us to write better applications for Windows 8. A Metro style app (and not only) need to communicate with different services and load different resources from different locations from internet. Windows Azure is a very good place to host and store these resources.

Citation preview

Page 1: How to use windows azure features on windows

How to use Windows Azure features on

Windows 8

Radu [email protected]

http://vunvulearadu.blogspot.com

Page 2: How to use windows azure features on windows
Page 3: How to use windows azure features on windows

How to use Windows Azure features on

Windows 8

Radu [email protected]

http://vunvulearadu.blogspot.com

Page 4: How to use windows azure features on windows

• A short introduction in Metro App • Push Notifications• Scenario 1• Scenario 2• Scenario 3• Shared Access Signature• Scenario 4• Scenario 5• Conclusion

Agenda

Page 5: How to use windows azure features on windows

• Focus on user experience

Metro Style application

Page 6: How to use windows azure features on windows

• Focus on user experience• Consistent UI through all the applications

Metro Style application

Page 7: How to use windows azure features on windows

• Focus on user experience• Consistent UI through all the applications• Do one think, but do it best

Metro Style application

Page 8: How to use windows azure features on windows

• Tables• Blobs• Queues• Service Bus• SQL Azure• Push Notifications• Shared Access Signature• Web roles• Worker roles• Cache roles• Virtual Machines roles• ... and a lot more

What does Windows Azure offers to us

Page 9: How to use windows azure features on windows

• Using this mechanism we can send toasts, badges, tiles and row notifications to the client application

• The send request notifications can be send from a cloud service

Push Notifications

Metro Style App

Cloud Service

Windows Push Notification Service

Notification Client Platform

Page 10: How to use windows azure features on windows

Scenario 1

Windows Azure

Page 11: How to use windows azure features on windows

• Use table storage to store what each patient eat at each meal

• The price for storing data in table storage is very low

Problem• How user can have limited access to only one part of the

table ?

Scenario 1 – Azure Tables

Timestamp Partition Key Row Key … … …

2005-10-30 T 10:45 UTC

Client ID Meal type

Page 12: How to use windows azure features on windows

Problem• How user can have limited access to only one part of the

table?

Solution• We can use Shared Access Signature

• What we can do with Shared Access Signature• Limit access of the user to only a specific numbers of

tables• Limit access to a specific partition key and row key

intervals• Limit what kind of actions a user can do on the table• Give access to a resource for a specific time interval

Scenario 1 - Azure Tables + SAS

Page 13: How to use windows azure features on windows

• Limit user access to a specific Windows Azure resource• Types of resources:

• Tables • Queues• Blobs and containers

• You don’t need to know or register user LIVE account• The only thing that you share with the user is a token• User can access your resource based on a token

What is Shared Access Signature

Page 14: How to use windows azure features on windows

• Create the access policySharedAccessTablePolicy tablePolicy = new SharedAccessTablePolicy() {

Permissions = SharedAccessTablePermissions.Query | SharedAccessTablePermissions.Add,

SharedAccessExpiryTime = DateTime.UtcNow + TimeSpan.FromHours(1)

};• Assign permissionsTablePermissions tablePermissions = new TablePermissions(); tablePermissions.SharedAccessPolicies.Add(

"Client1", tablePolicy);

myTable.SetPermissions(tablePermissions);• Generate the access token signaturetableToken = myTable.GetSharedAccessSignature(

new SharedAccessTablePolicy(), "Client1_1", 10, 0, 19, 100);

How to create a SAS for Azure Tables

Page 15: How to use windows azure features on windows

• Create the access signaturevar sharedAccessSignature = myBlob.GetSharedAccessSignature(

new SharedAccessPolicy() {

Permissions = SharedAccessPermissions.Write | SharedAccessPermissions.Read,

SharedAccessExpiryTime = DateTime.UtcNow + TimeSpan.FromHours(1);

} • Generate access URLstring sharedAccessSignatureUri = blob.Uri.AbsoluteUri + + sharedAccessSignature;• Use the access signaturevar storageCredentialsSAS = new StorageCredentialsSharedAccessSignature( sharedAccessSignature); var blobClient = new CloudBlobClient(

myAccount.BlobEndpoint, storageCredentialsSAS);

var myBlob = blobClient .GetBlobReference(“myContainer/firstBlob.txt”); string currentContentOfBlob = myBlob.DownloadText(); myBlob.UploadText(“New text appended”);

How to create a SAS for Azure Blobs

Page 16: How to use windows azure features on windows

• Create the access signatureSharedAccessQueuePolicy sharedAccessPolicy = new SharedAccessQueuePolicy() {

Permissions = SharedAccessQueuePermissions .ProcessMessages, SharedAccessExpiryTime = DateTime.UtcNow + TimeSpan.FromHours(1) };string policyIdentifier = "QueuePolicy1"; QueuePermissions queuePermissions= new QueuePermissions(); queuePermissions.SharedAccessPolicies.Add(

policyIdentifier, sharedAccessPolicy);

myQueue.SetPermissions(queuePermissions);• Generate access token signaturestring accessSignature = myQueue.GetSharedAccessSignature(

new SharedAccessQueuePolicy(), policyIdentifier);

How to create a SAS for Azure Queues

Page 17: How to use windows azure features on windows

Scenario 2

Windows Azure

Page 18: How to use windows azure features on windows

• Store all content on Blob Storage• Cheap• Scalable • Can stream any type of content• Multiply devices of the same client can access the same

resources based on the Shared Access Signature• We can send the access token by email

Scenario 2 – Blob Storage

Page 19: How to use windows azure features on windows

Scenario 3

Windows Azure

Page 20: How to use windows azure features on windows

• Each document for processing a command is send to Azure queue

• The message from the queue can be consumed by the core application that process the message

• Limited access based on Shared Access Signature• The user that generate the requests will not be able to

read or pop any kind of messages from the queue

Scenario 3 – Azure Queues

Page 21: How to use windows azure features on windows

How to access Windows Azure content?

Page 22: How to use windows azure features on windows

Proxy

(1)

(2)

Web Role

Page 23: How to use windows azure features on windows

Shared Access Signature

(1)

(3)

Web Role (2) (4)

Page 24: How to use windows azure features on windows

• We are a well know photograph• We decide that we what to share our pictures with peoples that own a

Windows 8 tablet all around the world • Based on a subscriptions for each album we hope to make money• An album can contain 10 to n photos

How can we share this content with our clients?

Scenario 4

Page 25: How to use windows azure features on windows

• A simple solution is using blobs plus Shared Access Signature• For each client we create an access token that allow clients to access the

album for which they already paid• Over this structure we create a web-application that allow clients to

download the albums based on a token• We can use the token that is generated by Shared Access

Signature

Scenario 4 - Blobs

Page 26: How to use windows azure features on windows

Stock

• Let’s imagine an application that will display stock reports for each week• This information is generated based on a lot of computation power • Because of this the company decides to sell this valuable content based on

a weekly subscriptions• A client can have access only to information for the weeks that he paid• The client want to access this content from a Metro app created by us but

he also want to import this data in his own systems

Scenario 5

Page 27: How to use windows azure features on windows

• Store all the weakly report information on Azure Tables

• Create a service that give the user the ability to access report data based on a username and password

• Update and manage the username list and what reports they can access

Scenario 5 – Azure Tables

Page 28: How to use windows azure features on windows

• Store all the weakly report information on Azure Tables

• Create a service that give the user the ability to access report data based on a username and password

• Update and manage the username list and what reports they can access

• Define a Shared Access Policy based on partition key and row key

Partition Key – Week unique id (201234)Row Key – Report name

Scenario 5 – Azure Tables

Page 29: How to use windows azure features on windows

Conclusion

Page 30: How to use windows azure features on windows

Conclusion

Metro style apps are great to create a consistent, elegant & compelling user experience

Page 31: How to use windows azure features on windows

THE END

Radu [email protected]

http://vunvulearadu.blogspot.com