how to use windows azure features on windows

Post on 20-May-2015

627 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

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.

TRANSCRIPT

How to use Windows Azure features on

Windows 8

Radu Vunvuleavunvulear@gmail.com

http://vunvulearadu.blogspot.com

How to use Windows Azure features on

Windows 8

Radu Vunvuleavunvulear@gmail.com

http://vunvulearadu.blogspot.com

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

Agenda

• Focus on user experience

Metro Style application

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

Metro Style application

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

Metro Style application

• 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

• 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

Scenario 1

Windows Azure

• 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

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

• 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

• 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

• 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

• 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

Scenario 2

Windows Azure

• 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

Scenario 3

Windows Azure

• 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

How to access Windows Azure content?

Proxy

(1)

(2)

Web Role

Shared Access Signature

(1)

(3)

Web Role (2) (4)

• 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

• 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

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

• 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

• 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

Conclusion

Conclusion

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

THE END

Radu Vunvuleavunvulear@gmail.com

http://vunvulearadu.blogspot.com

top related