O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DevOps with Windows Server 2016

Book Description

Obtain enterprise agility and continuous delivery by implementing DevOps with Windows Server 2016

About This Book

  • This practical learning guide will improve your application lifecycle management and help you manage environments efficiently
  • Showcase through a sample application ways to apply DevOps principles and practices in the real world
  • Implement DevOps using latest technologies in Windows Server 2016 such as Windows Container, Docker, and Nano Servers

Who This Book Is For

This book is for .NET developers and system administrators who have a basic knowledge of Windows Server 2016 and are now eager to implement DevOps at work using Windows Server 2016. Knowledge of Powershell, Azure, and containers will help.

What You Will Learn

  • Take a deep dive into the fundamentals, principles, and practices of DevOps
  • Achieve an end-to-end DevOps implementation
  • Execute source control management using GITHUB and VSTS vNext
  • Automate the provisioning and configuration of infrastructure
  • Build and release pipeline
  • Measure the success of DevOps through application instrumentation and monitoring

In Detail

Delivering applications swiftly is one of the major challenges faced in fast-paced business environments. Windows Server 2016 DevOps is the solution to these challenges as it helps organizations to respond faster in order to handle the competitive pressures by replacing error-prone manual tasks using automation.

This book is a practical description and implementation of DevOps principles and practices using the features provided by Windows Server 2016 and VSTS vNext. It jumps straight into explaining the relevant tools and technologies needed to implement DevOps principles and practices. It implements all major DevOps practices and principles and takes readers through it from envisioning a project up to operations and further. It uses the latest and upcoming concepts and technologies from Microsoft and open source such as Docker, Windows Container, Nano Server, DSC, Pester, and VSTS vNext.

By the end of this book, you will be well aware of the DevOps principles and practices and will have implemented all these principles practically for a sample application using the latest technologies on the Microsoft platform. You will be ready to start implementing DevOps within your project/engagement.

Style and approach

This practical, learning book is linear and progressive, and every chapters builds on the previous chapters. We focus on the practical skills required to implement DevOps, with a summary of the key concepts only where strictly necessary.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. DevOps with Windows Server 2016
    1. DevOps with Windows Server 2016
    2. Credits
    3. About the Author
    4. Acknowledgments
    5. About the Reviewer
    6. Acknowledgments
    7. www.PacktPub.com
      1. Why subscribe?
    8. Customer Feedback
    9. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    10. 1. Introducing DevOps
      1. Software delivery challenges
        1. Resistance to change
        2. Rigid processes
        3. Isolated teams
        4. Monolithic design and deployments
        5. Manual execution
        6. Lack of innovation
      2. What is DevOps?
      3. DevOps principles
        1. Collaboration and communication
        2. Flexible to change
          1. Application lifecycle management
          2. Development methodology
        3. Software design
        4. Automating processes and tools
        5. Failing fast and early
        6. Innovation and continuous learning
      4. DevOps practices
        1. Configuration management
        2. Continuous integration
          1. Build automation
          2. Test automation
          3. Application packaging
        3. Continuous deployment
          1. Preproduction deployment
          2. Test automation
          3. Staging environment deployment
          4. Acceptance tests
          5. Deployment to production
        4. Continuous delivery
        5. Continuous learning
      5. Measuring DevOps
      6. Summary
    11. 2. DevOps Tools and Technologies
      1. Cloud technology
        1. Infrastructure as a Service (IaaS)
        2. Platform as a Service (PaaS)
        3. Software as a Service (SaaS)
          1. Advantages of using cloud computing
      2. Windows Server 2016
      3. Application platform
        1. Windows Server as a hosting platform
        2. Nano servers
        3. Windows Containers and Docker
        4. Hyper-V containers
        5. Nested virtual machines
        6. Enabling microservices
        7. Reduced maintenance
        8. Configuration management tools
        9. Deployment and packaging
      4. Visual Studio Team Services
        1. Source code management service
          1. Team Foundation Version Control
          2. Exploring Git
        2. Build Management service
          1. Executing Build Definitions
          2. Build architecture
          3. Agents, agent pools, and agent queues
          4. Queuing Build Definitions
          5. Configuring a Build definition
        3. Release Management service
          1. Executing release definitions
          2. Release Management architecture
          3. Release definition configuration
        4. Setting up a cloud environment
          1. Visual Studio Team Services
      5. Azure account
      6. Summary
    12. 3. DevOps Automation Primer
      1. Azure Resource Manager
        1. ARM and ASM
        2. ARM advantages
        3. ARM concepts
          1. Resource providers
          2. Resource types
          3. Resource groups
          4. Resource and resource instances
          5. Azure Resource Manager
          6. Azure Resource Manager architecture
          7. Azure Resource Manager features
            1. Role-Based Access Control
            2. Tags
            3. Policies
            4. Locks
            5. Multi-region
            6. Idempotent
            7. Extensible
      2. Azure Resource Manager templates
        1. Template basics
          1. Parameters
          2. Variables
          3. Resources
          4. Outputs
          5. Expressions and functions
        2. Nested resources
        3. A minimal template
        4. ARM template tools
          1. Authoring tools
          2. Deployment tools
        5. Deployments
      3. PowerShell
        1. PowerShell features
          1. Cmdlets
          2. Pipeline
          3. Variables
          4. Scripts and modules
        2. Azure PowerShell development environment
      4. Pester
        1. Installing Pester
        2. Writing tests with Pester
        3. Pester real-time example
      5. Desired State Configuration
        1. DSC Push architecture
        2. DSC Pull architecture
        3. Pull configuration example
          1. DscLocalConfigurationManager() attribute
          2. ConfigurationRepositoryWeb
            1. Partial Configurations
            2. Pushing LCM Configuration
      6. Summary
    13. 4. Nano, Containers, and Docker Primer
      1. Virtualization
      2. Containers
        1. Docker
        2. Container host
        3. Container images
        4. Docker Hub/Docker Registry
      3. Installing a Windows Server 2016 Container on Azure
        1. Provisioning Azure virtual machines
      4. Installing Windows Nano Server on Azure
        1. Provisioning Nano Server
      5. Using Docker client
        1. Container life cycle management
          1. Docker run
          2. Docker ps
          3. Docker start
          4. Docker stop
          5. Docker rm
          6. Docker restart
          7. Docker pause
          8. Docker unpause
        2. Image management
          1. Docker build
          2. Docker commit
          3. Docker images
          4. Docker rmi
          5. Docker tag
        3. Monitoring commands
          1. Docker logs
          2. Docker stats
          3. Docker inspect
          4. Docker events
        4. Docker registry management
          1. Docker login
          2. Docker push
          3. Docker pull
      6. Understanding Dockerfile
        1. Docker build command
        2. Shell and Exec instruction forms
          1. Shell form
          2. Exec form
        3. Dockerfile instructions
          1. COMMENT
          2. FROM
          3. MAINTAINER
          4. COPY
          5. ADD
          6. WORKDIR
          7. EXPOSE
          8. ENV
          9. VOLUME
          10. RUN
          11. CMD
          12. ENTRYPOINT
      7. Summary
    14. 5. Building a Sample Application
      1. Experiencing the application
      2. Application architecture
      3. Preparing development environment
        1. Installing SQL Server Management Studio
        2. Creating Azure SQL Server and SQL database
        3. Creating database tables
        4. Understanding database schema
        5. Setting up Visual Studio solution
          1. Modify web.config connection string
          2. Publish profile for web application
          3. Parameters.xml
          4. Running the sample application
      4. Understanding Visual Studio Solution
      5. Entity Framework
      6. Controllers and Views
        1. Controllers
        2. Views
      7. Configuration management
      8. Unit testing
        1. Unit testing DrugController
        2. Mocking Drug data access class
        3. Drug controller unit tests
      9. Summary
    15. 6. Source Code Control
      1. Configuration Management
      2. Source Configuration Management
        1. Centralized
        2. Distributed
      3. Visual Studio Team Services
      4. Git 101
        1. Git init
        2. Git clone
        3. Git add
        4. Git commit
        5. Git branch
        6. Git merge
        7. Git remote
      5. Installing Git for Windows on the development environment
      6. Adding Online Pharmacy to the VSTS Git repository using Visual Studio 2015
      7. Managing a Git Repository using VSTS
        1. Submitting code changes to a Git repository
        2. Pulling code changes from a Git repository
        3. Onboarding another developer for the same application
        4. Cloning and adding a solution to the VSTS Git repository
      8. Adding a project to the VSTS Git repository using the command-line tool
        1. Cloning and adding a solution to VSTS Git repository using the Git command-line tool
      9. Summary
    16. 7. Configuration Management
      1. Infrastructure as Code
        1. Objectives of Infrastructure as Code
      2. Revisiting sample application architecture
        1. Azure Key Vault
        2. Operational Insights
        3. Desired State Configuration Pull Server
        4. Azure storage account
      3. Azure virtual machines and containers
      4. Azure public load balancer
      5. Azure SQL
      6. Security considerations
        1. Storing secrets and credentials
        2. Secure login to Azure subscription
        3. Storage account keys and shared access signature tokens
        4. Network Security Groups and firewalls
      7. The IT administrator and deployment role
      8. Steps for deployment for an IT administrator
        1. PreCreate.ps1
        2. GeneralServices.json
          1. Parameters
          2. Variables
          3. Resources
            1. Microsoft.OperationalInsights/workspaces
            2. Microsoft.KeyVault/vaults
            3. Microsoft.KeyVault/vaults secrets
          4. Outputs
      9. Steps for deployment of the operator or release pipeline
      10. UploadScriptFiles.ps1
      11. Test-ARMTemplate.ps1
      12. New-TemplateDeployment.ps1
      13. OnlineMedicine.parameters.json
      14. OnlineMedicine.json
        1. Parameters
        2. Variables
        3. Resources
          1. Microsoft.Compute/availabilitySets
          2. Microsoft.Storage/storageAccounts
          3. Microsoft.Network/virtualNetworks
          4. Microsoft.Network/networkSecurityGroups
          5. Microsoft.Network/publicIPAddresses
          6. Microsoft.Network/networkInterfaces
          7. Microsoft.Compute/virtualMachines
          8. Microsoft.Compute/virtualMachines/extensions - CustomScriptExtension
          9. Microsoft.Compute/virtualMachines/extensions - MicrosoftMonitoringAgent
          10. Microsoft.Network/publicIPAddresses - for load balancer
          11. Microsoft.Network/loadBalancers
          12. Microsoft.Network/publicIPAddresses - web application public IP addresses
          13. Microsoft.Network/networkInterfaces - web application NICs
          14. Microsoft.Compute/virtualMachines - web application virtual machines
          15. Microsoft.Compute/virtualMachines/extensions - CustomScriptExtension
          16. Microsoft.Compute/virtualMachines/extensions - MicrosoftMonitoringAgent
          17. Microsoft.Sql/servers, databases, firewallRules
        4. Outputs
      15. Summary
    17. 8. Configuration Management and Operational Validation
      1. Steps for deployment through the release pipeline
        1. PullServer.ps1
        2. IISInstall.ps1
        3. ContainerConfig.ps1
        4. dockerfile
        5. lcm.ps1
        6. ChangeConnectionString.ps1
        7. PreparePesterEnvironment.ps1
        8. Execute-Pester.ps1
      2. Environment unit tests
        1. Unit testing availability set
        2. Unit testing virtual networks
        3. Unit testing Network Security Groups
        4. Unit testing load balancer
        5. Unit testing Azure SQL
        6. Unit testing Azure SQL Firewall
        7. Unit testing the count of virtual machines
        8. Unit testing virtual machine 01
        9. Unit testing virtual machine 02
        10. Unit testing the DSC Pull Server virtual machine
        11. Unit testing the DSC Pull Server operating system
        12. Unit testing the web application operating system
      3. Environment operational validation
        1. The operational validation folder structure
        2. The operational validation of the web application on the first virtual machine
        3. The operational validation of the web application on the second virtual machine
        4. The operational validation of the web application using an Azure load balancer
        5. Unit and operational validation tests
      4. Summary
    18. 9. Continuous Integration
      1. Continuous integration
      2. Why continuous integration?
        1. Fail fast and often
        2. High confidence and cadence
        3. Better collaboration
        4. Reduction of technical debt
      3. Principles of Continuous Integration
        1. Automation
        2. Single repository
        3. Fast execution
        4. Reporting
        5. Security
      4. Continuous integration process
      5. Types of continuous integration
        1. Scheduled builds
        2. Continuous build
        3. Gated builds
      6. Integration with source code configuration management
      7. Integration with work item management
      8. Build definition
        1. Defining variables
        2. Build activities
          1. NuGet installer activity
          2. Visual Studio Build activity for the OnlinePharmacy project
          3. Visual Studio Build activity for the OnlinePharmacy test project
          4. The Visual Studio Test activity for OnlinePharmacy project binaries
          5. Replace Tokens activity for updating the web application's name
          6. Archive Files activity for deployment.zip
          7. Copy and Publish Build Artifacts activity
        3. Build options
        4. Repository
        5. Triggers
        6. General, retention, and history
      9. Build pipeline execution
      10. Summary
    19. 10. Continuous Delivery and Deployment
      1. Understanding releases
      2. Release management
      3. Continuous delivery
      4. Continuous deployment
      5. Why continuous delivery and deployment?
        1. Detecting deployment issues early
        2. Eliminating surprises and risks
        3. Reducing cost of change
        4. Pushing frequent changes to production
        5. Removing risky manual deployments
        6. Moving away from human dependency
      6. The principles of continuous deployment
        1. Automation as an enabler
        2. Infrastructure as Code
        3. Shortened execution time
        4. Reporting
        5. Secure deployments
      7. Continuous deployment process
      8. Continuous delivery process
      9. Alternate strategies
        1. Using Azure automation for DSC Pull Server
        2. Using Docker hub/Docker registry
        3. Using Docker compose
        4. Using Docker management tools such as Swarm or Kubernetes
      10. Types of releases
        1. Scheduled releases
        2. Continuous deployment
      11. Azure Resource Manager service endpoint
      12. Release pipeline definition
        1. Variables configuration
        2. Artifacts configuration
        3. Triggers configuration
        4. General, retention, and history
        5. Release environments
          1. Preparation environment
            1. Azure file copy task
            2. Azure PowerShell
          2. Test environment
            1. Azure PowerShell - test ARM template deployment
            2. Azure PowerShell - deploy test environment
            3. PowerShell - prepare Pester environment
            4. Copy files - copy operational validation module
            5. Azure PowerShell - execute Pester and operational validation tests
          3. Production environment
            1. Azure PowerShell - test ARM template deployment
            2. Azure PowerShell - deploy test environment
            3. PowerShell - prepare Pester environment
            4. Copy Files - copy operational validation module
            5. Azure PowerShell - execute Pester and operational validation tests
      13. Release pipeline execution
      14. Release pipeline strategies
        1. A/B testing
        2. Blue/Green deployments
        3. Canary releases
      15. Summary
    20. 11. Monitoring and Measuring
      1. Application Insights
        1. Provisioning
        2. Changes to sample application
        3. Application Insights dashboard
      2. Operational Insights
        1. Provisioning
        2. OMS agents
        3. Search
        4. Solutions
      3. Summary