Permission in ADO to Access Service Connection

permission

Hello Everyone and Welcome back to the series of Azure Service Connection, Today we will provide permission in ado to access the service connection

We will learn to access the ADO pipeline using the Terraform module for the access service connection

Steps to access the service connection using permission

Here we will access the service connection using the module Terraform by using various files with it

First, we will create the providers.tf file :

terraform {

required_providers {

azuredevops = {
source = "microsoft/azuredevops"
version = "0.10.0"
}
}
required_version = ">= 0.13"
}

provider "azuredevops" {
personal_access_token = var.adotoken_VV
org_service_url = var.organization_service_url_VV
}

Second, we will create the variables.tf so that we can manipulate the variables as per requirement :

variable "adotoken_VV" {
type = string
description = "Personal Access Token to create Service Connection"
}

variable "organization_service_url_VV" {
type = string
description = "Organisation Service URL"
}

variable "project_name_VV" {
type = string
description = "Name of Project"
}

variable "pipeline_definition_id_VV" {
type = list(string)
description = "ID of Pipeline Definition"
}

variable "service_connection_name_VV" {
type = string
description = "Name of Service Connection"
}

Third, we have the main.tf file where we utilise our variables to access the service connection :

data "azuredevops_project" "project" {
name = var.project_name_VV
}

data "azuredevops_serviceendpoint_azurerm" "serviceendpoint" {
project_id     = data.azuredevops_project.project.id
service_endpoint_name = var.service_connection_name_VV
}

resource "azuredevops_pipeline_authorization" "pipeline_authorization" {
count    = length(var.pipeline_definition_id_VV)
project_id  = data.azuredevops_project.project.project_id
resource_id = data.azuredevops_serviceendpoint_azurerm.serviceendpoint.service_endpoint_id
type    = "endpoint"
pipeline_id  = var.pipeline_definition_id_VV[count.index]
}

Connect for more information by clicking here.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top