caf-terraform-landingzones/caf_solution/add-ons/azure_devops_v1
lolorol 3b84cf6e82
Merge pull request #283 from sschne/f/azdo-endpoint-container-registry
add-ons/azure_devops_v1: add service endpoints for Azure container registry
2022-01-18 12:07:03 +08:00
..
agent_pools Initial commit 2021-04-27 10:29:39 +00:00
documentation/images Initial commit 2021-04-27 10:29:39 +00:00
scenario/200-contoso_demo Remove unused var from azure_devops_v1 2021-10-20 12:19:21 +01:00
azdo.tf Update to azdo_pat_admin 2021-06-28 04:32:31 +00:00
azdo_agent_pools.tf Update aks add-ons and add support for adding launchpad_identities 2021-07-21 05:31:36 +00:00
azdo_pipelines.tf Add support for Github service connections 2021-10-20 11:57:44 +01:00
azdo_service_endpoint.github.tf Add support for Github service connections 2021-10-20 11:57:44 +01:00
azdo_service_endpoint.tf Merge pull request #264 from brk3/feature/pbourke-github-azdo-support 2021-12-08 13:58:52 +08:00
azdo_service_endpoints.acr.tf add azdo service endpoints for Azure container registry 2021-12-20 14:53:22 +01:00
azdo_variable_groups.tf Update aks add-ons and add support for adding launchpad_identities 2021-07-21 05:31:36 +00:00
azuredevops_projects.tf update pipeline to fix repo issue 2021-05-03 07:00:51 +00:00
backend.azurerm Initial commit 2021-04-27 10:29:39 +00:00
local.azuread.tf Update aks add-ons and add support for adding launchpad_identities 2021-07-21 05:31:36 +00:00
locals.remote_tfstates.tf add azdo service endpoints for Azure container registry 2021-12-20 14:53:22 +01:00
main.tf Adding partner_id 2021-11-03 02:31:46 +00:00
output.tf Update aks add-ons and add support for adding launchpad_identities 2021-07-21 05:31:36 +00:00
readme.md Update instructions path 2021-12-21 11:22:28 +00:00
variables.azuread.tf update devops and azuread_app 2021-05-28 10:55:42 +00:00
variables.tf Remove unused var from azure_devops_v1 2021-10-20 12:19:21 +01:00

readme.md

Cloud Adoption Framework for Azure - Landing zones on Terraform - Azure Devops add-on

The Azure Devops add-ons allow you to setup you Azure Devops environment as a platform to automate all your subsequent landing zone deployment from level 0 until level 4 through Azure pipelines with self hosted agents.

  • Azure Devops:
    • Projects
    • Agent Pools (Organization and Project Level)
    • Service Endpoints
    • Variables and Variable Groups
    • Pipelines

Azure Devops add-on landing zone operates at level 0

For a review of the hierarchy approach of Cloud Adoption Framework for Azure landing zones on Terraform, you can refer to the following documentation.

Dependencies

Landing zone:

  • CAF Launchpad (Scenario 200 or above)

Azure Devops (example):

Azure:

  • AZDO PAT Token : PAT Token should be updated in keyvault secret that deployed by launchpad LZ as below
  • Github PAT Token : If building from repos hosted in Github, a Github PAT Token should be added to a keyvault secret.

Pipelines

AZDO supports creating pipelines from a number of sources, such as AZDO itself, Github, Bitbucket, etc. For repos hosted in Github, you must configure a [service connection][https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints].

To do this, create a Github PAT token (repo read access is sufficient), and add it to a KeyVault (we recommend the 'secrets' KeyVault typically provisioned in level0). Then provide the following config directive to configure the connection:

service_endpoints = {
  github_endpoint = {
    endpoint_name = "github_endpoint"
    type = "Github"
    project_key = "my_project""
    keyvault = {
      lz_key      = "launchpad"
      key         = "secrets"
      secret_name = "github-pat"
    }
  }
}

When configuring pipelines via the pipelines{} config directive, you can then set the following parameters:

pipelines = {
  launchpad = {
    project_key      = "my_project"
    repo_project_key = "my_project_repo"
    name             = "launchpad"
    folder           = "\\configuration\\level0"
    yaml             = "configuration/dev/pipelines/test.yml"
    repo_type        = "GitHub"
    git_repo_name    = "github_org/repo_name"
    branch_name      = "main"
    service_connection_key = "github_endpoint"
    variables = {
      ...
    }
  }
}

Deployment

rover -lz /tf/caf/caf_solution/add-ons/azure_devops_v1 \
  -tfstate azure_devops-contoso_demo.tfstate \
  -var-folder /tf/caf/caf_solution/add-ons/azure_devops_v1/scenario/200-contoso_demo \
  -parallelism 30 \
  -level level0 \
  -env sandpit \
  -a apply


# If the tfstates are stored in a different subscription you need to execute the following command
rover -lz /tf/caf/caf_solution/add-ons/azure_devops_v1 \
  -tfstate_subscription_id <ID of the subscription> \
  -tfstate azure_devops-contoso_demo.tfstate \
  -var-folder /tf/caf/caf_solution/add-ons/azure_devops_v1/scenario/200-contoso_demo \
  -parallelism 30 \
  -level level0 \
  -env sandpit \
  -a apply

We are planning to release more examples on how to deploy the Azure Devops Agents.