@pulumi/azuread
Version:
A Pulumi package for creating and managing Azure Active Directory (Azure AD) cloud resources.
101 lines • 5.04 kB
JavaScript
;
// *** 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.AdministrativeUnitRoleMember = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a single directory role assignment scoped to an administrative unit within Azure Active Directory.
*
* ## 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: `AdministrativeUnit.ReadWrite.All` and `RoleManagement.ReadWrite.Directory`, or `Directory.ReadWrite.All`
*
* When authenticated with a user principal, this resource requires one of the following directory roles: `Privileged Role Administrator` or `Global Administrator`
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuread from "@pulumi/azuread";
*
* const example = azuread.getUser({
* userPrincipalName: "jdoe@example.com",
* });
* const exampleAdministrativeUnit = new azuread.AdministrativeUnit("example", {displayName: "Example-AU"});
* const exampleDirectoryRole = new azuread.DirectoryRole("example", {displayName: "Security administrator"});
* const exampleAdministrativeUnitRoleMember = new azuread.AdministrativeUnitRoleMember("example", {
* roleObjectId: exampleDirectoryRole.objectId,
* administrativeUnitObjectId: exampleAdministrativeUnit.objectId,
* memberObjectId: example.then(example => example.objectId),
* });
* ```
*
* ## Import
*
* Administrative unit role members can be imported using the object ID of the administrative unit and the unique ID of the role assignment, e.g.
*
* ```sh
* $ pulumi import azuread:index/administrativeUnitRoleMember:AdministrativeUnitRoleMember example
* ```
*
* /directory/administrativeUnits/00000000-0000-0000-0000-000000000000/scopedRoleMembers/zX37MRLyF0uvE-xf2WH4B7x-6CPLfudNnxFGj800htpBXqkxW7bITqGb6Rj4kuTuS
*/
class AdministrativeUnitRoleMember extends pulumi.CustomResource {
/**
* Get an existing AdministrativeUnitRoleMember 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 AdministrativeUnitRoleMember(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of AdministrativeUnitRoleMember. 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'] === AdministrativeUnitRoleMember.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["administrativeUnitObjectId"] = state ? state.administrativeUnitObjectId : undefined;
resourceInputs["memberObjectId"] = state ? state.memberObjectId : undefined;
resourceInputs["roleObjectId"] = state ? state.roleObjectId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.administrativeUnitObjectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'administrativeUnitObjectId'");
}
if ((!args || args.memberObjectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'memberObjectId'");
}
if ((!args || args.roleObjectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'roleObjectId'");
}
resourceInputs["administrativeUnitObjectId"] = args ? args.administrativeUnitObjectId : undefined;
resourceInputs["memberObjectId"] = args ? args.memberObjectId : undefined;
resourceInputs["roleObjectId"] = args ? args.roleObjectId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AdministrativeUnitRoleMember.__pulumiType, name, resourceInputs, opts);
}
}
exports.AdministrativeUnitRoleMember = AdministrativeUnitRoleMember;
/** @internal */
AdministrativeUnitRoleMember.__pulumiType = 'azuread:index/administrativeUnitRoleMember:AdministrativeUnitRoleMember';
//# sourceMappingURL=administrativeUnitRoleMember.js.map