Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to...

44
Platinum Sponsor

Transcript of Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to...

Page 1: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Platinum Sponsor

Page 2: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

After this Session…

I am able to create a test-suite for an Infrastructure as Code project from scratch.

I can articulate why Infrastructure as Code testing is necessaryand increases the quality and reliability of provisioned services.

I have the ability to create an Infrastructure as Code projectfrom scratch, quicker and much more mature.

@MarkWarneke

Page 3: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Agenda

• Introduction to Infrastructre as Code

• DevOps foundations

• Quality & Maturity Framework

• Running Test Code (Hopefully)

@MarkWarneke

Page 4: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

@MarkWarneke

– Kief Morris

Infrastructure as code is an approach to infrastructure automation based

on practices from software development.

It emphasizes consistent, repeatable routines for provisioning and changing systems and their

configuration.

Infrastructure as Code Kief Morris 9781491924358

Page 5: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

AppDev – InfraDev

@MarkWarneke

Application Development Infrastructure Development

Page 6: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

IaaS - SaaS

@MarkWarneke

Servers Services

Page 7: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Outside – Inside View

@MarkWarneke

Hardware Configuration

• VM Size, Disks, Network

• RBAC, secrets etc.

Outside

Software

• Desired state

• Extensions & scripts

→ @IrwinStrachan

→@devblackops (Brandon Olin)

Inside

Page 8: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Approaches

@MarkWarneke

Page 9: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

@MarkWarneke

– Bill Baker

treat your servers

like cattle, not pets

Page 10: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Problem Statement

Static Configuration

(Yaml, JSON etc.)

no behaviorbut state

Validation ofrequirements

@MarkWarneke

Page 11: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

DevOps = People + Process + Tools

@MarkWarneke

2 Process

Page 12: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

@MarkWarneke

Value

Measure

Infrastructure as CodeDEV

STAGE

PROD

Code

Page 13: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Build

Test

Source

Continuous Integration

@MarkWarneke

Value

Measure

cspkg

Page 14: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

QA EnvironmentArtifacts

Continuous Deployment

@MarkWarneke

Value

Measure

cspkgcspkg

Page 15: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Quality & Maturity

Quality

Maturity

Best Practices, Linting, Code Generator

Unit Test, Static Analysis

Integration, End-to-End Testing

Pull-Request, Review

System Testing, Monitoring

@MarkWarneke

Page 16: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

@MarkWarneke

https://twitter.com/iamdevloper/status/397664295875805184?lang=en

Page 17: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

@MarkWarneke

aka.ms/az.new

aka.ms/az.new/resources

Page 18: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

VSCode Extensions & Liniting

@MarkWarneke

Page 19: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 20: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 21: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 22: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 23: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 24: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

WhatIf

Page 25: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 26: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Integration

Page 27: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 28: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 29: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 30: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Azure DevOps

Page 31: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema

Azure DevOps YAML

Page 32: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 33: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 34: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,
Page 35: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Summary

• What is infrastructure as code

• DevOps foundation

• Script Analyzer & Help Checker

• Static Analysis of configuration file

• Unit Test of IaC deployment

• Unit Test of pipeline

• Integration / System Test with Pester

@MarkWarneke

Page 36: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Use the conference app to vote for this session:

https://my.eventraft.com/psconfeu

@MarkWarneke

Page 37: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Maturity Model

@MarkWarnekeJez Humble, David Farley: Continuous Delivery Reliable

Page 38: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Testing, Testing, 1...2...3: Using Pester forInfrastructure Validation by Brandon Olin

@MarkWarneke

• https://www.youtube.com/watch?v=6bPByJX5euc

• https://www.youtube.com/watch?v=Qfi_H7IZyHg

Infrastructure validation using Pester, byIrwin Strachan

Page 39: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

@MarkWarneke

http://download.microsoft.com/download/8/E/1/8E1DBEFA

-CECE-4DC9-A813-

93520A5D7CFE/World%20Class%20ARM%20Templates%20

-%20Considerations%20and%20Proven%20Practices.pdf

Page 40: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Best Practices Guide

@MarkWarneke

• https://github.com/Azure/azure-quickstart-templates

• https://github.com/Azure/azure-quickstart-templates/blob/master/1-CONTRIBUTION-GUIDE/best-practices.md

Page 41: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Best Practices Guide

@MarkWarneke

• https://blogs.msdn.microsoft.com/mvpawardprogram/2018/05/01/azure-resource-manager/

Page 42: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

Videos

@MarkWarneke

• https://app.pluralsight.com/library/courses/microsoft-azure-resource-manager-mastering/table-of-contents

• https://channel9.msdn.com/Events/Build/2015/3-618

• https://channel9.msdn.com/Events/Build/2015/2-659

• https://channel9.msdn.com/Events/Ignite/2015/BRK4453

Page 43: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

@MarkWarneke

Blogs

Azure Security Audits with Pester: https://samcogan.com/azure-security-audits-with-pester/

Infrastructure as Code Maturity Model: https://medium.com/@GaryStafford/infrastructure-as-code-maturity-model-9206b21d5dad

An introduction to infrastructure testing with PowerShell Pesterhttps://4sysops.com/archives/an-introduction-to-infrastructure-testing-with-powershell-pester/

Page 44: Test Infrastructure as Code? - markwarneke.me · Infrastructure as code is an approach to infrastructure automation based on practices from software development. It emphasizes consistent,

http://aka.ms/mark/

github.com/MarkWarneke

@MarkWarneke