Skip to content

How to provision Azure DevOps from scratch and orchestrate container deployments

Notifications You must be signed in to change notification settings

AngelusGi/XmasDev2021

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo XmasDev2021

Table of contents

Description

Demo XmasDev 2021

Requirements

HowTo

  1. Launch PowerShell script to setup terraform backend on Azure (see more)

  2. Launch in the iac folder and run terraform init, terraform plan -out=stage1 and terraform apply stage1. this step will setup your Azure AD creating a service principal. To deploy this stage, please comment "az" and "az_devops" module in terraform main file ("aad" and "data" modules will remain uncommented).

  3. Launch in the iac folder and run terraform init, terraform plan -out=stage2 and terraform apply stage2. This step will create all needed Azure infrastructure (see architecture. To deploy this stage, please comment "az_devops" module in terraform main file ("aad", "data", "az" modules will remain uncommented).

  4. Launch in the iac folder and run terraform init, terraform plan -out=stage3 and terraform apply stage3. This step will create nearly all Azure DevOps infrastructure (only resources not covered by the actual version of Azure DevOps provider in Terraform are: ServiceHook and Agent Pool). To deploy this stage, please comment "az_devops" module in terraform main file ("aad", "data", "az" modules will remain uncommented).

TerraformBackendOnAzure

The script Run-TerraformBackendOnAzure.ps1 will configure the main.tf file to store Terraform states on Azure blob storage, it need as in input file the main Terraform file.

Run-TerraformBackendOnAzure.ps1 in the folder iac can be used like this:

Run-TerraformBackendOnAzure.ps1 -ResourcePrefix "XmasDev21demo" -AzRegion "northeurope" -MainTerraformFileName ".\main.tf"

Whitin an output like this:

Main terraform within backend configuration - screenshot example

Variables

Following an example of the Terraform input variables:

################
# Azure DevOps #
################
project_name   = "<PROJECT-NAME>"
url        = "https://dev.azure.com/<AZ-DEVOPS-ORG-NAME>"
devops_pat = "<DEVOPS-PERSONAL-ACCESS-TOKEN>"
username = "<AZURE-AD-USER-TO-ADD-TO-AZ-DEVOPS-AS-SERVICE-ADMIN>"
devops_license = "basic"

################
# Azure        #
################
admin_username = "<VM-ADMIN-USER>"
admin_password = "<VM-ADMIN-PASSWORD>"
vm_sku = "Standard_B1s"

Architecture

Solution architecture


ExecutionNote

The Run-TerraformBackendOnAzure.ps1 script is tested to be executed both on Windows or Linux or WSL, the only requirement is to have installed PowerShell >= 6.x (how to)

About

How to provision Azure DevOps from scratch and orchestrate container deployments

Topics

Resources

Stars

Watchers

Forks