@pulumi/azuread
Version:
A Pulumi package for creating and managing Azure Active Directory (Azure AD) cloud resources.
101 lines • 4.49 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.GroupMember = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a single group membership within Azure Active Directory.
*
* > **Warning** Do not use this resource at the same time as the `members` property of the `azuread.Group` resource for the same group. Doing so will cause a conflict and group members will be removed.
*
* ## 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: `Group.ReadWrite.All` or `Directory.ReadWrite.All`.
*
* However, if the authenticated service principal is an owner of the group being managed, an application role is not required.
*
* When authenticated with a user principal, this resource requires one of the following directory roles: `Groups Administrator`, `User 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 exampleGroup = new azuread.Group("example", {
* displayName: "my_group",
* securityEnabled: true,
* });
* const exampleGroupMember = new azuread.GroupMember("example", {
* groupObjectId: exampleGroup.objectId,
* memberObjectId: example.then(example => example.objectId),
* });
* ```
*
* ## Import
*
* Group members can be imported using the object ID of the group and the object ID of the member, e.g.
*
* ```sh
* $ pulumi import azuread:index/groupMember:GroupMember example 00000000-0000-0000-0000-000000000000/member/11111111-1111-1111-1111-111111111111
* ```
*
* -> This ID format is unique to Terraform and is composed of the Azure AD Group Object ID and the target Member Object ID in the format `{GroupObjectID}/member/{MemberObjectID}`.
*/
class GroupMember extends pulumi.CustomResource {
/**
* Get an existing GroupMember 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 GroupMember(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of GroupMember. 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'] === GroupMember.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["groupObjectId"] = state ? state.groupObjectId : undefined;
resourceInputs["memberObjectId"] = state ? state.memberObjectId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.groupObjectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'groupObjectId'");
}
if ((!args || args.memberObjectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'memberObjectId'");
}
resourceInputs["groupObjectId"] = args ? args.groupObjectId : undefined;
resourceInputs["memberObjectId"] = args ? args.memberObjectId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(GroupMember.__pulumiType, name, resourceInputs, opts);
}
}
exports.GroupMember = GroupMember;
/** @internal */
GroupMember.__pulumiType = 'azuread:index/groupMember:GroupMember';
//# sourceMappingURL=groupMember.js.map