UNPKG

@pulumi/azuredevops

Version:

A Pulumi package for creating and managing Azure DevOps.

277 lines (276 loc) 11.5 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Manages a Azure Container Registry service endpoint within Azure DevOps. * * ## Example Usage * * ### Authorize with Service Principal * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.Project("example", { * name: "Example Project", * visibility: "private", * versionControl: "Git", * workItemTemplate: "Agile", * description: "Managed by Pulumi", * }); * // azure container registry service connection * const exampleServiceEndpointAzureEcr = new azuredevops.ServiceEndpointAzureEcr("example", { * projectId: example.id, * serviceEndpointName: "Example AzureCR", * resourceGroup: "example-rg", * azurecrSpnTenantid: "00000000-0000-0000-0000-000000000000", * azurecrName: "ExampleAcr", * azurecrSubscriptionId: "00000000-0000-0000-0000-000000000000", * azurecrSubscriptionName: "subscription name", * }); * ``` * * ### Authorize with WorkloadIdentityFederation * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.Project("example", { * name: "Example Project", * visibility: "private", * versionControl: "Git", * workItemTemplate: "Agile", * description: "Managed by Pulumi", * }); * const identity = new azure.core.ResourceGroup("identity", { * name: "identity", * location: "UK South", * }); * const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", { * location: identity.location, * name: "example-identity", * resourceGroupName: identity.name, * }); * // azure container registry service connection * const exampleServiceEndpointAzureEcr = new azuredevops.ServiceEndpointAzureEcr("example", { * projectId: example.id, * resourceGroup: "Example AzureCR ResourceGroup", * serviceEndpointName: "Example AzureCR", * serviceEndpointAuthenticationScheme: "WorkloadIdentityFederation", * azurecrSpnTenantid: "00000000-0000-0000-0000-000000000000", * azurecrName: "ExampleAcr", * azurecrSubscriptionId: "00000000-0000-0000-0000-000000000000", * azurecrSubscriptionName: "subscription name", * credentials: { * serviceprincipalid: exampleUserAssignedIdentity.clientId, * }, * }); * const exampleFederatedIdentityCredential = new azure.armmsi.FederatedIdentityCredential("example", { * name: "example-federated-credential", * resourceGroupName: identity.name, * parentId: exampleUserAssignedIdentity.id, * audience: "api://AzureADTokenExchange", * issuer: exampleServiceEndpointAzureEcr.workloadIdentityFederationIssuer, * subject: exampleServiceEndpointAzureEcr.workloadIdentityFederationSubject, * }); * ``` * * ## Relevant Links * * - [Azure DevOps Service REST API 7.0 - Service Endpoints](https://docs.microsoft.com/en-us/rest/api/azure/devops/serviceendpoint/endpoints?view=azure-devops-rest-7.0) * - [Azure Container Registry REST API](https://docs.microsoft.com/en-us/rest/api/containerregistry/) * * ## Import * * Azure DevOps Azure Container Registry Service Endpoint can be imported using **projectID/serviceEndpointID** or **projectName/serviceEndpointID** * * ```sh * $ pulumi import azuredevops:index/serviceEndpointAzureEcr:ServiceEndpointAzureEcr example 00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000 * ``` */ export declare class ServiceEndpointAzureEcr extends pulumi.CustomResource { /** * Get an existing ServiceEndpointAzureEcr resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ServiceEndpointAzureEcrState, opts?: pulumi.CustomResourceOptions): ServiceEndpointAzureEcr; /** * Returns true if the given object is an instance of ServiceEndpointAzureEcr. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is ServiceEndpointAzureEcr; readonly appObjectId: pulumi.Output<string>; readonly authorization: pulumi.Output<{ [key: string]: string; }>; readonly azSpnRoleAssignmentId: pulumi.Output<string>; readonly azSpnRolePermissions: pulumi.Output<string>; /** * The Azure container registry name. */ readonly azurecrName: pulumi.Output<string>; /** * The tenant id of the service principal. */ readonly azurecrSpnTenantid: pulumi.Output<string>; /** * The subscription id of the Azure targets. */ readonly azurecrSubscriptionId: pulumi.Output<string>; /** * The subscription name of the Azure targets. */ readonly azurecrSubscriptionName: pulumi.Output<string>; /** * A `credentials` block as defined below. */ readonly credentials: pulumi.Output<outputs.ServiceEndpointAzureEcrCredentials | undefined>; readonly description: pulumi.Output<string | undefined>; /** * The ID of the project. */ readonly projectId: pulumi.Output<string>; /** * The resource group to which the container registry belongs. */ readonly resourceGroup: pulumi.Output<string | undefined>; /** * Specifies the type of azurerm endpoint, either `WorkloadIdentityFederation`, `ManagedServiceIdentity` or `ServicePrincipal`. Defaults to `ServicePrincipal` for backwards compatibility. `ManagedServiceIdentity` has not yet been implemented for this resource. */ readonly serviceEndpointAuthenticationScheme: pulumi.Output<string | undefined>; /** * The name you will use to refer to this service connection in task inputs. */ readonly serviceEndpointName: pulumi.Output<string>; /** * The Application(Client) ID of the Service Principal. */ readonly servicePrincipalId: pulumi.Output<string>; readonly spnObjectId: pulumi.Output<string>; /** * The issuer if `serviceEndpointAuthenticationScheme` is set to `WorkloadIdentityFederation`. This looks like `https://vstoken.dev.azure.com/00000000-0000-0000-0000-000000000000`, where the GUID is the Organization ID of your Azure DevOps Organisation. */ readonly workloadIdentityFederationIssuer: pulumi.Output<string>; /** * The subject if `serviceEndpointAuthenticationScheme` is set to `WorkloadIdentityFederation`. This looks like `sc://<organisation>/<project>/<service-connection-name>`. */ readonly workloadIdentityFederationSubject: pulumi.Output<string>; /** * Create a ServiceEndpointAzureEcr resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ServiceEndpointAzureEcrArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ServiceEndpointAzureEcr resources. */ export interface ServiceEndpointAzureEcrState { appObjectId?: pulumi.Input<string>; authorization?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; azSpnRoleAssignmentId?: pulumi.Input<string>; azSpnRolePermissions?: pulumi.Input<string>; /** * The Azure container registry name. */ azurecrName?: pulumi.Input<string>; /** * The tenant id of the service principal. */ azurecrSpnTenantid?: pulumi.Input<string>; /** * The subscription id of the Azure targets. */ azurecrSubscriptionId?: pulumi.Input<string>; /** * The subscription name of the Azure targets. */ azurecrSubscriptionName?: pulumi.Input<string>; /** * A `credentials` block as defined below. */ credentials?: pulumi.Input<inputs.ServiceEndpointAzureEcrCredentials>; description?: pulumi.Input<string>; /** * The ID of the project. */ projectId?: pulumi.Input<string>; /** * The resource group to which the container registry belongs. */ resourceGroup?: pulumi.Input<string>; /** * Specifies the type of azurerm endpoint, either `WorkloadIdentityFederation`, `ManagedServiceIdentity` or `ServicePrincipal`. Defaults to `ServicePrincipal` for backwards compatibility. `ManagedServiceIdentity` has not yet been implemented for this resource. */ serviceEndpointAuthenticationScheme?: pulumi.Input<string>; /** * The name you will use to refer to this service connection in task inputs. */ serviceEndpointName?: pulumi.Input<string>; /** * The Application(Client) ID of the Service Principal. */ servicePrincipalId?: pulumi.Input<string>; spnObjectId?: pulumi.Input<string>; /** * The issuer if `serviceEndpointAuthenticationScheme` is set to `WorkloadIdentityFederation`. This looks like `https://vstoken.dev.azure.com/00000000-0000-0000-0000-000000000000`, where the GUID is the Organization ID of your Azure DevOps Organisation. */ workloadIdentityFederationIssuer?: pulumi.Input<string>; /** * The subject if `serviceEndpointAuthenticationScheme` is set to `WorkloadIdentityFederation`. This looks like `sc://<organisation>/<project>/<service-connection-name>`. */ workloadIdentityFederationSubject?: pulumi.Input<string>; } /** * The set of arguments for constructing a ServiceEndpointAzureEcr resource. */ export interface ServiceEndpointAzureEcrArgs { /** * The Azure container registry name. */ azurecrName: pulumi.Input<string>; /** * The tenant id of the service principal. */ azurecrSpnTenantid: pulumi.Input<string>; /** * The subscription id of the Azure targets. */ azurecrSubscriptionId: pulumi.Input<string>; /** * The subscription name of the Azure targets. */ azurecrSubscriptionName: pulumi.Input<string>; /** * A `credentials` block as defined below. */ credentials?: pulumi.Input<inputs.ServiceEndpointAzureEcrCredentials>; description?: pulumi.Input<string>; /** * The ID of the project. */ projectId: pulumi.Input<string>; /** * The resource group to which the container registry belongs. */ resourceGroup?: pulumi.Input<string>; /** * Specifies the type of azurerm endpoint, either `WorkloadIdentityFederation`, `ManagedServiceIdentity` or `ServicePrincipal`. Defaults to `ServicePrincipal` for backwards compatibility. `ManagedServiceIdentity` has not yet been implemented for this resource. */ serviceEndpointAuthenticationScheme?: pulumi.Input<string>; /** * The name you will use to refer to this service connection in task inputs. */ serviceEndpointName: pulumi.Input<string>; }