THE EXPERT’S VOICE® IN .NET DevOps on the Microsoft Stack — Wouter de Kort DevOps on the Microsoft Stack Wouter de Kort DevOps on the Microsoft Stack Wouter de Kort Ordina Microsoft Solutions GRONINGEN, The Netherlands ISBN-13 (pbk): 978-1-4842-1447-3 ISBN-13 (electronic): 978-1-4842-1446-6 DOI 10.1007/978-1-4842-1446-6 Library of Congress Control Number: 2016939388 Copyright © 2016 by Wouter de Kort This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under the respective Copyright Law. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director: Welmoed Spahr Lead Editor: James DeWolf Development Editor: Douglas Pundick Technical Reviewer: Josh Garverick and Willy-Peter Schaub Editorial Board: Steve Anglin, Pramila Balen, Louise Corrigan, James DeWolf, Jonathan Gennick, Robert Hutchinson, Celestin Suresh John, Michelle Lowman, James Markham, Susan McDermott, Matthew Moodie, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Gwenan Spearing Coordinating Editor: Melissa Maldonado Copy Editor: Kezia Endsley Compositor: SPi Global Indexer: SPi Global Artist: SPi Global Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected] , or visit w ww.springer.com . Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail [email protected] , or visit w ww.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 w ww.apress.com/bulk-sales . Any source code or other supplementary material referenced by the author in this text is available to readers at www.apress.com . For detailed information about how to locate your book’s source code, go to www.apress.com/source-code/ . Printed on acid-free paper Contents at a Glance Foreword .................................................................................................................xi About the Author ...................................................................................................xiii About the Technical Reviewers ...............................................................................xv Acknowledgments .................................................................................................xvii Preface ...................................................................................................................xix ■ Part I: Getting Started .........................................................................1 ■ Chapter 1: What Is DevOps? ..................................................................................3 ■ Chapter 2: Introducing Azure and Visual Studio Team Services ...........................9 ■ Part II: Plan .......................................................................................17 ■ Chapter 3: Agile Project Management: The Importance of Communication ........19 ■ Chapter 4: Managing User Feedback: Knowing What to Build ............................43 ■ Chapter 5: Advanced Agile Project Management ................................................55 ■ Chapter 6: Dashboards and Reporting .................................................................77 ■ Part III: Code and Build .....................................................................97 ■ Chapter 7: Setting Up Version Control .................................................................99 ■ Chapter 8: Managing Technical Debt .................................................................137 ■ Chapter 9: Implementing Continuous Integration .............................................161 ■ Chapter 10: Creating and Sharing Packages .....................................................189 iii ■ CONTENTS AT A GLANCE ■ Part IV: Test, Deploy, and Monitor ...................................................203 ■ Chapter 11: Integrating Testers into DevOps .....................................................205 ■ Chapter 12: Implementing Continuous Delivery with Release Management .......231 ■ Chapter 13: Using Application Insights .............................................................261 ■ Chapter 14: The Path Forward ...........................................................................277 Index .....................................................................................................................283 iv Contents Foreword .................................................................................................................xi About the Author ...................................................................................................xiii About the Technical Reviewers ...............................................................................xv Acknowledgments .................................................................................................xvii Preface ...................................................................................................................xix ■ Part I: Getting Started .........................................................................1 ■ Chapter 1: What Is DevOps? ..................................................................................3 Why Are We Doing DevOps? .............................................................................................3 Assessing Your DevOps Capability ...................................................................................6 Summary ..........................................................................................................................8 ■ Chapter 2: Introducing Azure and Visual Studio Team Services ...........................9 Understanding the Microsoft Cloud: Azure .......................................................................9 IaaS, PaaS, and SaaS ............................................................................................................................10 Security ................................................................................................................................................11 Using Visual Studio Team Services .................................................................................14 Security ................................................................................................................................................15 The Need for Training .....................................................................................................16 Summary ........................................................................................................................16 v ■ CONTENTS ■ Part II: Plan .......................................................................................17 ■ Chapter 3: Agile Project Management: The Importance of Communication ........19 Agile Project Management .............................................................................................19 Agile Tooling ...................................................................................................................22 Sprints ..................................................................................................................................................22 Product Backlog Items ..........................................................................................................................24 Tasks.....................................................................................................................................................27 Impediments .........................................................................................................................................28 Bugs......................................................................................................................................................30 Capacity ................................................................................................................................................32 Team Rooms ...................................................................................................................36 Achieving Traceability with Developers ..........................................................................39 Summary ........................................................................................................................41 ■ Chapter 4: Managing User Feedback: Knowing What to Build ............................43 Why We Need Better Communication .............................................................................43 Creating Storyboards with PowerPoint ..........................................................................44 Involving Stakeholders in Feedback Management .........................................................47 Summary ........................................................................................................................53 ■ Chapter 5: Advanced Agile Project Management ................................................55 Kanban and Lean ............................................................................................................55 Portfolio Management ....................................................................................................67 Summary ........................................................................................................................75 ■ Chapter 6: Dashboards and Reporting .................................................................77 Queries ...........................................................................................................................77 Using the Search Box ...........................................................................................................................77 Work Item Queries ................................................................................................................................79 Charts ...................................................................................................................................................83 vi ■ CONTENTS Code Search ...................................................................................................................89 Dashboards ....................................................................................................................92 Alerts and Notifi cations ..................................................................................................93 Summary ........................................................................................................................96 ■ Part III: Code and Build .....................................................................97 ■ Chapter 7: Setting Up Version Control .................................................................99 Introducing Version Control ............................................................................................99 Using Team Foundation Version Control (TFVC) ............................................................103 Workspace ..........................................................................................................................................103 Checking in a Changeset ....................................................................................................................106 Get Latest and Merge Confl icts ..........................................................................................................110 History, Annotations, and CodeLens ....................................................................................................111 Shelvesets and Suspending Your Work...............................................................................................114 Branches .............................................................................................................................................119 Check-In Policies ................................................................................................................................122 Using the Git Version Control System ...........................................................................124 Clone ...................................................................................................................................................124 Commit and Push ...............................................................................................................................125 Fetch and Pull .....................................................................................................................................127 Branch ................................................................................................................................................128 Pull Request ........................................................................................................................................130 Choosing a Branching Strategy ....................................................................................134 Branch Scenarios ...............................................................................................................................134 Feature Toggles ..................................................................................................................................135 Summary ......................................................................................................................136 ■ Chapter 8: Managing Technical Debt .................................................................137 Running Code Analysis .................................................................................................138 Code Metrics ................................................................................................................141 Lines of Code ......................................................................................................................................142 vii ■ CONTENTS Cyclomatic Complexity .......................................................................................................................144 Coupling ..............................................................................................................................................144 Depth of Inheritance ...........................................................................................................................146 Calculating Code Metrics ....................................................................................................................146 Finding Duplications .....................................................................................................147 Validating the Architecture ...........................................................................................149 Create and Run Unit Tests ............................................................................................152 Creating Custom Code Analyzers with Roslyn ..............................................................156 Summary ......................................................................................................................160 ■ Chapter 9: Implementing Continuous Integration .............................................161 Confi guring a Continuous Integration Build ..................................................................162 Installing and Confi guring Build Agents .......................................................................173 Creating Custom Tasks .................................................................................................175 Using SonarQube ..........................................................................................................181 Summary ......................................................................................................................187 ■ Chapter 10: Creating and Sharing Packages .....................................................189 What Are Packages? ....................................................................................................189 Package Management for Visual Studio Team Services ..............................................195 Summary ......................................................................................................................201 ■ Part IV: Test, Deploy, and Monitor ...................................................203 ■ Chapter 11: Integrating Testers into DevOps .....................................................205 Manual Testing Through Web Access ...........................................................................205 Microsoft Test Manager ................................................................................................216 Automated Testing ........................................................................................................220 Summary ......................................................................................................................229 ■ Chapter 12: Implementing Continuous Delivery with Release Management .......231 Understanding the Deployment Pipeline ......................................................................231 Setting Up Automatic Releases with Release Management .........................................232 viii ■ CONTENTS Deploying Web Sites .....................................................................................................246 Understanding Containers ............................................................................................256 Summary ......................................................................................................................259 ■ Chapter 13: Using Application Insights .............................................................261 What Is Application Insights? .......................................................................................261 Confi guring Monitoring for Your Application .................................................................263 Availability Monitoring ..................................................................................................269 Usage Monitoring .........................................................................................................272 Diagnose Failures and Exceptions ...............................................................................274 Summary ......................................................................................................................275 ■ Chapter 14: The Path Forward ...........................................................................277 The Basics ....................................................................................................................277 Stepping It Up ...............................................................................................................280 Finishing Touches .........................................................................................................281 Summary ......................................................................................................................282 Index .....................................................................................................................283 ix