SlideShare une entreprise Scribd logo
1  sur  24
Deploying Azure DevOps
using Terraform
Lessons Learned
Agenda
• Microsoft’s Investments in Terraform
• AzureRM Terraform Provider Roadmap
• Terraform vNext
• Azure DevOps Components Breakdown
• Resources
Microsoft’s investments in Terraform
• Microsoft Team HashiCorp Team
• Terraform AzureRM Provider updates
• Latest release (August 5, 2020)
enhancements/bug fixes
releases/updates published in July alone!
• Terraform Module Registry
• https://registry.terraform.io/browse/modules?provider
=azurerm
Roadmap
https://github.com/terraform-providers/terraform-provider-azurerm
Terraform v0.13 highlights
• Support for , , and
• New syntax
• Custom
command connects a CLI user
to the Terraform Cloud app
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "2.0.0"
}
}
}
variable "image_id" {
type = string
description = "The id of the machine image (AMI) to use for the server."
validation {
condition = length(var.image_id) > 4 && substr(var.image_id, 0, 4) == "ami-"
error_message = "The image_id value must be a valid AMI id, starting with "ami-"."
}
}
Azure DevOps Component Breakdown
• Project
• Repository
• Variable Groups
• Pipelines
• Service Endpoints
• Boards
• Environments
• Releases
• Test plans
• Artifacts
Can’t deploy (yet):Can deploy:
Environment Variables
• $ENV:AZDO_PERSONAL_ACCESS_TOKEN = 'SomeBigLongGUID'
• $ENV:AZDO_ORG_SERVICE_URL = 'https://dev.azure.com/AdinErmie'
• $ENV:AZDO_GITHUB_SERVICE_CONNECTION_PAT = 'SomeOtherGUID'
• ADO Personal Access Token
• Used to allow you current execution credentials permission into you DevOps Org (via
the API), to create a new ADO Project
• Use personal access tokens
• ADO Organization Service URL
• Simply, the Org URL (because you’re making a new project inside an existing Org, not
a new Org)
• GitHub Service Connection Personal Access Token
• Used for acceptance testing
Azure DevOps Project
Azure DevOps Repository
Azure DevOps Variable Groups
Azure DevOps Pipelines
Azure DevOps Service Endpoints
Azure DevOps Service Endpoints
OAuth
Azure DevOps Service Endpoints
Personal Access Token (PAT)
Azure DevOps Service Endpoints
GitHub App
Let’s see it in action!
Lessons Learned
• You need to pre-create storage account where you will store the TF State file for the creation of the ADO
project
• Unless you create it using Terraform, and then use terraform import to bring it under Terraform
control/management
• Importing a public OR private GitHub repo is not yet supported
• Creating Service Endpoints is confusing
• Unsure how to ‘authorize’ the Azure service connection with permissions on the Key Vault (for existing SPNs)
• For demo simplicity, set the Key Vault default network access control to ‘allow’
• Not a best-practice, but unless you’re VPN’d into a VNET that has access to the KV, you won’t be able to
see any keys/secrets
• SPN password (if used to pass into the Terraform command-line via pipeline), does not like $p3c1@l (special)
characters
Lessons Learned
(continued)
• If you define a new repo, and then
attempt to define the pipeline via code,
but the YAML file doesn’t already
existing in the repo (because they’re
not pushed to it), you’ll encounter the
error “File FILENAME.yml not found in
repository REPO NAME”
(more) Lessons Learned
• Currently not supported to
programmatically (through Terraform)
grant the Pipeline access to the Service
Connection
• Issue #41 - Authorize service
connection use by pipeline via
Terraform
Resources
Gotta learn
Bonus! TFLint
• A part of the GitHub Super Linter
• One linter to rule them all
• Used to validate against issues
• Focused on possible errors, , etc.
• Support for all providers
• Rules that warn against
• AWS = 700+ rules
• Azure = 279 rules (Experimental support)
• GCP = WIP
Resources
• Adin’s personal curated list of Terraform resources
• Automating infrastructure deployments in the Cloud with Terraform
and Azure Pipelines
• Deploying Terraform Infrastructure using Azure DevOps Pipelines Step
by Step
Don’t forget about these Visual Studio
Code (VS Code) extensions:
 Azure Terraform (by Microsoft)
 Terraform (by Mikael Olenfalk)
 Now owned by HashiCorp!
Certification resources
• HashiCorp Terraform Certified Associate Preparation Guide
(co-authored by Adin Ermie and Ned Bellavance)
• Study Guide - Terraform Associate Certification
(HashiCorp official)
• Exam Review - Terraform Associate Certification
(HashiCorp official)
• Sample Questions - Terraform Associate Certification
(HashiCorp official)
This is me
Adin Ermie
• Cloud Solution Architect – Azure Infrastructure @ Microsoft
• Azure Infrastructure-as-a-Service (IaaS), Platform-as-a-Service (PaaS)
• Cloud Management & Security
• Azure Monitor, Azure Security Center (ASC) / Azure Sentinel
• Cloud Governance
• Azure Policy, Blueprints, Management Groups, and Azure Cost
Management (ACM)
• Business Continuity and Disaster Recovery (BCDR)
• Azure Site Recovery (ASR) / Azure Migrate, and Azure Backup
• Infrastructure-as-Code (IaC)
• Azure Resource Manager (ARM), and Terraform
• 5x MVP - Cloud and Datacenter Management (CDM)
• 1x HCA – HashiCorp Ambassador
Adin.Ermie@outlook.com
@AdinErmie
https://AdinErmie.com
linkedin.com/in/adinermie
https://github.com/AErmie

Contenu connexe

Tendances

Tendances (20)

Hashicorp Terraform Open Source vs Enterprise
Hashicorp Terraform Open Source vs EnterpriseHashicorp Terraform Open Source vs Enterprise
Hashicorp Terraform Open Source vs Enterprise
 
Infrastructure-as-Code (IaC) using Terraform
Infrastructure-as-Code (IaC) using TerraformInfrastructure-as-Code (IaC) using Terraform
Infrastructure-as-Code (IaC) using Terraform
 
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
 
Terraform on Azure
Terraform on AzureTerraform on Azure
Terraform on Azure
 
Terraform
TerraformTerraform
Terraform
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introduction
 
Terraform: An Overview & Introduction
Terraform: An Overview & IntroductionTerraform: An Overview & Introduction
Terraform: An Overview & Introduction
 
Best Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformBest Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with Terraform
 
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
 
Microsoft Azure IaaS and Terraform
Microsoft Azure IaaS and TerraformMicrosoft Azure IaaS and Terraform
Microsoft Azure IaaS and Terraform
 
Azure AKS
Azure AKSAzure AKS
Azure AKS
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive Overview
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes Workshop
 
Introduction to IAC and Terraform
Introduction to IAC and Terraform Introduction to IAC and Terraform
Introduction to IAC and Terraform
 
Terraform modules and best-practices - September 2018
Terraform modules and best-practices - September 2018Terraform modules and best-practices - September 2018
Terraform modules and best-practices - September 2018
 
DevOps: Infrastructure as Code
DevOps: Infrastructure as CodeDevOps: Infrastructure as Code
DevOps: Infrastructure as Code
 
infrastructure as code
infrastructure as codeinfrastructure as code
infrastructure as code
 
Azure DevOps Tutorial | Developing CI/ CD Pipelines On Azure | Edureka
Azure DevOps Tutorial | Developing CI/ CD Pipelines On Azure | EdurekaAzure DevOps Tutorial | Developing CI/ CD Pipelines On Azure | Edureka
Azure DevOps Tutorial | Developing CI/ CD Pipelines On Azure | Edureka
 
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
 
Azure Container Apps
Azure Container AppsAzure Container Apps
Azure Container Apps
 

Similaire à Deploying Azure DevOps using Terraform

Learn Terraform on Azure
Learn Terraform on AzureLearn Terraform on Azure
Learn Terraform on Azure
Jorn Jambers
 

Similaire à Deploying Azure DevOps using Terraform (20)

Integration-Monday-Terraform-Serverless
Integration-Monday-Terraform-ServerlessIntegration-Monday-Terraform-Serverless
Integration-Monday-Terraform-Serverless
 
Learn Terraform on Azure
Learn Terraform on AzureLearn Terraform on Azure
Learn Terraform on Azure
 
Terraform: Infrastructure as Code
Terraform: Infrastructure as CodeTerraform: Infrastructure as Code
Terraform: Infrastructure as Code
 
20170831 - Greg Palmier: Terraform & AWS at Tempus
20170831 - Greg Palmier: Terraform & AWS at Tempus20170831 - Greg Palmier: Terraform & AWS at Tempus
20170831 - Greg Palmier: Terraform & AWS at Tempus
 
PuppetConf 2017: Unlocking Azure with Puppet Enterprise- Keiran Sweet, Source...
PuppetConf 2017: Unlocking Azure with Puppet Enterprise- Keiran Sweet, Source...PuppetConf 2017: Unlocking Azure with Puppet Enterprise- Keiran Sweet, Source...
PuppetConf 2017: Unlocking Azure with Puppet Enterprise- Keiran Sweet, Source...
 
BSidesDFW2022-PurpleTeam_Cloud_Identity.pptx
BSidesDFW2022-PurpleTeam_Cloud_Identity.pptxBSidesDFW2022-PurpleTeam_Cloud_Identity.pptx
BSidesDFW2022-PurpleTeam_Cloud_Identity.pptx
 
Zure Azure PaaS Zero to Hero - DevOps training day
Zure Azure PaaS Zero to Hero - DevOps training dayZure Azure PaaS Zero to Hero - DevOps training day
Zure Azure PaaS Zero to Hero - DevOps training day
 
DevOps for Databricks
DevOps for DatabricksDevOps for Databricks
DevOps for Databricks
 
Containerised ASP.NET Core apps with Kubernetes
Containerised ASP.NET Core apps with KubernetesContainerised ASP.NET Core apps with Kubernetes
Containerised ASP.NET Core apps with Kubernetes
 
Infrastructure as Code Presentation v5.pptx
Infrastructure as Code Presentation v5.pptxInfrastructure as Code Presentation v5.pptx
Infrastructure as Code Presentation v5.pptx
 
Terraform - Taming Modern Clouds
Terraform  - Taming Modern CloudsTerraform  - Taming Modern Clouds
Terraform - Taming Modern Clouds
 
#ESPC18 How to do #devops with the #SharePoint Framework and why it matters?
#ESPC18 How to do #devops with the #SharePoint Framework and why it matters?#ESPC18 How to do #devops with the #SharePoint Framework and why it matters?
#ESPC18 How to do #devops with the #SharePoint Framework and why it matters?
 
Terraform Modules and Continuous Deployment
Terraform Modules and Continuous DeploymentTerraform Modules and Continuous Deployment
Terraform Modules and Continuous Deployment
 
T5 - Mise en place de votre processus DevOps Ofice, Office 365, SharePoint - ...
T5 - Mise en place de votre processus DevOps Ofice, Office 365, SharePoint - ...T5 - Mise en place de votre processus DevOps Ofice, Office 365, SharePoint - ...
T5 - Mise en place de votre processus DevOps Ofice, Office 365, SharePoint - ...
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
 
Azure enterprise integration platform
Azure enterprise integration platformAzure enterprise integration platform
Azure enterprise integration platform
 
Sps monaco vincent biret spfx devops
Sps monaco vincent biret spfx devopsSps monaco vincent biret spfx devops
Sps monaco vincent biret spfx devops
 
Mete Atamel
Mete AtamelMete Atamel
Mete Atamel
 
The ABC's of IaC
The ABC's of IaCThe ABC's of IaC
The ABC's of IaC
 
Introduction to Terraform with Azure flavor
Introduction to Terraform with Azure flavorIntroduction to Terraform with Azure flavor
Introduction to Terraform with Azure flavor
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Deploying Azure DevOps using Terraform

  • 1. Deploying Azure DevOps using Terraform Lessons Learned
  • 2. Agenda • Microsoft’s Investments in Terraform • AzureRM Terraform Provider Roadmap • Terraform vNext • Azure DevOps Components Breakdown • Resources
  • 3. Microsoft’s investments in Terraform • Microsoft Team HashiCorp Team • Terraform AzureRM Provider updates • Latest release (August 5, 2020) enhancements/bug fixes releases/updates published in July alone! • Terraform Module Registry • https://registry.terraform.io/browse/modules?provider =azurerm
  • 5. Terraform v0.13 highlights • Support for , , and • New syntax • Custom command connects a CLI user to the Terraform Cloud app terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "2.0.0" } } } variable "image_id" { type = string description = "The id of the machine image (AMI) to use for the server." validation { condition = length(var.image_id) > 4 && substr(var.image_id, 0, 4) == "ami-" error_message = "The image_id value must be a valid AMI id, starting with "ami-"." } }
  • 6. Azure DevOps Component Breakdown • Project • Repository • Variable Groups • Pipelines • Service Endpoints • Boards • Environments • Releases • Test plans • Artifacts Can’t deploy (yet):Can deploy:
  • 7. Environment Variables • $ENV:AZDO_PERSONAL_ACCESS_TOKEN = 'SomeBigLongGUID' • $ENV:AZDO_ORG_SERVICE_URL = 'https://dev.azure.com/AdinErmie' • $ENV:AZDO_GITHUB_SERVICE_CONNECTION_PAT = 'SomeOtherGUID' • ADO Personal Access Token • Used to allow you current execution credentials permission into you DevOps Org (via the API), to create a new ADO Project • Use personal access tokens • ADO Organization Service URL • Simply, the Org URL (because you’re making a new project inside an existing Org, not a new Org) • GitHub Service Connection Personal Access Token • Used for acceptance testing
  • 12. Azure DevOps Service Endpoints
  • 13. Azure DevOps Service Endpoints OAuth
  • 14. Azure DevOps Service Endpoints Personal Access Token (PAT)
  • 15. Azure DevOps Service Endpoints GitHub App
  • 16. Let’s see it in action!
  • 17. Lessons Learned • You need to pre-create storage account where you will store the TF State file for the creation of the ADO project • Unless you create it using Terraform, and then use terraform import to bring it under Terraform control/management • Importing a public OR private GitHub repo is not yet supported • Creating Service Endpoints is confusing • Unsure how to ‘authorize’ the Azure service connection with permissions on the Key Vault (for existing SPNs) • For demo simplicity, set the Key Vault default network access control to ‘allow’ • Not a best-practice, but unless you’re VPN’d into a VNET that has access to the KV, you won’t be able to see any keys/secrets • SPN password (if used to pass into the Terraform command-line via pipeline), does not like $p3c1@l (special) characters
  • 18. Lessons Learned (continued) • If you define a new repo, and then attempt to define the pipeline via code, but the YAML file doesn’t already existing in the repo (because they’re not pushed to it), you’ll encounter the error “File FILENAME.yml not found in repository REPO NAME”
  • 19. (more) Lessons Learned • Currently not supported to programmatically (through Terraform) grant the Pipeline access to the Service Connection • Issue #41 - Authorize service connection use by pipeline via Terraform
  • 21. Bonus! TFLint • A part of the GitHub Super Linter • One linter to rule them all • Used to validate against issues • Focused on possible errors, , etc. • Support for all providers • Rules that warn against • AWS = 700+ rules • Azure = 279 rules (Experimental support) • GCP = WIP
  • 22. Resources • Adin’s personal curated list of Terraform resources • Automating infrastructure deployments in the Cloud with Terraform and Azure Pipelines • Deploying Terraform Infrastructure using Azure DevOps Pipelines Step by Step Don’t forget about these Visual Studio Code (VS Code) extensions:  Azure Terraform (by Microsoft)  Terraform (by Mikael Olenfalk)  Now owned by HashiCorp!
  • 23. Certification resources • HashiCorp Terraform Certified Associate Preparation Guide (co-authored by Adin Ermie and Ned Bellavance) • Study Guide - Terraform Associate Certification (HashiCorp official) • Exam Review - Terraform Associate Certification (HashiCorp official) • Sample Questions - Terraform Associate Certification (HashiCorp official)
  • 24. This is me Adin Ermie • Cloud Solution Architect – Azure Infrastructure @ Microsoft • Azure Infrastructure-as-a-Service (IaaS), Platform-as-a-Service (PaaS) • Cloud Management & Security • Azure Monitor, Azure Security Center (ASC) / Azure Sentinel • Cloud Governance • Azure Policy, Blueprints, Management Groups, and Azure Cost Management (ACM) • Business Continuity and Disaster Recovery (BCDR) • Azure Site Recovery (ASR) / Azure Migrate, and Azure Backup • Infrastructure-as-Code (IaC) • Azure Resource Manager (ARM), and Terraform • 5x MVP - Cloud and Datacenter Management (CDM) • 1x HCA – HashiCorp Ambassador Adin.Ermie@outlook.com @AdinErmie https://AdinErmie.com linkedin.com/in/adinermie https://github.com/AErmie

Notes de l'éditeur

  1. NOTE: The public documentation incorrectly shows an example of Import, even though the feature is not actually available yet!