Redkar Windows Azure Platform Companion eBook Available this print for content only—size & color not accurate BOOKS FOR PROFESSIONALS BY PROFESSIONALS ® CYAN MAGENTA YELLOW BLACK US $44.99 Shelve in: Programming Languages | General User level: Intermediate–Advanced www.apress.com SOURCE CODE ONLINE Companion eBook See last page for details on $10 eBook version ISBN 978-1-4302-2479-2 9 781430 224792 5 44 9 9 Windows Azure Platform Dear Reader, Windows Azure is Microsoft’s operating system in the cloud and is a bold step towards commercializing Microsoft’s heavy investment in data centers globally. Windows Azure offers great benefit to enterprises, ISVs and developers in build- ing cloud services that offer dynamic provisioning, scale-up, and scale-down at the click of a button. The Windows Azure platform abstracts the data center hard- ware by providing you with auto-provisioning APIs and a series of clicks on the developer portal. Windows Azure offers the following business benefits—faster time to market by shortening the provisioning process, lower total cost of owner- ship by offering dynamic scale-up and scale-down capabilities, cross-platform and cross-enterprise integration via single sign-on capabilities, and end-to-end security across multi-vendor applications and services. These benefits can be leveraged by businesses in reducing the overall operating cost of applications and staying competitive in the market. The Windows Azure Platform offers three core services: 1. Windows Azure – Operating system in the cloud offering Compute, Storage, and Management capabilities 2. AppFabric – Middle-tier offering with Access Control Service and .NET Service Bus 3. SQL Azure – SQL server database in the cloud These three core services offer a base platform for developing distributed ser- vices that can be offered at a global scale to enterprises and consumers. In this book, I have created a conceptual deep-dive of the Windows Azure platform for developers by sharing with you fundamental concepts and interest- ing sample code that I have built along my learning process. My sincere hope is that this book will give you enough conceptual knowledge and sample code for not only kick-starting your cloud service projects but also architecting them at the enterprise level. Tejaswi Redkar Tejaswi Redkar, Author of Pro MSMQ: Microsoft Message Queue Programming, C# Threading Handbook, VB.NET Threading Handbook RELATED TITLES THE EXPERT’S VOICE ® IN .NET Windows Azure Platform Tejaswi Redkar Unlock the power of cloud computing 7.5 x 9.25 spine =1.15625" 624 page count www.it-ebooks.info www.it-ebooks.info Windows Azure Platform ■ ■ ■ TEJASWI REDKAR www.it-ebooks.info ii Windows Azure Platform Copyright © 2009 by Tejaswi Redkar All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2479-2 ISBN-13 (electronic): 978-1-4302-2480-8 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. President and Publisher: Paul Manning Lead Editor: Ewan Buckingham Technical Reviewer: Fabio Claudio Ferracchiati Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Anita Castro Copy Editor: Heather Lang, Tiffany Taylor, and Mary Ann Fugate Compositor: Kimberly Burton Indexer: Toma Mulligan Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com. For information on translations, please e-mail info@apress.com, or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. You will need to answer questions pertaining to this book in order to successfully download the code. www.it-ebooks.info iii This book is dedicated to my grandmother Vimal Sharad Redkar. She has been my inspiration for whatever I do. I thank my wife Arohi and my sons Aaryan and Dhruv for supporting me in writng this book. Arohi, I will never forget your sacrifices for making this book happen. I thank my sister, Aasawari for being with me when I needed her in the time of crisis. Finally, I thank my parents for their teachings that has shaped up my life. www.it-ebooks.info i v Contents at a Glance ■ABOUT THE AUTHOR xv ■ABOUT THE TECHNICAL REVIEWER xvi ■ACKNOWLEDGMENTS xvii ■CHAPTER 1: INTRODUCING CLOUD SERVICES 1 ■CHAPTER 2: WINDOWS AZURE PLATFORM OVERVIEW 53 ■CHAPTER 3: WINDOWS AZURE 105 ■CHAPTER 4: WINDOWS AZURE STORAGE PART I – BLOBS 205 ■CHAPTER 5: WINDOWS AZURE STORAGE PART II – QUEUES 267 ■CHAPTER 6: WINDOWS AZURE STORAGE PART III – TABLES 313 ■CHAPTER 7: APPFABRIC: ACCESS CONTROL SERVICE 371 ■CHAPTER 8: APPFABRIC SERVICE BUS 427 ■CHAPTER 9: SQL AZURE 505 ■INDEX 585 www.it-ebooks.info ■ CONTENTS v Contents ■About the Author xv ■About the Technical Reviewer xvi ■Acknowledgments xvii ■Chapter 1: Introducing Cloud Services 1 Defining Our Terms 3 Evolution of Cloud Services 4 Planning 7 Developing 7 Stabilizing 7 Deploying 7 Operating 7 Modeling Cloud Service Offerings 7 Consumer Services Layer 8 Enterprise Services Layer 9 Middleware Layer 9 Platform Layer 9 Shifting to the Cloud Paradigm 10 Understanding the Cloud Services Ecosystem 12 www.it-ebooks.info ■ CONTENTS CONTENTS vi Service Providers 12 Software Vendors 12 Independent Software Vendors 13 Enablers 13 Businesses 13 Cloud Services Drivers and Barriers 13 Security 14 Total Cost of Ownership 15 Control 15 Culture 16 Competition 16 Time to Market 16 Reliability 16 Service Level Agreement 17 Understanding Cloud Architecture 17 Getting to Know Some Cloud Services Vendors 19 Amazon Web Services 19 Google 39 SalesForce.com and Force.com 44 GoGrid 45 3Tera 46 Microsoft 46 Summary 50 Bibliography 51 www.it-ebooks.info ■ CONTENTS vii ■Chapter 2: Windows Azure platform Overview 53 Windows Azure Platform Overview 54 Windows Azure Platform Architecture 54 Basic Azure Scenarios 61 Scenario 1: Azure Software Development 63 Scenario 2: Cross-Enterprise Application Integration 63 Scenario 3: Enterprise Process Offloading 63 Scenario 4: Consumer Services (Live Mesh Synchronization) 64 Windows Azure Platform for Developers 64 Developer Roles 64 Developer Readiness 65 Getting Started 65 Windows Azure Developer Portal 68 AppFabricDeveloper Portal 75 SQL Azure Developer Portal 78 Building the Development Platform 79 Operating System 80 Software 80 Getting Started with Windows Azure Platform Development 81 Setting the Objectives 81 Understanding the Service Architecture 81 Understanding the Developer Workflow 82 Developing the Service 83 Deploying the Service 92 Example Summary 104 Summary 104 www.it-ebooks.info ■ CONTENTS CONTENTS viii Bibliography 104 ■Chapter 3: Windows Azure 105 Windows Azure Architecture 105 The Compute Service 110 Windows Azure API Structure 112 Developer Environment 113 Windows Azure Tools for Visual Studio 113 Windows Azure SDK Tools 128 Service Models 129 Development Fabric 138 Development Storage 140 Diagnostics 141 Logging 143 Developing Windows Azure Services with Inter-role Communication 145 Objectives 145 Adding Diagnostics and Inter-role Communication 145 Running the HelloAzureCloud Service 152 Developing a Web Role to Worker Role Message Exchange 165 Objectives 165 Service Architecture 165 System Information Message 167 The Components of the Solution 169 Geolocation 189 Enabling Geographic Affinity 190 Content Delivery Network 193 Windows Azure Service Management 194 www.it-ebooks.info [...]... This Book Term Definition Azure Microsoft’s Windows Azure Platform Azure Services The components of Windows Azure Platform (e.g., Windows Azure, SQL Azure, AppFabric, and Live Services) Cloud The cloud services platform (e.g., the Windows Azure platform) Cloud application An application deployed to a cloud services platform and typically part of a larger cloud service Cloud platform A service offering... Access 510 Code-Near Connectivity .510 Code-Far Connectivity 512 Getting Started with SQL Azure .513 Creating a SQL Azure Database 515 Connecting to a SQL Azure Database 517 Developing Windows Azure Services that Use SQL Azure .532 Service Description .532 Processes for Curtailment 532 Technical Architecture ... for deploying cloud services (e.g Windows Azure platform offered by Microsoft and EC2 offered by Amazon) Continued 3 www.it-ebooks.info CHAPTER 1 ■ INTRODUCING CLOUD SERVICES Table 1-1 Continued Term Definition Cloud service An end-to-end service deployed to the cloud platform that may contain one or more cloud applications Cloud services platform The same as a cloud platform, which is defined earlier... into this category because it offers software platforms like service bus and Access Control Service businesses can leverage for building and scaling custom services Platform Layer The platform layer forms the core foundation for all the other cloud services offerings in the pyramid The platform layer represents the computational, data storage, and network platforms ISVs, and software vendors can leverage... are ISV developers and infrastructure architects interested in leveraging this highly resilient platform in building end-to-end cloud services Amazon’s Elastic 9 www.it-ebooks.info CHAPTER 1 ■ INTRODUCING CLOUD SERVICES Compute Cloud (EC2), Microsoft Windows Azure, and Microsoft SQL Azure fall into the platform payer of the cloud services pyramid ■ Note Throughout this book, I will refer to the cloud... .585 xiv www.it-ebooks.info ■ CONTENTS About the Author ■ Tejaswi Redkar is a software architect with a passion for writing He has been working with Windows Azure since its first announcement during PDC 2008.He been working with Windows Azure early adopter customers and the product team for the past one year He believes that the best way to master a new technology is to either teach it or write... and mature As discussed in the scenario earlier, cloud services platforms relieves you of investing in expensive hardware and IT resources for maintaining a highly available and scalable infrastructure Cloud platforms are designed to be used on demand The cost of the platform is directly proportional to its usage The more you use the platform, the more you pay, and vice a versa These dynamic capabilities... the concept of utility computing a reality in terms of cost and manageability As you read this book, you will learn how virtualization plays an important role in Microsoft’s Windows Azure platform infrastructure The cloud services platforms are in their infancy and have not yet matured either in business models or technology But, the addition of software vendors like Amazon, Microsoft, Google, and IBM... Operations 232 Blob Operations 249 Blob Summary .265 Bibliography 266 ■Chapter 5: Windows Azure Storage Part II – Queues 267 Queue Limitations and Constraints 268 Queue Service Architecture 268 Windows Azure Storage Account 269 Queues 269 Messages 270 REST API 271 Request ... 297 Get Messages 300 Queue Scenarios 306 Scenario 1: Windows Azure Web and Worker Role Communications 306 Scenario 2: Worker Role Load Distribution 307 Scenario 3: Interoperable Messaging 308 Queue Summary 311 Bibliography 311 ■Chapter 6: Windows Azure Storage Part III – Tables 313 Table Service Architecture 314 . vii ■Chapter 2: Windows Azure platform Overview 53 Windows Azure Platform Overview 54 Windows Azure Platform Architecture 54 Basic Azure Scenarios 61 Scenario 1: Azure Software Development. 2: WINDOWS AZURE PLATFORM OVERVIEW 53 ■CHAPTER 3: WINDOWS AZURE 105 ■CHAPTER 4: WINDOWS AZURE STORAGE PART I – BLOBS 205 ■CHAPTER 5: WINDOWS AZURE STORAGE PART II – QUEUES 267 ■CHAPTER 6: WINDOWS. 3: Windows Azure 105 Windows Azure Architecture 105 The Compute Service 110 Windows Azure API Structure 112 Developer Environment 113 Windows Azure Tools for Visual Studio 113 Windows Azure