UNPKG

@pulumi/azuread

Version:

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

336 lines • 14.9 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! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Application = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("./utilities")); /** * Manages an application registration within Azure Active Directory. * * For a more lightweight alternative, please see the azuread.ApplicationRegistration resource. Please note that this resource should not be used together with the `azuread.ApplicationRegistration` resource when managing the same application. * * ## API Permissions * * The following API permissions are required in order to use this resource. * * When authenticated with a service principal, this resource requires one of the following application roles: `Application.ReadWrite.OwnedBy` or `Application.ReadWrite.All` * * > When using the `Application.ReadWrite.OwnedBy` application role, you should ensure that the principal being used to run Terraform is included in the `owners` property. * * Additionally, you may need the `User.Read.All` application role when including user principals in the `owners` property. * * When authenticated with a user principal, this resource may require one of the following directory roles: `Application Administrator` or `Global Administrator` * * ## Example Usage * * *Create an application* * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuread from "@pulumi/azuread"; * import * as std from "@pulumi/std"; * * const current = azuread.getClientConfig({}); * const example = new azuread.Application("example", { * displayName: "example", * identifierUris: ["api://example-app"], * logoImage: std.filebase64({ * input: "/path/to/logo.png", * }).then(invoke => invoke.result), * owners: [current.then(current => current.objectId)], * signInAudience: "AzureADMultipleOrgs", * api: { * mappedClaimsEnabled: true, * requestedAccessTokenVersion: 2, * knownClientApplications: [ * known1.clientId, * known2.clientId, * ], * oauth2PermissionScopes: [ * { * adminConsentDescription: "Allow the application to access example on behalf of the signed-in user.", * adminConsentDisplayName: "Access example", * enabled: true, * id: "96183846-204b-4b43-82e1-5d2222eb4b9b", * type: "User", * userConsentDescription: "Allow the application to access example on your behalf.", * userConsentDisplayName: "Access example", * value: "user_impersonation", * }, * { * adminConsentDescription: "Administer the example application", * adminConsentDisplayName: "Administer", * enabled: true, * id: "be98fa3e-ab5b-4b11-83d9-04ba2b7946bc", * type: "Admin", * value: "administer", * }, * ], * }, * appRoles: [ * { * allowedMemberTypes: [ * "User", * "Application", * ], * description: "Admins can manage roles and perform all task actions", * displayName: "Admin", * enabled: true, * id: "1b19509b-32b1-4e9f-b71d-4992aa991967", * value: "admin", * }, * { * allowedMemberTypes: ["User"], * description: "ReadOnly roles have limited query access", * displayName: "ReadOnly", * enabled: true, * id: "497406e4-012a-4267-bf18-45a1cb148a01", * value: "User", * }, * ], * featureTags: [{ * enterprise: true, * gallery: true, * }], * optionalClaims: { * accessTokens: [ * { * name: "myclaim", * }, * { * name: "otherclaim", * }, * ], * idTokens: [{ * name: "userclaim", * source: "user", * essential: true, * additionalProperties: ["emit_as_roles"], * }], * saml2Tokens: [{ * name: "samlexample", * }], * }, * requiredResourceAccesses: [ * { * resourceAppId: "00000003-0000-0000-c000-000000000000", * resourceAccesses: [ * { * id: "df021288-bdef-4463-88db-98f22de89214", * type: "Role", * }, * { * id: "b4e74841-8e56-480b-be8b-910348b18b4c", * type: "Scope", * }, * ], * }, * { * resourceAppId: "c5393580-f805-4401-95e8-94b7a6ef2fc2", * resourceAccesses: [{ * id: "594c1fb6-4f81-4475-ae41-0c394909246c", * type: "Role", * }], * }, * ], * web: { * homepageUrl: "https://app.example.net", * logoutUrl: "https://app.example.net/logout", * redirectUris: ["https://app.example.net/account"], * implicitGrant: { * accessTokenIssuanceEnabled: true, * idTokenIssuanceEnabled: true, * }, * }, * }); * ``` * * *Create application and generate a password* * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuread from "@pulumi/azuread"; * import * as std from "@pulumi/std"; * import * as time from "@pulumiverse/time"; * * const current = azuread.getClientConfig({}); * const example = new time.Rotating("example", {rotationDays: 180}); * const exampleApplication = new azuread.Application("example", { * displayName: "example", * owners: [current.then(current => current.objectId)], * password: { * displayName: "MySecret-1", * startDate: example.id, * endDate: std.timeaddOutput({ * duration: example.id, * timestamp: "4320h", * }).apply(invoke => invoke.result), * }, * }); * export const examplePassword = exampleApplication.password.apply(password => password?.[0]?.value); * ``` * * *Create application 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 * * Applications can be imported using the object ID of the application, in the following format. * * ```sh * $ pulumi import azuread:index/application:Application example /applications/00000000-0000-0000-0000-000000000000 * ``` */ class Application extends pulumi.CustomResource { /** * Get an existing Application 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 Application(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'azuread:index/application:Application'; /** * Returns true if the given object is an instance of Application. 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'] === Application.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["api"] = state?.api; resourceInputs["appRoleIds"] = state?.appRoleIds; resourceInputs["appRoles"] = state?.appRoles; resourceInputs["clientId"] = state?.clientId; resourceInputs["description"] = state?.description; resourceInputs["deviceOnlyAuthEnabled"] = state?.deviceOnlyAuthEnabled; resourceInputs["disabledByMicrosoft"] = state?.disabledByMicrosoft; resourceInputs["displayName"] = state?.displayName; resourceInputs["fallbackPublicClientEnabled"] = state?.fallbackPublicClientEnabled; resourceInputs["featureTags"] = state?.featureTags; resourceInputs["groupMembershipClaims"] = state?.groupMembershipClaims; resourceInputs["identifierUris"] = state?.identifierUris; resourceInputs["logoImage"] = state?.logoImage; resourceInputs["logoUrl"] = state?.logoUrl; resourceInputs["marketingUrl"] = state?.marketingUrl; resourceInputs["notes"] = state?.notes; resourceInputs["oauth2PermissionScopeIds"] = state?.oauth2PermissionScopeIds; resourceInputs["oauth2PostResponseRequired"] = state?.oauth2PostResponseRequired; resourceInputs["objectId"] = state?.objectId; resourceInputs["optionalClaims"] = state?.optionalClaims; resourceInputs["owners"] = state?.owners; resourceInputs["password"] = state?.password; resourceInputs["preventDuplicateNames"] = state?.preventDuplicateNames; resourceInputs["privacyStatementUrl"] = state?.privacyStatementUrl; resourceInputs["publicClient"] = state?.publicClient; resourceInputs["publisherDomain"] = state?.publisherDomain; resourceInputs["requiredResourceAccesses"] = state?.requiredResourceAccesses; resourceInputs["serviceManagementReference"] = state?.serviceManagementReference; resourceInputs["signInAudience"] = state?.signInAudience; resourceInputs["singlePageApplication"] = state?.singlePageApplication; resourceInputs["supportUrl"] = state?.supportUrl; resourceInputs["tags"] = state?.tags; resourceInputs["templateId"] = state?.templateId; resourceInputs["termsOfServiceUrl"] = state?.termsOfServiceUrl; resourceInputs["web"] = state?.web; } else { const args = argsOrState; if (args?.displayName === undefined && !opts.urn) { throw new Error("Missing required property 'displayName'"); } resourceInputs["api"] = args?.api; resourceInputs["appRoles"] = args?.appRoles; resourceInputs["description"] = args?.description; resourceInputs["deviceOnlyAuthEnabled"] = args?.deviceOnlyAuthEnabled; resourceInputs["displayName"] = args?.displayName; resourceInputs["fallbackPublicClientEnabled"] = args?.fallbackPublicClientEnabled; resourceInputs["featureTags"] = args?.featureTags; resourceInputs["groupMembershipClaims"] = args?.groupMembershipClaims; resourceInputs["identifierUris"] = args?.identifierUris; resourceInputs["logoImage"] = args?.logoImage; resourceInputs["marketingUrl"] = args?.marketingUrl; resourceInputs["notes"] = args?.notes; resourceInputs["oauth2PostResponseRequired"] = args?.oauth2PostResponseRequired; resourceInputs["optionalClaims"] = args?.optionalClaims; resourceInputs["owners"] = args?.owners; resourceInputs["password"] = args?.password; resourceInputs["preventDuplicateNames"] = args?.preventDuplicateNames; resourceInputs["privacyStatementUrl"] = args?.privacyStatementUrl; resourceInputs["publicClient"] = args?.publicClient; resourceInputs["requiredResourceAccesses"] = args?.requiredResourceAccesses; resourceInputs["serviceManagementReference"] = args?.serviceManagementReference; resourceInputs["signInAudience"] = args?.signInAudience; resourceInputs["singlePageApplication"] = args?.singlePageApplication; resourceInputs["supportUrl"] = args?.supportUrl; resourceInputs["tags"] = args?.tags; resourceInputs["templateId"] = args?.templateId; resourceInputs["termsOfServiceUrl"] = args?.termsOfServiceUrl; resourceInputs["web"] = args?.web; resourceInputs["appRoleIds"] = undefined /*out*/; resourceInputs["clientId"] = undefined /*out*/; resourceInputs["disabledByMicrosoft"] = undefined /*out*/; resourceInputs["logoUrl"] = undefined /*out*/; resourceInputs["oauth2PermissionScopeIds"] = undefined /*out*/; resourceInputs["objectId"] = undefined /*out*/; resourceInputs["publisherDomain"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Application.__pulumiType, name, resourceInputs, opts); } } exports.Application = Application; //# sourceMappingURL=application.js.map