UNPKG

@pulumi/azuread

Version:

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

191 lines • 9.48 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, Object.assign(Object.assign({}, 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 ? state.accountEnabled : undefined; resourceInputs["alternativeNames"] = state ? state.alternativeNames : undefined; resourceInputs["appRoleAssignmentRequired"] = state ? state.appRoleAssignmentRequired : undefined; resourceInputs["appRoleIds"] = state ? state.appRoleIds : undefined; resourceInputs["appRoles"] = state ? state.appRoles : undefined; resourceInputs["applicationTenantId"] = state ? state.applicationTenantId : undefined; resourceInputs["clientId"] = state ? state.clientId : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["displayName"] = state ? state.displayName : undefined; resourceInputs["featureTags"] = state ? state.featureTags : undefined; resourceInputs["features"] = state ? state.features : undefined; resourceInputs["homepageUrl"] = state ? state.homepageUrl : undefined; resourceInputs["loginUrl"] = state ? state.loginUrl : undefined; resourceInputs["logoutUrl"] = state ? state.logoutUrl : undefined; resourceInputs["notes"] = state ? state.notes : undefined; resourceInputs["notificationEmailAddresses"] = state ? state.notificationEmailAddresses : undefined; resourceInputs["oauth2PermissionScopeIds"] = state ? state.oauth2PermissionScopeIds : undefined; resourceInputs["oauth2PermissionScopes"] = state ? state.oauth2PermissionScopes : undefined; resourceInputs["objectId"] = state ? state.objectId : undefined; resourceInputs["owners"] = state ? state.owners : undefined; resourceInputs["preferredSingleSignOnMode"] = state ? state.preferredSingleSignOnMode : undefined; resourceInputs["redirectUris"] = state ? state.redirectUris : undefined; resourceInputs["samlMetadataUrl"] = state ? state.samlMetadataUrl : undefined; resourceInputs["samlSingleSignOn"] = state ? state.samlSingleSignOn : undefined; resourceInputs["servicePrincipalNames"] = state ? state.servicePrincipalNames : undefined; resourceInputs["signInAudience"] = state ? state.signInAudience : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["useExisting"] = state ? state.useExisting : undefined; } else { const args = argsOrState; if ((!args || args.clientId === undefined) && !opts.urn) { throw new Error("Missing required property 'clientId'"); } resourceInputs["accountEnabled"] = args ? args.accountEnabled : undefined; resourceInputs["alternativeNames"] = args ? args.alternativeNames : undefined; resourceInputs["appRoleAssignmentRequired"] = args ? args.appRoleAssignmentRequired : undefined; resourceInputs["clientId"] = args ? args.clientId : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["featureTags"] = args ? args.featureTags : undefined; resourceInputs["features"] = args ? args.features : undefined; resourceInputs["loginUrl"] = args ? args.loginUrl : undefined; resourceInputs["notes"] = args ? args.notes : undefined; resourceInputs["notificationEmailAddresses"] = args ? args.notificationEmailAddresses : undefined; resourceInputs["owners"] = args ? args.owners : undefined; resourceInputs["preferredSingleSignOnMode"] = args ? args.preferredSingleSignOnMode : undefined; resourceInputs["samlSingleSignOn"] = args ? args.samlSingleSignOn : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["useExisting"] = args ? args.useExisting : undefined; 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