UNPKG

@pulumi/azuread

Version:

A Pulumi package for creating and managing Azure Active Directory (Azure AD) cloud resources.

191 lines • 8.62 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ServicePrincipal = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## Example Usage * * *Create a service principal for an application* * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuread from "@pulumi/azuread"; * * const current = azuread.getClientConfig({}); * const example = new azuread.Application("example", { * displayName: "example", * owners: [current.then(current => current.objectId)], * }); * const exampleServicePrincipal = new azuread.ServicePrincipal("example", { * clientId: example.clientId, * appRoleAssignmentRequired: false, * owners: [current.then(current => current.objectId)], * }); * ``` * * *Create a service principal for an enterprise application* * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuread from "@pulumi/azuread"; * * const current = azuread.getClientConfig({}); * const example = new azuread.Application("example", { * displayName: "example", * owners: [current.then(current => current.objectId)], * }); * const exampleServicePrincipal = new azuread.ServicePrincipal("example", { * clientId: example.clientId, * appRoleAssignmentRequired: false, * owners: [current.then(current => current.objectId)], * featureTags: [{ * enterprise: true, * gallery: true, * }], * }); * ``` * * *Manage a service principal for a first-party Microsoft application* * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuread from "@pulumi/azuread"; * * const wellKnown = azuread.getApplicationPublishedAppIds({}); * const msgraph = new azuread.ServicePrincipal("msgraph", { * clientId: wellKnown.then(wellKnown => wellKnown.result?.microsoftGraph), * useExisting: true, * }); * ``` * * *Create a service principal for an application created from a gallery template* * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuread from "@pulumi/azuread"; * * const example = azuread.getApplicationTemplate({ * displayName: "Marketo", * }); * const exampleApplication = new azuread.Application("example", { * displayName: "example", * templateId: example.then(example => example.templateId), * }); * const exampleServicePrincipal = new azuread.ServicePrincipal("example", { * clientId: exampleApplication.clientId, * useExisting: true, * }); * ``` * * ## Import * * Service principals can be imported using their object ID, e.g. * * ```sh * $ pulumi import azuread:index/servicePrincipal:ServicePrincipal example /servicePrincipals/00000000-0000-0000-0000-000000000000 * ``` */ class ServicePrincipal extends pulumi.CustomResource { /** * Get an existing ServicePrincipal 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 ServicePrincipal(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ServicePrincipal. 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'] === ServicePrincipal.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accountEnabled"] = state?.accountEnabled; resourceInputs["alternativeNames"] = state?.alternativeNames; resourceInputs["appRoleAssignmentRequired"] = state?.appRoleAssignmentRequired; resourceInputs["appRoleIds"] = state?.appRoleIds; resourceInputs["appRoles"] = state?.appRoles; resourceInputs["applicationTenantId"] = state?.applicationTenantId; resourceInputs["clientId"] = state?.clientId; resourceInputs["description"] = state?.description; resourceInputs["displayName"] = state?.displayName; resourceInputs["featureTags"] = state?.featureTags; resourceInputs["features"] = state?.features; resourceInputs["homepageUrl"] = state?.homepageUrl; resourceInputs["loginUrl"] = state?.loginUrl; resourceInputs["logoutUrl"] = state?.logoutUrl; resourceInputs["notes"] = state?.notes; resourceInputs["notificationEmailAddresses"] = state?.notificationEmailAddresses; resourceInputs["oauth2PermissionScopeIds"] = state?.oauth2PermissionScopeIds; resourceInputs["oauth2PermissionScopes"] = state?.oauth2PermissionScopes; resourceInputs["objectId"] = state?.objectId; resourceInputs["owners"] = state?.owners; resourceInputs["preferredSingleSignOnMode"] = state?.preferredSingleSignOnMode; resourceInputs["redirectUris"] = state?.redirectUris; resourceInputs["samlMetadataUrl"] = state?.samlMetadataUrl; resourceInputs["samlSingleSignOn"] = state?.samlSingleSignOn; resourceInputs["servicePrincipalNames"] = state?.servicePrincipalNames; resourceInputs["signInAudience"] = state?.signInAudience; resourceInputs["tags"] = state?.tags; resourceInputs["type"] = state?.type; resourceInputs["useExisting"] = state?.useExisting; } else { const args = argsOrState; if (args?.clientId === undefined && !opts.urn) { throw new Error("Missing required property 'clientId'"); } resourceInputs["accountEnabled"] = args?.accountEnabled; resourceInputs["alternativeNames"] = args?.alternativeNames; resourceInputs["appRoleAssignmentRequired"] = args?.appRoleAssignmentRequired; resourceInputs["clientId"] = args?.clientId; resourceInputs["description"] = args?.description; resourceInputs["featureTags"] = args?.featureTags; resourceInputs["features"] = args?.features; resourceInputs["loginUrl"] = args?.loginUrl; resourceInputs["notes"] = args?.notes; resourceInputs["notificationEmailAddresses"] = args?.notificationEmailAddresses; resourceInputs["owners"] = args?.owners; resourceInputs["preferredSingleSignOnMode"] = args?.preferredSingleSignOnMode; resourceInputs["samlSingleSignOn"] = args?.samlSingleSignOn; resourceInputs["tags"] = args?.tags; resourceInputs["useExisting"] = args?.useExisting; resourceInputs["appRoleIds"] = undefined /*out*/; resourceInputs["appRoles"] = undefined /*out*/; resourceInputs["applicationTenantId"] = undefined /*out*/; resourceInputs["displayName"] = undefined /*out*/; resourceInputs["homepageUrl"] = undefined /*out*/; resourceInputs["logoutUrl"] = undefined /*out*/; resourceInputs["oauth2PermissionScopeIds"] = undefined /*out*/; resourceInputs["oauth2PermissionScopes"] = undefined /*out*/; resourceInputs["objectId"] = undefined /*out*/; resourceInputs["redirectUris"] = undefined /*out*/; resourceInputs["samlMetadataUrl"] = undefined /*out*/; resourceInputs["servicePrincipalNames"] = undefined /*out*/; resourceInputs["signInAudience"] = undefined /*out*/; resourceInputs["type"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ServicePrincipal.__pulumiType, name, resourceInputs, opts); } } exports.ServicePrincipal = ServicePrincipal; /** @internal */ ServicePrincipal.__pulumiType = 'azuread:index/servicePrincipal:ServicePrincipal'; //# sourceMappingURL=servicePrincipal.js.map