azuredevops.Queue
Explore with Pulumi AI
Manages an agent queue within Azure DevOps. In the UI, this is equivalent to adding an Organization defined pool to a project.
The created queue is not authorized for use by all pipelines in the project. However,
the azuredevops.ResourceAuthorization resource can be used to grant authorization.
Example Usage
Creating a Queue from an organization-level pool
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const exampleProject = new azuredevops.Project("example", {name: "Example Project"});
const example = azuredevops.getPool({
    name: "example-pool",
});
const exampleQueue = new azuredevops.Queue("example", {
    projectId: exampleProject.id,
    agentPoolId: example.then(example => example.id),
});
// Grant access to queue to all pipelines in the project
const exampleResourceAuthorization = new azuredevops.ResourceAuthorization("example", {
    projectId: exampleProject.id,
    resourceId: exampleQueue.id,
    type: "queue",
    authorized: true,
});
import pulumi
import pulumi_azuredevops as azuredevops
example_project = azuredevops.Project("example", name="Example Project")
example = azuredevops.get_pool(name="example-pool")
example_queue = azuredevops.Queue("example",
    project_id=example_project.id,
    agent_pool_id=example.id)
# Grant access to queue to all pipelines in the project
example_resource_authorization = azuredevops.ResourceAuthorization("example",
    project_id=example_project.id,
    resource_id=example_queue.id,
    type="queue",
    authorized=True)
package main
import (
	"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleProject, err := azuredevops.NewProject(ctx, "example", &azuredevops.ProjectArgs{
			Name: pulumi.String("Example Project"),
		})
		if err != nil {
			return err
		}
		example, err := azuredevops.LookupPool(ctx, &azuredevops.LookupPoolArgs{
			Name: "example-pool",
		}, nil)
		if err != nil {
			return err
		}
		exampleQueue, err := azuredevops.NewQueue(ctx, "example", &azuredevops.QueueArgs{
			ProjectId:   exampleProject.ID(),
			AgentPoolId: pulumi.String(example.Id),
		})
		if err != nil {
			return err
		}
		// Grant access to queue to all pipelines in the project
		_, err = azuredevops.NewResourceAuthorization(ctx, "example", &azuredevops.ResourceAuthorizationArgs{
			ProjectId:  exampleProject.ID(),
			ResourceId: exampleQueue.ID(),
			Type:       pulumi.String("queue"),
			Authorized: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() => 
{
    var exampleProject = new AzureDevOps.Project("example", new()
    {
        Name = "Example Project",
    });
    var example = AzureDevOps.GetPool.Invoke(new()
    {
        Name = "example-pool",
    });
    var exampleQueue = new AzureDevOps.Queue("example", new()
    {
        ProjectId = exampleProject.Id,
        AgentPoolId = example.Apply(getPoolResult => getPoolResult.Id),
    });
    // Grant access to queue to all pipelines in the project
    var exampleResourceAuthorization = new AzureDevOps.ResourceAuthorization("example", new()
    {
        ProjectId = exampleProject.Id,
        ResourceId = exampleQueue.Id,
        Type = "queue",
        Authorized = true,
    });
});
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.AzuredevopsFunctions;
import com.pulumi.azuredevops.inputs.GetPoolArgs;
import com.pulumi.azuredevops.Queue;
import com.pulumi.azuredevops.QueueArgs;
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()
            .name("Example Project")
            .build());
        final var example = AzuredevopsFunctions.getPool(GetPoolArgs.builder()
            .name("example-pool")
            .build());
        var exampleQueue = new Queue("exampleQueue", QueueArgs.builder()
            .projectId(exampleProject.id())
            .agentPoolId(example.applyValue(getPoolResult -> getPoolResult.id()))
            .build());
        // Grant access to queue to all pipelines in the project
        var exampleResourceAuthorization = new ResourceAuthorization("exampleResourceAuthorization", ResourceAuthorizationArgs.builder()
            .projectId(exampleProject.id())
            .resourceId(exampleQueue.id())
            .type("queue")
            .authorized(true)
            .build());
    }
}
resources:
  exampleProject:
    type: azuredevops:Project
    name: example
    properties:
      name: Example Project
  exampleQueue:
    type: azuredevops:Queue
    name: example
    properties:
      projectId: ${exampleProject.id}
      agentPoolId: ${example.id}
  # Grant access to queue to all pipelines in the project
  exampleResourceAuthorization:
    type: azuredevops:ResourceAuthorization
    name: example
    properties:
      projectId: ${exampleProject.id}
      resourceId: ${exampleQueue.id}
      type: queue
      authorized: true
variables:
  example:
    fn::invoke:
      function: azuredevops:getPool
      arguments:
        name: example-pool
Creating a Queue at the project level (Organization-level permissions not required)
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const example = azuredevops.getProject({
    name: "Example Project",
});
const exampleQueue = new azuredevops.Queue("example", {
    name: "example-queue",
    projectId: example.then(example => example.id),
});
import pulumi
import pulumi_azuredevops as azuredevops
example = azuredevops.get_project(name="Example Project")
example_queue = azuredevops.Queue("example",
    name="example-queue",
    project_id=example.id)
package main
import (
	"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := azuredevops.LookupProject(ctx, &azuredevops.LookupProjectArgs{
			Name: pulumi.StringRef("Example Project"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = azuredevops.NewQueue(ctx, "example", &azuredevops.QueueArgs{
			Name:      pulumi.String("example-queue"),
			ProjectId: pulumi.String(example.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() => 
{
    var example = AzureDevOps.GetProject.Invoke(new()
    {
        Name = "Example Project",
    });
    var exampleQueue = new AzureDevOps.Queue("example", new()
    {
        Name = "example-queue",
        ProjectId = example.Apply(getProjectResult => getProjectResult.Id),
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.AzuredevopsFunctions;
import com.pulumi.azuredevops.inputs.GetProjectArgs;
import com.pulumi.azuredevops.Queue;
import com.pulumi.azuredevops.QueueArgs;
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) {
        final var example = AzuredevopsFunctions.getProject(GetProjectArgs.builder()
            .name("Example Project")
            .build());
        var exampleQueue = new Queue("exampleQueue", QueueArgs.builder()
            .name("example-queue")
            .projectId(example.applyValue(getProjectResult -> getProjectResult.id()))
            .build());
    }
}
resources:
  exampleQueue:
    type: azuredevops:Queue
    name: example
    properties:
      name: example-queue
      projectId: ${example.id}
variables:
  example:
    fn::invoke:
      function: azuredevops:getProject
      arguments:
        name: Example Project
Relevant Links
Create Queue Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Queue(name: string, args: QueueArgs, opts?: CustomResourceOptions);@overload
def Queue(resource_name: str,
          args: QueueArgs,
          opts: Optional[ResourceOptions] = None)
@overload
def Queue(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          project_id: Optional[str] = None,
          agent_pool_id: Optional[int] = None,
          name: Optional[str] = None)func NewQueue(ctx *Context, name string, args QueueArgs, opts ...ResourceOption) (*Queue, error)public Queue(string name, QueueArgs args, CustomResourceOptions? opts = null)type: azuredevops:Queue
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args QueueArgs
- 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 QueueArgs
- 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 QueueArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args QueueArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args QueueArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var queueResource = new AzureDevOps.Queue("queueResource", new()
{
    ProjectId = "string",
    AgentPoolId = 0,
    Name = "string",
});
example, err := azuredevops.NewQueue(ctx, "queueResource", &azuredevops.QueueArgs{
	ProjectId:   pulumi.String("string"),
	AgentPoolId: pulumi.Int(0),
	Name:        pulumi.String("string"),
})
var queueResource = new Queue("queueResource", QueueArgs.builder()
    .projectId("string")
    .agentPoolId(0)
    .name("string")
    .build());
queue_resource = azuredevops.Queue("queueResource",
    project_id="string",
    agent_pool_id=0,
    name="string")
const queueResource = new azuredevops.Queue("queueResource", {
    projectId: "string",
    agentPoolId: 0,
    name: "string",
});
type: azuredevops:Queue
properties:
    agentPoolId: 0
    name: string
    projectId: string
Queue Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Queue resource accepts the following input properties:
- ProjectId string
- The ID of the project in which to create the resource.
- AgentPool intId 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- Name string
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- ProjectId string
- The ID of the project in which to create the resource.
- AgentPool intId 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- Name string
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- projectId String
- The ID of the project in which to create the resource.
- agentPool IntegerId 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- name String
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- projectId string
- The ID of the project in which to create the resource.
- agentPool numberId 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- name string
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- project_id str
- The ID of the project in which to create the resource.
- agent_pool_ intid 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- name str
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- projectId String
- The ID of the project in which to create the resource.
- agentPool NumberId 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- name String
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
Outputs
All input properties are implicitly available as output properties. Additionally, the Queue 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 Queue Resource
Get an existing Queue 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?: QueueState, opts?: CustomResourceOptions): Queue@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        agent_pool_id: Optional[int] = None,
        name: Optional[str] = None,
        project_id: Optional[str] = None) -> Queuefunc GetQueue(ctx *Context, name string, id IDInput, state *QueueState, opts ...ResourceOption) (*Queue, error)public static Queue Get(string name, Input<string> id, QueueState? state, CustomResourceOptions? opts = null)public static Queue get(String name, Output<String> id, QueueState state, CustomResourceOptions options)resources:  _:    type: azuredevops:Queue    get:      id: ${id}- 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.
- AgentPool intId 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- Name string
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- ProjectId string
- The ID of the project in which to create the resource.
- AgentPool intId 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- Name string
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- ProjectId string
- The ID of the project in which to create the resource.
- agentPool IntegerId 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- name String
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- projectId String
- The ID of the project in which to create the resource.
- agentPool numberId 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- name string
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- projectId string
- The ID of the project in which to create the resource.
- agent_pool_ intid 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- name str
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- project_id str
- The ID of the project in which to create the resource.
- agentPool NumberId 
- The ID of the organization agent pool. Conflicts with - name.- NOTE: One of - nameor- agent_pool_idmust be specified, but not both. When- agent_pool_idis specified, the agent queue name will be derived from the agent pool name.
- name String
- The name of the agent queue. Defaults to the ID of the agent pool. Conflicts with agent_pool_id.
- projectId String
- The ID of the project in which to create the resource.
Import
Azure DevOps Agent Pools can be imported using the project ID and agent queue ID, e.g.
$ pulumi import azuredevops:index/queue:Queue example 00000000-0000-0000-0000-000000000000/0
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure DevOps pulumi/pulumi-azuredevops
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azuredevopsTerraform Provider.