azuredevops logo
Azure DevOps v2.7.0, Mar 27 23

azuredevops.ResourceAuthorization

Explore with Pulumi AI

Manages authorization of resources, e.g. for access in build pipelines.

Currently supported resources: service endpoint (aka service connection, endpoint).

Example Usage

using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;

return await Deployment.RunAsync(() => 
{
    var exampleProject = new AzureDevOps.Project("exampleProject", new()
    {
        Visibility = "private",
        VersionControl = "Git",
        WorkItemTemplate = "Agile",
        Description = "Managed by Terraform",
    });

    var exampleServiceEndpointBitBucket = new AzureDevOps.ServiceEndpointBitBucket("exampleServiceEndpointBitBucket", new()
    {
        ProjectId = exampleProject.Id,
        Username = "username",
        Password = "password",
        ServiceEndpointName = "example-bitbucket",
        Description = "Managed by Terraform",
    });

    var exampleResourceAuthorization = new AzureDevOps.ResourceAuthorization("exampleResourceAuthorization", new()
    {
        ProjectId = exampleProject.Id,
        ResourceId = exampleServiceEndpointBitBucket.Id,
        Authorized = true,
    });

});
package main

import (
	"github.com/pulumi/pulumi-azuredevops/sdk/v2/go/azuredevops"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", &azuredevops.ProjectArgs{
			Visibility:       pulumi.String("private"),
			VersionControl:   pulumi.String("Git"),
			WorkItemTemplate: pulumi.String("Agile"),
			Description:      pulumi.String("Managed by Terraform"),
		})
		if err != nil {
			return err
		}
		exampleServiceEndpointBitBucket, err := azuredevops.NewServiceEndpointBitBucket(ctx, "exampleServiceEndpointBitBucket", &azuredevops.ServiceEndpointBitBucketArgs{
			ProjectId:           exampleProject.ID(),
			Username:            pulumi.String("username"),
			Password:            pulumi.String("password"),
			ServiceEndpointName: pulumi.String("example-bitbucket"),
			Description:         pulumi.String("Managed by Terraform"),
		})
		if err != nil {
			return err
		}
		_, err = azuredevops.NewResourceAuthorization(ctx, "exampleResourceAuthorization", &azuredevops.ResourceAuthorizationArgs{
			ProjectId:  exampleProject.ID(),
			ResourceId: exampleServiceEndpointBitBucket.ID(),
			Authorized: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.Project;
import com.pulumi.azuredevops.ProjectArgs;
import com.pulumi.azuredevops.ServiceEndpointBitBucket;
import com.pulumi.azuredevops.ServiceEndpointBitBucketArgs;
import com.pulumi.azuredevops.ResourceAuthorization;
import com.pulumi.azuredevops.ResourceAuthorizationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var exampleProject = new Project("exampleProject", ProjectArgs.builder()        
            .visibility("private")
            .versionControl("Git")
            .workItemTemplate("Agile")
            .description("Managed by Terraform")
            .build());

        var exampleServiceEndpointBitBucket = new ServiceEndpointBitBucket("exampleServiceEndpointBitBucket", ServiceEndpointBitBucketArgs.builder()        
            .projectId(exampleProject.id())
            .username("username")
            .password("password")
            .serviceEndpointName("example-bitbucket")
            .description("Managed by Terraform")
            .build());

        var exampleResourceAuthorization = new ResourceAuthorization("exampleResourceAuthorization", ResourceAuthorizationArgs.builder()        
            .projectId(exampleProject.id())
            .resourceId(exampleServiceEndpointBitBucket.id())
            .authorized(true)
            .build());

    }
}
import pulumi
import pulumi_azuredevops as azuredevops

example_project = azuredevops.Project("exampleProject",
    visibility="private",
    version_control="Git",
    work_item_template="Agile",
    description="Managed by Terraform")
example_service_endpoint_bit_bucket = azuredevops.ServiceEndpointBitBucket("exampleServiceEndpointBitBucket",
    project_id=example_project.id,
    username="username",
    password="password",
    service_endpoint_name="example-bitbucket",
    description="Managed by Terraform")
example_resource_authorization = azuredevops.ResourceAuthorization("exampleResourceAuthorization",
    project_id=example_project.id,
    resource_id=example_service_endpoint_bit_bucket.id,
    authorized=True)
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";

const exampleProject = new azuredevops.Project("exampleProject", {
    visibility: "private",
    versionControl: "Git",
    workItemTemplate: "Agile",
    description: "Managed by Terraform",
});
const exampleServiceEndpointBitBucket = new azuredevops.ServiceEndpointBitBucket("exampleServiceEndpointBitBucket", {
    projectId: exampleProject.id,
    username: "username",
    password: "password",
    serviceEndpointName: "example-bitbucket",
    description: "Managed by Terraform",
});
const exampleResourceAuthorization = new azuredevops.ResourceAuthorization("exampleResourceAuthorization", {
    projectId: exampleProject.id,
    resourceId: exampleServiceEndpointBitBucket.id,
    authorized: true,
});
resources:
  exampleProject:
    type: azuredevops:Project
    properties:
      visibility: private
      versionControl: Git
      workItemTemplate: Agile
      description: Managed by Terraform
  exampleServiceEndpointBitBucket:
    type: azuredevops:ServiceEndpointBitBucket
    properties:
      projectId: ${exampleProject.id}
      username: username
      password: password
      serviceEndpointName: example-bitbucket
      description: Managed by Terraform
  exampleResourceAuthorization:
    type: azuredevops:ResourceAuthorization
    properties:
      projectId: ${exampleProject.id}
      resourceId: ${exampleServiceEndpointBitBucket.id}
      authorized: true

Create ResourceAuthorization Resource

new ResourceAuthorization(name: string, args: ResourceAuthorizationArgs, opts?: CustomResourceOptions);
@overload
def ResourceAuthorization(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          authorized: Optional[bool] = None,
                          definition_id: Optional[int] = None,
                          project_id: Optional[str] = None,
                          resource_id: Optional[str] = None,
                          type: Optional[str] = None)
@overload
def ResourceAuthorization(resource_name: str,
                          args: ResourceAuthorizationArgs,
                          opts: Optional[ResourceOptions] = None)
func NewResourceAuthorization(ctx *Context, name string, args ResourceAuthorizationArgs, opts ...ResourceOption) (*ResourceAuthorization, error)
public ResourceAuthorization(string name, ResourceAuthorizationArgs args, CustomResourceOptions? opts = null)
public ResourceAuthorization(String name, ResourceAuthorizationArgs args)
public ResourceAuthorization(String name, ResourceAuthorizationArgs args, CustomResourceOptions options)
type: azuredevops:ResourceAuthorization
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ResourceAuthorizationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ResourceAuthorizationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ResourceAuthorizationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ResourceAuthorizationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ResourceAuthorizationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ResourceAuthorization Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ResourceAuthorization resource accepts the following input properties:

Authorized bool

Set to true to allow public access in the project. Type: boolean.

ProjectId string

The project ID or project name. Type: string.

ResourceId string

The ID of the resource to authorize. Type: string.

DefinitionId int

The ID of the build definition to authorize. Type: string.

Type string

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

Authorized bool

Set to true to allow public access in the project. Type: boolean.

ProjectId string

The project ID or project name. Type: string.

ResourceId string

The ID of the resource to authorize. Type: string.

DefinitionId int

The ID of the build definition to authorize. Type: string.

Type string

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

authorized Boolean

Set to true to allow public access in the project. Type: boolean.

projectId String

The project ID or project name. Type: string.

resourceId String

The ID of the resource to authorize. Type: string.

definitionId Integer

The ID of the build definition to authorize. Type: string.

type String

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

authorized boolean

Set to true to allow public access in the project. Type: boolean.

projectId string

The project ID or project name. Type: string.

resourceId string

The ID of the resource to authorize. Type: string.

definitionId number

The ID of the build definition to authorize. Type: string.

type string

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

authorized bool

Set to true to allow public access in the project. Type: boolean.

project_id str

The project ID or project name. Type: string.

resource_id str

The ID of the resource to authorize. Type: string.

definition_id int

The ID of the build definition to authorize. Type: string.

type str

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

authorized Boolean

Set to true to allow public access in the project. Type: boolean.

projectId String

The project ID or project name. Type: string.

resourceId String

The ID of the resource to authorize. Type: string.

definitionId Number

The ID of the build definition to authorize. Type: string.

type String

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

Outputs

All input properties are implicitly available as output properties. Additionally, the ResourceAuthorization resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing ResourceAuthorization Resource

Get an existing ResourceAuthorization resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ResourceAuthorizationState, opts?: CustomResourceOptions): ResourceAuthorization
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        authorized: Optional[bool] = None,
        definition_id: Optional[int] = None,
        project_id: Optional[str] = None,
        resource_id: Optional[str] = None,
        type: Optional[str] = None) -> ResourceAuthorization
func GetResourceAuthorization(ctx *Context, name string, id IDInput, state *ResourceAuthorizationState, opts ...ResourceOption) (*ResourceAuthorization, error)
public static ResourceAuthorization Get(string name, Input<string> id, ResourceAuthorizationState? state, CustomResourceOptions? opts = null)
public static ResourceAuthorization get(String name, Output<String> id, ResourceAuthorizationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Authorized bool

Set to true to allow public access in the project. Type: boolean.

DefinitionId int

The ID of the build definition to authorize. Type: string.

ProjectId string

The project ID or project name. Type: string.

ResourceId string

The ID of the resource to authorize. Type: string.

Type string

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

Authorized bool

Set to true to allow public access in the project. Type: boolean.

DefinitionId int

The ID of the build definition to authorize. Type: string.

ProjectId string

The project ID or project name. Type: string.

ResourceId string

The ID of the resource to authorize. Type: string.

Type string

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

authorized Boolean

Set to true to allow public access in the project. Type: boolean.

definitionId Integer

The ID of the build definition to authorize. Type: string.

projectId String

The project ID or project name. Type: string.

resourceId String

The ID of the resource to authorize. Type: string.

type String

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

authorized boolean

Set to true to allow public access in the project. Type: boolean.

definitionId number

The ID of the build definition to authorize. Type: string.

projectId string

The project ID or project name. Type: string.

resourceId string

The ID of the resource to authorize. Type: string.

type string

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

authorized bool

Set to true to allow public access in the project. Type: boolean.

definition_id int

The ID of the build definition to authorize. Type: string.

project_id str

The project ID or project name. Type: string.

resource_id str

The ID of the resource to authorize. Type: string.

type str

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

authorized Boolean

Set to true to allow public access in the project. Type: boolean.

definitionId Number

The ID of the build definition to authorize. Type: string.

projectId String

The project ID or project name. Type: string.

resourceId String

The ID of the resource to authorize. Type: string.

type String

The type of the resource to authorize. Type: string. Valid values: endpoint, queue, variablegroup. Default value: endpoint.

Package Details

Repository
Azure DevOps pulumi/pulumi-azuredevops
License
Apache-2.0
Notes

This Pulumi package is based on the azuredevops Terraform Provider.