CYAN MAGENTA YELLOW BLACK BOOKS FOR PROFESSIONALS BY PROFESSIONALS ® Windows Azure Platform 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 building 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 hardware 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 ownership 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 Tejaswi Redkar, Author of Pro MSMQ: Microsoft Message Queue Programming, C# Threading Handbook, VB.NET Threading Handbook The Windows Azure Platform offers three core services: Windows Azure – Operating system in the cloud offering Compute, Storage, and Management capabilities AppFabric – Middle-tier offering with Access Control Service and NET Service Bus SQL Azure – SQL server database in the cloud These three core services offer a base platform for developing distributed services 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 interesting 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 Companion eBook RELATED TITLES Tejaswi Redkar See last page for details on $10 eBook version www.apress.com ISBN 978-1-4302-2479-2 44 9 US $44.99 Redkar SOURCE CODE ONLINE Companion eBook Available Windows Azure Platform Dear Reader, THE EXPERT’S VOICE ® IN NET Windows Azure Platform Unlock the power of cloud computing Tejaswi Redkar Shelve in: Programming Languages | General User level: Intermediate–Advanced 781430 224792 this print for content only—size & color not accurate 7.5 x 9.25 spine =1.15625" 624 page count Windows Azure Platform ■■■ TEJASWI REDKAR 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 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 ii This book is dedicated to my grandmother Vimal Sharad Redkar She has been my inspiration for whatever I 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 iii Contents at a Glance ■ABOUT THE AUTHOR xv ■ABOUT THE TECHNICAL REVIEWER xvi ■ACKNOWLEDGMENTS xvii ■CHAPTER 1: INTRODUCING CLOUD SERVICES ■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 iv ■ CONTENTS Contents ■About the Author xv ■About the Technical Reviewer xvi ■Acknowledgments xvii ■Chapter 1: Introducing Cloud Services Defining Our Terms Evolution of Cloud Services .4 Planning Developing .7 Stabilizing Deploying Operating Modeling Cloud Service Offerings Consumer Services Layer Enterprise Services Layer Middleware Layer Platform Layer Shifting to the Cloud Paradigm 10 Understanding the Cloud Services Ecosystem 12 v ■ CONTENTS CONTENTS 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 vi ■ CONTENTS ■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 vii ■ CONTENTS CONTENTS 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 viii ... 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. .. ■Chapter 2: Windows Azure platform Overview 53 Windows Azure Platform Overview 54 Windows Azure Platform Architecture 54 Basic Azure Scenarios .61 Scenario 1: Azure. .. ■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