Top Banner
Windows Azure Lessons from the Field
26

Windows Azure: Lessons From the Field

Jun 02, 2015

Download

Technology

Michael Collier

The demos and presentations that show you how awesome a certain technology is are certainly exciting. But, let’s be real – there are often times when the demo “happy path” doesn’t work for real-world projects. Creating production ready Windows Azure applications often require deviating from the “next, next, publish, magic, let’s party” path often seen. In this session we will pull back the curtains on common Windows Azure scenarios such as debugging and diagnostics, environment setup, build and deployment process, Access Control Services (ACS), and role upgrades – just to name a few. Coming away from this session you’ll have gained valuable, real-world inspired knowledge you can apply to your Windows Azure applications right now!
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Windows Azure: Lessons From the Field

Windows AzureLessons from the Field

Page 2: Windows Azure: Lessons From the Field

National Architect,

Windows Azure

[email protected]

@MichaelCollier

www.MichaelSCollier.com

Michael Collier

Page 3: Windows Azure: Lessons From the Field

• Table Storage• Access Control Service (ACS)• Windows Azure Diagnostics• Retry Logic• Deployment• Environments• Tools• Sell it!

What We Are Talking About

Page 4: Windows Azure: Lessons From the Field

• Non-relational data storage• Massive scale (100TB per storage account)• Single Key (Partition Key + Row Key)• Range based partitioning• Requires a different way of thinking

– Multiple entity types in a single table

– Group data into logical units – a partition

– More than 1 key data point? Create your own composite key.

Windows Azure Table Storage

Page 5: Windows Azure: Lessons From the Field

Windows Azure Table StoragePartitionKey

RowKey CourseName Comment CommentCount

43040 0:dafce7ed-47ff-474a-a94c-8b7d555394c1

Darby Creek 1

43040 1:dafce7ed-47ff-474a-a94c-8b7d555394c1:2520576021677371563:b3abfc42-4e66-4306-b39b-c3972fde5ac7

Fast greens!

43012 …. Timberview 5

43016 …. Buck Ridge 3

43016 ….. Great sand!!

Record Type

CourseId

Timestamp

CommentId

Page 6: Windows Azure: Lessons From the Field

Windows Azure Table Storage

public IEnumerable<Course> SelectAllCourses() {var tableClient = storageAccount.CreateCloudTableClient();var ctx = tableClient.GetDataServiceContext(); var results = (from c in ctx.CreateQuery<Course>(tableName)                   where c.RowKey.CompareTo("0:") >= 0 && c.RowKey.CompareTo("0;") < 0 select c).AsTableServiceQuery().ToList();return results; }

Select all the Course entities

Page 7: Windows Azure: Lessons From the Field

Plan for retries

Windows Azure Table Storage

public void Add (Course course, Comment comment){

var tableClient = storageAccount.CreateCloudTableClient();    var ctx = tableClient.GetDataServiceContext();

ctx.AddObject(tableName, course);             ctx.AddObject(tableName, comment);             

ctx.SaveChangesWithRetries(SaveChangesOptions.Batch);}Handle entity group transactions too!

Page 8: Windows Azure: Lessons From the Field

• Claims-based authentication service• Leverages Windows Identity Foundation (WIF)• No need to build your own identity management

solution. What’s your value-add?

• Multiple identity providers– Facebook, Windows Live, Google, Yahoo!, ADFSv2

• Most demos and walkthroughs show how easy ACS is to add . . . But there’s more.

Access Control Service (ACS)

Page 9: Windows Azure: Lessons From the Field

• Install WIF runtime via a startup task• DPAPI not supported – use your own certificate• Change request validation

– Use ASP.NET 2 request validation– Custom validator

Access Control Services (ACS)

Page 10: Windows Azure: Lessons From the Field

• WIF relies on the web.config file• URLs related to the site are set in the web.config . . .

can’t change• Problematic for staging deployments – don’t know the

URL until deployed• Add logic to WebRole’s OnStart() to update the WIF

settings in web.config– Read in configuration settings from .cscfg

– Update and save the web.config

– Changing .cscfg settings can cause a role recycle . . . causing web.confg to update

Access Control Service (ACS)

Page 11: Windows Azure: Lessons From the Field

• Need claims not provided by Identity Provider?– Claims vary by Identity Providers– Windows Live ID – limited usefulness

– Claims Enrichment– Custom implementation of ClaimsAuthenticationManager– Retrieve additional info from data store– Return as additional claims

Access Control Service (ACS)

Page 12: Windows Azure: Lessons From the Field

DEMO TIME!!!

Page 13: Windows Azure: Lessons From the Field

• Ability to persist multiple diagnostic sources across roles

– Log Files

– Event Logs

– Performance Counters

– IIS Logs

• Diagnostics data saved in table or blob storage• Different storage account for diagnostic & app data• Use multiple diagnostic storage accounts & rotate

– Easiest way to clean up large amounts of data in tables

Windows Azure Diagnostics

Page 14: Windows Azure: Lessons From the Field

Configuration via code is easy . . .

. . . but potentially problematic

Windows Azure Diagnostics

Page 15: Windows Azure: Lessons From the Field

• Set diagnostic information via configuration• Special file – diagnostics.wadcfg• File automatically saved to blob storage and accessible

from all instances• Don’t get out of sync• Diagnostics config in code overwrites what is in blob

storage• Allows operations team, not dev, to control settings

Windows Azure Diagnostics

Page 16: Windows Azure: Lessons From the Field

Windows Azure Diagnostics

Page 17: Windows Azure: Lessons From the Field

• Configure Remote Desktop early

• Requires an input endpoint• Changing number of endpoints requires a delete and

redeploy– Can’t perform a VIP swap

• Don’t want it on all the time? Change the settings in .cscfg.

Remote Desktop . . . Your Friend

Page 18: Windows Azure: Lessons From the Field

• Transient Fault Handling Application Block• SQL Database, Windows Azure Storage, Service Bus,

and more• Very extensible and flexible

Plan for Failure – Try, And Try Again!

Page 19: Windows Azure: Lessons From the Field

Plan for Failure . . . And Try Again!

Page 20: Windows Azure: Lessons From the Field

• Upload .cspkg & .cscfg files to Windows Azure portal• Use Visual Studio• Use Windows Azure PowerShell cmdlets

– Humans make mistakes . . . Not good at repetitive tasks

– Handle nearly everything via script

– Works great in development and for production!

– Invoke from other deployment tools like Team Build

– Have a .cmd file that will execute the build and then kick off the deployment

• Put deployment files in blob storage for quick access later

Deployments

Page 21: Windows Azure: Lessons From the Field

• Use subscriptions to control access and billing.

• Get billing and subscription administrators set up . . . . Very difficult to change later (especially the Live ID for account owner)

Logical Environments

Development ProductionQA

Staging

Production

Staging

Production

Staging

Production

• Developers create & deploy services in ‘Development’ as needed. Co-admins for the ‘Development’ subscription.

• QA teams have access to QA. They are co-admins for the QA subscription.

• Operations team is co-admins for ‘Production’.

CS CS

CS DB

CS CS

CS DB

CS

DB

CS

DB

CS

CS

DB

Page 22: Windows Azure: Lessons From the Field

Cloud Storage Studio

Diagnostics Manager

Management Cmdlets

http://azurestorageexplorer.codeplex.com/

Get a Storage ToolNeudesic Azure Storage Explorer Cerebrata

Page 23: Windows Azure: Lessons From the Field

• What are your pain points?– Cost pressures

– Slow to deploy

– Scalability

– Security

• Scenarios– Web Modernization

– Gaming

– Mobility

– Big Data

– Enterprise Application Integration

Awesome! Now Sell It!!

Page 24: Windows Azure: Lessons From the Field

Questions?

Page 25: Windows Azure: Lessons From the Field

• WIF: A Potentially Dangerous Request.Form Value Was Detected– http://

social.technet.microsoft.com/wiki/contents/articles/1725.windows-identity-foundation-wif-a-potentially-dangerous-request-form-value-was-detected-from-the-client-wresult-t-requestsecurityto.aspx

• Install WIF Runtime via Startup Task– http://stackoverflow.com/questions/8697596/azure-service-configuration-error

• Edit & Apply New WIF Config Settings w/o Redeploying– http://

blogs.msdn.com/b/vbertocci/archive/2011/05/31/edit-and-apply-new-wif-s-config-settings-in-your-windows-azure-webrole-without-redeploying.aspx

• Publishing a ACS v2 Federated Identity Web Role– http://blogs.msdn.com/b/davidmcg/archive/2011/04/05/publishing-a-acs-v2-federated-identity-web-role.aspx

• Windows Azure Active Directory Solutions For Developers– http://

social.technet.microsoft.com/wiki/contents/articles/3669.windows-azure-active-directory-solutions-for-developers.aspx

• How to get most out of Windows Azure Tables– http://

blogs.msdn.com/b/windowsazurestorage/archive/2010/11/06/how-to-get-most-out-of-windows-azure-tables.aspx

• Collecting Logging Data by Using Windows Azure Diagnostics– http://msdn.microsoft.com/en-us/library/windowsazure/gg433048.aspx

A Few Great Resources

Page 26: Windows Azure: Lessons From the Field

National Architect,

Windows Azure

[email protected]

@MichaelCollier

www.MichaelSCollier.com

Thank You