UNPKG

@pulumi/azuredevops

Version:

A Pulumi package for creating and managing Azure DevOps.

287 lines 14.1 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ServiceEndpointAzureRM = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages Manual or Automatic Azure Resource Manager service endpoint within Azure DevOps. * * ~>**NOTE:** * If you receive an error message like:```Failed to obtain the Json Web Token(JWT) using service principal client ID. Exception message: A configuration issue is preventing authentication - check the error message from the server for details.``` * You should check the secret of this Application or if you recently rotate the secret, wait a few minutes for Azure to propagate the secret. * * ## Requirements (Manual AzureRM Service Endpoint) * * Before to create a service end point in Azure DevOps, you need to create a Service Principal in your Azure subscription. * * For detailed steps to create a service principal with Azure cli see the [documentation](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest) * * ## Example Usage * * ### Service Principal Manual AzureRM Service Endpoint (Subscription Scoped) * * ```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", * }); * const exampleServiceEndpointAzureRM = new azuredevops.ServiceEndpointAzureRM("example", { * projectId: example.id, * serviceEndpointName: "Example AzureRM", * description: "Managed by Pulumi", * serviceEndpointAuthenticationScheme: "ServicePrincipal", * credentials: { * serviceprincipalid: "00000000-0000-0000-0000-000000000000", * serviceprincipalkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", * }, * azurermSpnTenantid: "00000000-0000-0000-0000-000000000000", * azurermSubscriptionId: "00000000-0000-0000-0000-000000000000", * azurermSubscriptionName: "Example Subscription Name", * }); * ``` * * ### Service Principal Manual AzureRM Service Endpoint (ManagementGroup Scoped) * * ```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", * }); * const exampleServiceEndpointAzureRM = new azuredevops.ServiceEndpointAzureRM("example", { * projectId: example.id, * serviceEndpointName: "Example AzureRM", * description: "Managed by Pulumi", * serviceEndpointAuthenticationScheme: "ServicePrincipal", * credentials: { * serviceprincipalid: "00000000-0000-0000-0000-000000000000", * serviceprincipalkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", * }, * azurermSpnTenantid: "00000000-0000-0000-0000-000000000000", * azurermManagementGroupId: "managementGroup", * azurermManagementGroupName: "managementGroup", * }); * ``` * * ### Service Principal Automatic AzureRM Service Endpoint * * ```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", * }); * const exampleServiceEndpointAzureRM = new azuredevops.ServiceEndpointAzureRM("example", { * projectId: example.id, * serviceEndpointName: "Example AzureRM", * serviceEndpointAuthenticationScheme: "ServicePrincipal", * azurermSpnTenantid: "00000000-0000-0000-0000-000000000000", * azurermSubscriptionId: "00000000-0000-0000-0000-000000000000", * azurermSubscriptionName: "Example Subscription Name", * }); * ``` * * ### Workload Identity Federation Manual AzureRM Service Endpoint (Subscription Scoped) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * import * as azuredevops from "@pulumi/azuredevops"; * * const serviceConnectionName = "example-federated-sc"; * 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: "azurerm_resource_group.identity.name", * }); * const exampleServiceEndpointAzureRM = new azuredevops.ServiceEndpointAzureRM("example", { * projectId: example.id, * serviceEndpointName: serviceConnectionName, * description: "Managed by Pulumi", * serviceEndpointAuthenticationScheme: "WorkloadIdentityFederation", * credentials: { * serviceprincipalid: exampleUserAssignedIdentity.clientId, * }, * azurermSpnTenantid: "00000000-0000-0000-0000-000000000000", * azurermSubscriptionId: "00000000-0000-0000-0000-000000000000", * azurermSubscriptionName: "Example Subscription Name", * }); * const exampleFederatedIdentityCredential = new azure.armmsi.FederatedIdentityCredential("example", { * name: "example-federated-credential", * resourceGroupName: identity.name, * parentId: exampleUserAssignedIdentity.id, * audience: "api://AzureADTokenExchange", * issuer: exampleServiceEndpointAzureRM.workloadIdentityFederationIssuer, * subject: exampleServiceEndpointAzureRM.workloadIdentityFederationSubject, * }); * ``` * * ### Workload Identity Federation Automatic AzureRM Service Endpoint * * ```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", * }); * const exampleServiceEndpointAzureRM = new azuredevops.ServiceEndpointAzureRM("example", { * projectId: example.id, * serviceEndpointName: "Example AzureRM", * serviceEndpointAuthenticationScheme: "WorkloadIdentityFederation", * azurermSpnTenantid: "00000000-0000-0000-0000-000000000000", * azurermSubscriptionId: "00000000-0000-0000-0000-000000000000", * azurermSubscriptionName: "Example Subscription Name", * }); * ``` * * ### Managed Identity AzureRM Service Endpoint * * ```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", * }); * const exampleServiceEndpointAzureRM = new azuredevops.ServiceEndpointAzureRM("example", { * projectId: example.id, * serviceEndpointName: "Example AzureRM", * serviceEndpointAuthenticationScheme: "ManagedServiceIdentity", * azurermSpnTenantid: "00000000-0000-0000-0000-000000000000", * azurermSubscriptionId: "00000000-0000-0000-0000-000000000000", * azurermSubscriptionName: "Example Subscription Name", * }); * ``` * * ## Relevant Links * * - [Azure DevOps Service REST API 7.0 - Service End points](https://docs.microsoft.com/en-us/rest/api/azure/devops/serviceendpoint/endpoints?view=azure-devops-rest-7.0) * * ## Import * * Azure DevOps Azure Resource Manager Service Endpoint can be imported using **projectID/serviceEndpointID** or **projectName/serviceEndpointID** * * ```sh * $ pulumi import azuredevops:index/serviceEndpointAzureRM:ServiceEndpointAzureRM example 00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000 * ``` */ class ServiceEndpointAzureRM extends pulumi.CustomResource { /** * Get an existing ServiceEndpointAzureRM 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, id, state, opts) { return new ServiceEndpointAzureRM(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ServiceEndpointAzureRM. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === ServiceEndpointAzureRM.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["authorization"] = state ? state.authorization : undefined; resourceInputs["azurermManagementGroupId"] = state ? state.azurermManagementGroupId : undefined; resourceInputs["azurermManagementGroupName"] = state ? state.azurermManagementGroupName : undefined; resourceInputs["azurermSpnTenantid"] = state ? state.azurermSpnTenantid : undefined; resourceInputs["azurermSubscriptionId"] = state ? state.azurermSubscriptionId : undefined; resourceInputs["azurermSubscriptionName"] = state ? state.azurermSubscriptionName : undefined; resourceInputs["credentials"] = state ? state.credentials : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["environment"] = state ? state.environment : undefined; resourceInputs["features"] = state ? state.features : undefined; resourceInputs["projectId"] = state ? state.projectId : undefined; resourceInputs["resourceGroup"] = state ? state.resourceGroup : undefined; resourceInputs["serverUrl"] = state ? state.serverUrl : undefined; resourceInputs["serviceEndpointAuthenticationScheme"] = state ? state.serviceEndpointAuthenticationScheme : undefined; resourceInputs["serviceEndpointName"] = state ? state.serviceEndpointName : undefined; resourceInputs["servicePrincipalId"] = state ? state.servicePrincipalId : undefined; resourceInputs["workloadIdentityFederationIssuer"] = state ? state.workloadIdentityFederationIssuer : undefined; resourceInputs["workloadIdentityFederationSubject"] = state ? state.workloadIdentityFederationSubject : undefined; } else { const args = argsOrState; if ((!args || args.azurermSpnTenantid === undefined) && !opts.urn) { throw new Error("Missing required property 'azurermSpnTenantid'"); } if ((!args || args.projectId === undefined) && !opts.urn) { throw new Error("Missing required property 'projectId'"); } if ((!args || args.serviceEndpointName === undefined) && !opts.urn) { throw new Error("Missing required property 'serviceEndpointName'"); } resourceInputs["azurermManagementGroupId"] = args ? args.azurermManagementGroupId : undefined; resourceInputs["azurermManagementGroupName"] = args ? args.azurermManagementGroupName : undefined; resourceInputs["azurermSpnTenantid"] = args ? args.azurermSpnTenantid : undefined; resourceInputs["azurermSubscriptionId"] = args ? args.azurermSubscriptionId : undefined; resourceInputs["azurermSubscriptionName"] = args ? args.azurermSubscriptionName : undefined; resourceInputs["credentials"] = args ? args.credentials : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["environment"] = args ? args.environment : undefined; resourceInputs["features"] = args ? args.features : undefined; resourceInputs["projectId"] = args ? args.projectId : undefined; resourceInputs["resourceGroup"] = args ? args.resourceGroup : undefined; resourceInputs["serverUrl"] = args ? args.serverUrl : undefined; resourceInputs["serviceEndpointAuthenticationScheme"] = args ? args.serviceEndpointAuthenticationScheme : undefined; resourceInputs["serviceEndpointName"] = args ? args.serviceEndpointName : undefined; resourceInputs["authorization"] = undefined /*out*/; resourceInputs["servicePrincipalId"] = undefined /*out*/; resourceInputs["workloadIdentityFederationIssuer"] = undefined /*out*/; resourceInputs["workloadIdentityFederationSubject"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ServiceEndpointAzureRM.__pulumiType, name, resourceInputs, opts); } } exports.ServiceEndpointAzureRM = ServiceEndpointAzureRM; /** @internal */ ServiceEndpointAzureRM.__pulumiType = 'azuredevops:index/serviceEndpointAzureRM:ServiceEndpointAzureRM'; //# sourceMappingURL=serviceEndpointAzureRM.js.map