@pulumi/azuread
Version:
A Pulumi package for creating and managing Azure Active Directory (Azure AD) cloud resources.
94 lines • 4.1 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.DirectoryRole = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a Directory Role within Azure Active Directory. Directory Roles are also known as Administrator Roles.
*
* Directory Roles are built-in to Azure Active Directory and are immutable. However, by default they are not activated in a tenant (except for the Global Administrator role). This resource ensures a directory role is activated from its associated role template, and exports the object ID of the role, so that role assignments can be made for it.
*
* Once activated, directory roles cannot be deactivated and so this resource does not perform any actions on destroy.
*
* ## 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: `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
*
* *Activate a directory role by its template ID*
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuread from "@pulumi/azuread";
*
* const example = new azuread.DirectoryRole("example", {templateId: "00000000-0000-0000-0000-000000000000"});
* ```
*
* *Activate a directory role by display name*
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuread from "@pulumi/azuread";
*
* const example = new azuread.DirectoryRole("example", {displayName: "Printer administrator"});
* ```
*
* ## Import
*
* This resource does not support importing.
*/
class DirectoryRole extends pulumi.CustomResource {
/**
* Get an existing DirectoryRole 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 DirectoryRole(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of DirectoryRole. 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'] === DirectoryRole.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state?.description;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["objectId"] = state?.objectId;
resourceInputs["templateId"] = state?.templateId;
}
else {
const args = argsOrState;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["templateId"] = args?.templateId;
resourceInputs["description"] = undefined /*out*/;
resourceInputs["objectId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DirectoryRole.__pulumiType, name, resourceInputs, opts);
}
}
exports.DirectoryRole = DirectoryRole;
/** @internal */
DirectoryRole.__pulumiType = 'azuread:index/directoryRole:DirectoryRole';
//# sourceMappingURL=directoryRole.js.map