@pnp/cli-microsoft365 7.4.0 → 7.5.0-beta.0ae7da4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/Dockerfile +2 -2
- package/Dockerfile +2 -5
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/m365/app/commands/app-get.js +2 -2
- package/dist/m365/entra/aadCommands.js +1 -0
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +2 -2
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-add.js +8 -8
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-get.js +2 -2
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-list.js +2 -2
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +2 -2
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-roleassignment-add.js +4 -4
- package/dist/m365/entra/commands/app/app-permission-add.js +3 -7
- package/dist/m365/entra/commands/app/app-permission-list.js +182 -0
- package/dist/m365/entra/commands/group/group-add.js +224 -0
- package/dist/m365/entra/commands/group/group-get.js +3 -3
- package/dist/m365/entra/commands/group/group-remove.js +2 -2
- package/dist/m365/entra/commands/group/group-user-add.js +145 -0
- package/dist/m365/entra/commands/group/group-user-list.js +2 -2
- package/dist/m365/entra/commands/m365group/m365group-conversation-list.js +2 -2
- package/dist/m365/entra/commands/m365group/m365group-conversation-post-list.js +3 -3
- package/dist/m365/entra/commands/m365group/m365group-get.js +3 -3
- package/dist/m365/entra/commands/m365group/m365group-remove.js +2 -2
- package/dist/m365/entra/commands/m365group/m365group-renew.js +2 -2
- package/dist/m365/entra/commands/m365group/m365group-set.js +2 -2
- package/dist/m365/entra/commands/m365group/m365group-teamify.js +2 -2
- package/dist/m365/entra/commands/m365group/m365group-user-add.js +2 -2
- package/dist/m365/entra/commands/m365group/m365group-user-list.js +3 -3
- package/dist/m365/entra/commands/m365group/m365group-user-remove.js +2 -2
- package/dist/m365/entra/commands/m365group/m365group-user-set.js +2 -2
- package/dist/m365/entra/commands/user/user-get.js +38 -38
- package/dist/m365/entra/commands.js +3 -0
- package/dist/m365/external/commands/connection/connection-doctor.js +2 -1
- package/dist/m365/file/commands/file-copy.js +151 -0
- package/dist/m365/file/commands.js +1 -0
- package/dist/m365/flow/commands/owner/owner-ensure.js +4 -4
- package/dist/m365/flow/commands/owner/owner-remove.js +4 -4
- package/dist/m365/onenote/commands/notebook/notebook-list.js +2 -2
- package/dist/m365/onenote/commands/page/page-list.js +2 -2
- package/dist/m365/pa/commands/app/app-owner-set.js +2 -2
- package/dist/m365/pa/commands/app/app-permission-ensure.js +4 -4
- package/dist/m365/pa/commands/app/app-permission-remove.js +4 -4
- package/dist/m365/planner/commands/bucket/bucket-add.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-get.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-list.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-remove.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-set.js +2 -2
- package/dist/m365/planner/commands/plan/plan-add.js +2 -2
- package/dist/m365/planner/commands/plan/plan-get.js +2 -2
- package/dist/m365/planner/commands/plan/plan-list.js +2 -2
- package/dist/m365/planner/commands/plan/plan-remove.js +2 -2
- package/dist/m365/planner/commands/plan/plan-set.js +2 -2
- package/dist/m365/planner/commands/roster/roster-member-add.js +2 -2
- package/dist/m365/planner/commands/roster/roster-member-get.js +2 -2
- package/dist/m365/planner/commands/roster/roster-member-remove.js +2 -2
- package/dist/m365/planner/commands/task/task-add.js +2 -2
- package/dist/m365/planner/commands/task/task-get.js +2 -2
- package/dist/m365/planner/commands/task/task-list.js +2 -2
- package/dist/m365/planner/commands/task/task-remove.js +2 -2
- package/dist/m365/planner/commands/task/task-set.js +2 -2
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +1 -1
- package/dist/m365/spo/commands/group/group-member-add.js +4 -4
- package/dist/m365/spo/commands/group/group-member-remove.js +2 -2
- package/dist/m365/spo/commands/group/group-set.js +2 -2
- package/dist/m365/spo/commands/site/site-remove.js +2 -2
- package/dist/m365/spo/commands/site/site-set.js +2 -2
- package/dist/m365/spo/commands/user/user-ensure.js +2 -2
- package/dist/m365/teams/commands/app/app-install.js +2 -2
- package/dist/m365/teams/commands/channel/channel-get.js +2 -2
- package/dist/m365/teams/commands/channel/channel-list.js +2 -2
- package/dist/m365/teams/commands/channel/channel-member-add.js +2 -2
- package/dist/m365/teams/commands/channel/channel-member-list.js +2 -2
- package/dist/m365/teams/commands/channel/channel-member-remove.js +2 -2
- package/dist/m365/teams/commands/channel/channel-member-set.js +2 -2
- package/dist/m365/teams/commands/channel/channel-remove.js +2 -2
- package/dist/m365/teams/commands/channel/channel-set.js +2 -2
- package/dist/m365/teams/commands/meeting/meeting-add.js +2 -2
- package/dist/m365/teams/commands/meeting/meeting-attendancereport-list.js +2 -2
- package/dist/m365/teams/commands/meeting/meeting-get.js +3 -3
- package/dist/m365/teams/commands/meeting/meeting-list.js +2 -2
- package/dist/m365/teams/commands/meeting/meeting-transcript-list.js +2 -2
- package/dist/m365/teams/commands/tab/tab-get.js +2 -2
- package/dist/m365/teams/commands/team/team-add.js +6 -6
- package/dist/m365/teams/commands/team/team-archive.js +2 -2
- package/dist/m365/teams/commands/team/team-get.js +2 -2
- package/dist/m365/teams/commands/team/team-remove.js +2 -2
- package/dist/m365/teams/commands/team/team-unarchive.js +2 -2
- package/dist/utils/{aadAdministrativeUnit.js → entraAdministrativeUnit.js} +2 -2
- package/dist/utils/{aadDevice.js → entraDevice.js} +2 -2
- package/dist/utils/{aadGroup.js → entraGroup.js} +2 -2
- package/dist/utils/{aadUser.js → entraUser.js} +38 -2
- package/dist/utils/spo.js +24 -2
- package/dist/utils/urlUtil.js +31 -0
- package/dist/utils/validation.js +8 -0
- package/docs/docs/cmd/entra/app/app-permission-add.mdx +2 -2
- package/docs/docs/cmd/entra/app/app-permission-list.mdx +105 -0
- package/docs/docs/cmd/entra/group/group-add.mdx +231 -0
- package/docs/docs/cmd/entra/group/group-user-add.mdx +62 -0
- package/docs/docs/cmd/file/file-copy.mdx +68 -0
- package/docs/docs/cmd/spo/listitem/listitem-list.mdx +1 -1
- package/npm-shrinkwrap.json +170 -168
- package/package.json +19 -19
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cli } from '../../../cli/cli.js';
|
|
2
|
-
import
|
|
2
|
+
import entraAppGetCommand from '../../entra/commands/app/app-get.js';
|
|
3
3
|
import AppCommand from '../../base/AppCommand.js';
|
|
4
4
|
import commands from '../commands.js';
|
|
5
5
|
class AppGetCommand extends AppCommand {
|
|
@@ -17,7 +17,7 @@ class AppGetCommand extends AppCommand {
|
|
|
17
17
|
verbose: args.options.verbose
|
|
18
18
|
};
|
|
19
19
|
try {
|
|
20
|
-
const appGetOutput = await cli.executeCommandWithOutput(
|
|
20
|
+
const appGetOutput = await cli.executeCommandWithOutput(entraAppGetCommand, { options: { ...options, _: [] } });
|
|
21
21
|
if (this.verbose) {
|
|
22
22
|
await logger.logToStderr(appGetOutput.stderr);
|
|
23
23
|
}
|
|
@@ -20,6 +20,7 @@ export default {
|
|
|
20
20
|
APPROLEASSIGNMENT_ADD: `${prefix} approleassignment add`,
|
|
21
21
|
APPROLEASSIGNMENT_LIST: `${prefix} approleassignment list`,
|
|
22
22
|
APPROLEASSIGNMENT_REMOVE: `${prefix} approleassignment remove`,
|
|
23
|
+
GROUP_ADD: `${prefix} group add`,
|
|
23
24
|
GROUP_GET: `${prefix} group get`,
|
|
24
25
|
GROUP_LIST: `${prefix} group list`,
|
|
25
26
|
GROUP_REMOVE: `${prefix} group remove`,
|
|
@@ -8,7 +8,7 @@ import { validation } from "../../../../utils/validation.js";
|
|
|
8
8
|
import request from "../../../../request.js";
|
|
9
9
|
import GraphCommand from "../../../base/GraphCommand.js";
|
|
10
10
|
import commands from "../../commands.js";
|
|
11
|
-
import {
|
|
11
|
+
import { entraAdministrativeUnit } from "../../../../utils/entraAdministrativeUnit.js";
|
|
12
12
|
import aadCommands from "../../aadCommands.js";
|
|
13
13
|
class EntraAdministrativeUnitGetCommand extends GraphCommand {
|
|
14
14
|
get name() {
|
|
@@ -36,7 +36,7 @@ class EntraAdministrativeUnitGetCommand extends GraphCommand {
|
|
|
36
36
|
administrativeUnit = await this.getAdministrativeUnitById(args.options.id);
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
administrativeUnit = await
|
|
39
|
+
administrativeUnit = await entraAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.displayName);
|
|
40
40
|
}
|
|
41
41
|
await logger.log(administrativeUnit);
|
|
42
42
|
}
|
|
@@ -4,14 +4,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _EntraAdministrativeUnitMemberAddCommand_instances, _EntraAdministrativeUnitMemberAddCommand_initTelemetry, _EntraAdministrativeUnitMemberAddCommand_initOptions, _EntraAdministrativeUnitMemberAddCommand_initValidators, _EntraAdministrativeUnitMemberAddCommand_initOptionSets;
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { entraAdministrativeUnit } from "../../../../utils/entraAdministrativeUnit.js";
|
|
8
|
+
import { entraGroup } from "../../../../utils/entraGroup.js";
|
|
9
|
+
import { entraUser } from "../../../../utils/entraUser.js";
|
|
10
10
|
import { validation } from "../../../../utils/validation.js";
|
|
11
11
|
import GraphCommand from "../../../base/GraphCommand.js";
|
|
12
12
|
import commands from "../../commands.js";
|
|
13
13
|
import request from "../../../../request.js";
|
|
14
|
-
import {
|
|
14
|
+
import { entraDevice } from "../../../../utils/entraDevice.js";
|
|
15
15
|
import aadCommands from "../../aadCommands.js";
|
|
16
16
|
class EntraAdministrativeUnitMemberAddCommand extends GraphCommand {
|
|
17
17
|
get name() {
|
|
@@ -40,7 +40,7 @@ class EntraAdministrativeUnitMemberAddCommand extends GraphCommand {
|
|
|
40
40
|
if (this.verbose) {
|
|
41
41
|
await logger.logToStderr(`Retrieving Administrative Unit Id...`);
|
|
42
42
|
}
|
|
43
|
-
administrativeUnitId = (await
|
|
43
|
+
administrativeUnitId = (await entraAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.administrativeUnitName)).id;
|
|
44
44
|
}
|
|
45
45
|
if (args.options.userId || args.options.userName) {
|
|
46
46
|
memberType = 'users';
|
|
@@ -49,7 +49,7 @@ class EntraAdministrativeUnitMemberAddCommand extends GraphCommand {
|
|
|
49
49
|
if (this.verbose) {
|
|
50
50
|
await logger.logToStderr(`Retrieving User Id...`);
|
|
51
51
|
}
|
|
52
|
-
memberId = await
|
|
52
|
+
memberId = await entraUser.getUserIdByUpn(args.options.userName);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
else if (args.options.groupId || args.options.groupName) {
|
|
@@ -59,7 +59,7 @@ class EntraAdministrativeUnitMemberAddCommand extends GraphCommand {
|
|
|
59
59
|
if (this.verbose) {
|
|
60
60
|
await logger.logToStderr(`Retrieving Group Id...`);
|
|
61
61
|
}
|
|
62
|
-
memberId = await
|
|
62
|
+
memberId = await entraGroup.getGroupIdByDisplayName(args.options.groupName);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
else if (args.options.deviceId || args.options.deviceName) {
|
|
@@ -69,7 +69,7 @@ class EntraAdministrativeUnitMemberAddCommand extends GraphCommand {
|
|
|
69
69
|
if (this.verbose) {
|
|
70
70
|
await logger.logToStderr(`Device with name ${args.options.deviceName} retrieved, returned id: ${memberId}`);
|
|
71
71
|
}
|
|
72
|
-
memberId = (await
|
|
72
|
+
memberId = (await entraDevice.getDeviceByDisplayName(args.options.deviceName)).id;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
const requestOptions = {
|
|
@@ -7,7 +7,7 @@ var _EntraAdministrativeUnitMemberGetCommand_instances, _EntraAdministrativeUnit
|
|
|
7
7
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
8
8
|
import commands from '../../commands.js';
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
10
|
-
import {
|
|
10
|
+
import { entraAdministrativeUnit } from '../../../../utils/entraAdministrativeUnit.js';
|
|
11
11
|
import request from '../../../../request.js';
|
|
12
12
|
import aadCommands from '../../aadCommands.js';
|
|
13
13
|
class EntraAdministrativeUnitMemberGetCommand extends GraphCommand {
|
|
@@ -35,7 +35,7 @@ class EntraAdministrativeUnitMemberGetCommand extends GraphCommand {
|
|
|
35
35
|
if (this.verbose) {
|
|
36
36
|
await logger.logToStderr(`Retrieving Administrative Unit Id...`);
|
|
37
37
|
}
|
|
38
|
-
administrativeUnitId = (await
|
|
38
|
+
administrativeUnitId = (await entraAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.administrativeUnitName)).id;
|
|
39
39
|
}
|
|
40
40
|
const url = this.getRequestUrl(administrativeUnitId, args.options.id, args.options);
|
|
41
41
|
const requestOptions = {
|
|
@@ -7,7 +7,7 @@ var _EntraAdministrativeUnitMemberListCommand_instances, _EntraAdministrativeUni
|
|
|
7
7
|
import { odata } from '../../../../utils/odata.js';
|
|
8
8
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
9
9
|
import commands from '../../commands.js';
|
|
10
|
-
import {
|
|
10
|
+
import { entraAdministrativeUnit } from '../../../../utils/entraAdministrativeUnit.js';
|
|
11
11
|
import { validation } from '../../../../utils/validation.js';
|
|
12
12
|
import aadCommands from '../../aadCommands.js';
|
|
13
13
|
class EntraAdministrativeUnitMemberListCommand extends GraphCommand {
|
|
@@ -35,7 +35,7 @@ class EntraAdministrativeUnitMemberListCommand extends GraphCommand {
|
|
|
35
35
|
let administrativeUnitId = args.options.administrativeUnitId;
|
|
36
36
|
try {
|
|
37
37
|
if (args.options.administrativeUnitName) {
|
|
38
|
-
administrativeUnitId = (await
|
|
38
|
+
administrativeUnitId = (await entraAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.administrativeUnitName)).id;
|
|
39
39
|
}
|
|
40
40
|
let results;
|
|
41
41
|
const endpoint = this.getRequestUrl(administrativeUnitId, args.options);
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _EntraAdministrativeUnitRemoveCommand_instances, _EntraAdministrativeUnitRemoveCommand_initTelemetry, _EntraAdministrativeUnitRemoveCommand_initOptions, _EntraAdministrativeUnitRemoveCommand_initOptionSets, _EntraAdministrativeUnitRemoveCommand_initValidators, _EntraAdministrativeUnitRemoveCommand_initTypes;
|
|
7
|
-
import {
|
|
7
|
+
import { entraAdministrativeUnit } from '../../../../utils/entraAdministrativeUnit.js';
|
|
8
8
|
import { validation } from "../../../../utils/validation.js";
|
|
9
9
|
import request from "../../../../request.js";
|
|
10
10
|
import GraphCommand from "../../../base/GraphCommand.js";
|
|
@@ -35,7 +35,7 @@ class EntraAdministrativeUnitRemoveCommand extends GraphCommand {
|
|
|
35
35
|
try {
|
|
36
36
|
let administrativeUnitId = args.options.id;
|
|
37
37
|
if (args.options.displayName) {
|
|
38
|
-
const administrativeUnit = await
|
|
38
|
+
const administrativeUnit = await entraAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.displayName);
|
|
39
39
|
administrativeUnitId = administrativeUnit.id;
|
|
40
40
|
}
|
|
41
41
|
const requestOptions = {
|
package/dist/m365/entra/commands/administrativeunit/administrativeunit-roleassignment-add.js
CHANGED
|
@@ -4,8 +4,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, _EntraAdministrativeUnitRoleAssignmentAddCommand_initTelemetry, _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptions, _EntraAdministrativeUnitRoleAssignmentAddCommand_initValidators, _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptionSets;
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { entraAdministrativeUnit } from '../../../../utils/entraAdministrativeUnit.js';
|
|
8
|
+
import { entraUser } from '../../../../utils/entraUser.js';
|
|
9
9
|
import { roleAssignment } from '../../../../utils/roleAssignment.js';
|
|
10
10
|
import { roleDefinition } from '../../../../utils/roleDefinition.js';
|
|
11
11
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -33,7 +33,7 @@ class EntraAdministrativeUnitRoleAssignmentAddCommand extends GraphCommand {
|
|
|
33
33
|
if (this.verbose) {
|
|
34
34
|
await logger.logToStderr(`Retrieving administrative unit by its name '${args.options.administrativeUnitName}'`);
|
|
35
35
|
}
|
|
36
|
-
administrativeUnitId = (await
|
|
36
|
+
administrativeUnitId = (await entraAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.administrativeUnitName)).id;
|
|
37
37
|
}
|
|
38
38
|
if (args.options.roleDefinitionName) {
|
|
39
39
|
if (this.verbose) {
|
|
@@ -45,7 +45,7 @@ class EntraAdministrativeUnitRoleAssignmentAddCommand extends GraphCommand {
|
|
|
45
45
|
if (this.verbose) {
|
|
46
46
|
await logger.logToStderr(`Retrieving user by UPN '${args.options.userName}'`);
|
|
47
47
|
}
|
|
48
|
-
userId = await
|
|
48
|
+
userId = await entraUser.getUserIdByUpn(args.options.userName);
|
|
49
49
|
}
|
|
50
50
|
const unifiedRoleAssignment = await roleAssignment.createRoleAssignmentWithAdministrativeUnitScope(roleDefinitionId, userId, administrativeUnitId);
|
|
51
51
|
await logger.log(unifiedRoleAssignment);
|
|
@@ -67,13 +67,9 @@ class EntraAppPermissionAddCommand extends GraphCommand {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
async getAppObject(options) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
apps = await odata.getAllItems(`${this.resource}/v1.0/applications(appId='${options.appId}')?$select=id,appId,requiredResourceAccess`);
|
|
76
|
-
}
|
|
70
|
+
const apps = options.appObjectId
|
|
71
|
+
? await odata.getAllItems(`${this.resource}/v1.0/applications?$filter=id eq '${options.appObjectId}'&$select=id,appId,requiredResourceAccess`)
|
|
72
|
+
: await odata.getAllItems(`${this.resource}/v1.0/applications?$filter=appId eq '${options.appId}'&$select=id,appId,requiredResourceAccess`);
|
|
77
73
|
if (apps.length === 0) {
|
|
78
74
|
throw `App with ${options.appObjectId ? 'object id' : 'client id'} ${options.appObjectId ? options.appObjectId : options.appId} not found in Entra ID (Azure AD)`;
|
|
79
75
|
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _EntraAppPermissionListCommand_instances, _EntraAppPermissionListCommand_initTelemetry, _EntraAppPermissionListCommand_initOptions, _EntraAppPermissionListCommand_initValidators, _EntraAppPermissionListCommand_initOptionSets;
|
|
7
|
+
import GraphCommand from "../../../base/GraphCommand.js";
|
|
8
|
+
import commands from "../../commands.js";
|
|
9
|
+
import request from "../../../../request.js";
|
|
10
|
+
import { validation } from "../../../../utils/validation.js";
|
|
11
|
+
import { formatting } from "../../../../utils/formatting.js";
|
|
12
|
+
class EntraAppPermissionListCommand extends GraphCommand {
|
|
13
|
+
get name() {
|
|
14
|
+
return commands.APP_PERMISSION_LIST;
|
|
15
|
+
}
|
|
16
|
+
get description() {
|
|
17
|
+
return 'Lists the application and delegated permissions for a specified Entra Application Registration';
|
|
18
|
+
}
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
_EntraAppPermissionListCommand_instances.add(this);
|
|
22
|
+
this.allowedTypes = ['delegated', 'application', 'all'];
|
|
23
|
+
__classPrivateFieldGet(this, _EntraAppPermissionListCommand_instances, "m", _EntraAppPermissionListCommand_initTelemetry).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _EntraAppPermissionListCommand_instances, "m", _EntraAppPermissionListCommand_initOptions).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _EntraAppPermissionListCommand_instances, "m", _EntraAppPermissionListCommand_initValidators).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _EntraAppPermissionListCommand_instances, "m", _EntraAppPermissionListCommand_initOptionSets).call(this);
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
29
|
+
try {
|
|
30
|
+
const appObjectId = await this.getAppObjectId(args.options);
|
|
31
|
+
const type = args.options.type ?? 'all';
|
|
32
|
+
const permissions = await this.getAppRegPermissions(appObjectId, type, logger);
|
|
33
|
+
await logger.log(permissions);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
this.handleRejectedODataJsonPromise(err);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async getAppObjectId(options) {
|
|
40
|
+
if (options.appObjectId) {
|
|
41
|
+
return options.appObjectId;
|
|
42
|
+
}
|
|
43
|
+
const requestOptions = {
|
|
44
|
+
url: `${this.resource}/v1.0/myorganization/applications?$filter=appId eq '${formatting.encodeQueryParameter(options.appId)}'&$select=id`,
|
|
45
|
+
headers: {
|
|
46
|
+
accept: 'application/json;odata.metadata=none'
|
|
47
|
+
},
|
|
48
|
+
responseType: 'json'
|
|
49
|
+
};
|
|
50
|
+
const res = await request.get(requestOptions);
|
|
51
|
+
if (res.value.length === 0) {
|
|
52
|
+
throw `No Azure AD application registration with ID ${options.appId} found`;
|
|
53
|
+
}
|
|
54
|
+
return res.value[0].id;
|
|
55
|
+
}
|
|
56
|
+
async getAppRegPermissions(appObjectId, permissionType, logger) {
|
|
57
|
+
const requestOptions = {
|
|
58
|
+
url: `${this.resource}/v1.0/myorganization/applications/${appObjectId}`,
|
|
59
|
+
headers: {
|
|
60
|
+
accept: 'application/json;odata.metadata=none'
|
|
61
|
+
},
|
|
62
|
+
responseType: 'json'
|
|
63
|
+
};
|
|
64
|
+
const application = await request.get(requestOptions);
|
|
65
|
+
const requiredResourceAccess = application.requiredResourceAccess;
|
|
66
|
+
if (requiredResourceAccess.length === 0) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
const servicePrincipalsToResolve = requiredResourceAccess.map(resourceAccess => {
|
|
70
|
+
return {
|
|
71
|
+
appId: resourceAccess.resourceAppId
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
const servicePrincipals = await Promise
|
|
75
|
+
.all(servicePrincipalsToResolve.map(servicePrincipalInfo => this.getServicePrincipal(servicePrincipalInfo, permissionType, logger)));
|
|
76
|
+
const apiPermissions = [];
|
|
77
|
+
requiredResourceAccess.forEach(requiredResourceAccess => {
|
|
78
|
+
const servicePrincipal = servicePrincipals
|
|
79
|
+
.find(servicePrincipal => servicePrincipal?.appId === requiredResourceAccess.resourceAppId);
|
|
80
|
+
const resourceName = servicePrincipal?.displayName ?? requiredResourceAccess.resourceAppId;
|
|
81
|
+
requiredResourceAccess.resourceAccess.forEach(permission => {
|
|
82
|
+
if (permissionType === 'application' && permission.type === 'Scope') {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (permissionType === 'delegated' && permission.type === 'Role') {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
apiPermissions.push({
|
|
89
|
+
resource: resourceName,
|
|
90
|
+
resourceId: requiredResourceAccess.resourceAppId,
|
|
91
|
+
permission: this.getPermissionName(permission.id, permission.type, servicePrincipal),
|
|
92
|
+
type: permission.type === 'Role' ? 'Application' : 'Delegated'
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
return apiPermissions;
|
|
97
|
+
}
|
|
98
|
+
getPermissionName(permissionId, permissionType, servicePrincipal) {
|
|
99
|
+
if (!servicePrincipal) {
|
|
100
|
+
return permissionId;
|
|
101
|
+
}
|
|
102
|
+
if (permissionType === 'Role') {
|
|
103
|
+
return servicePrincipal.appRoles
|
|
104
|
+
.find(appRole => appRole.id === permissionId)?.value ?? permissionId;
|
|
105
|
+
}
|
|
106
|
+
// permissionType === 'Scope'
|
|
107
|
+
return servicePrincipal.oauth2PermissionScopes
|
|
108
|
+
.find(permissionScope => permissionScope.id === permissionId)?.value ?? permissionId;
|
|
109
|
+
}
|
|
110
|
+
async getServicePrincipal(servicePrincipalInfo, permissionType, logger) {
|
|
111
|
+
if (this.verbose) {
|
|
112
|
+
await logger.logToStderr(`Retrieving service principal ${servicePrincipalInfo.appId}`);
|
|
113
|
+
}
|
|
114
|
+
const requestOptions = {
|
|
115
|
+
url: `${this.resource}/v1.0/servicePrincipals?$filter=appId eq '${servicePrincipalInfo.appId}'&$select=appId,id,displayName`,
|
|
116
|
+
headers: {
|
|
117
|
+
accept: 'application/json;odata.metadata=none'
|
|
118
|
+
},
|
|
119
|
+
responseType: 'json'
|
|
120
|
+
};
|
|
121
|
+
const response = await request.get(requestOptions);
|
|
122
|
+
if (servicePrincipalInfo.appId && response.value.length === 0) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const servicePrincipal = response.value[0];
|
|
126
|
+
if (this.verbose) {
|
|
127
|
+
await logger.logToStderr(`Retrieving permissions for service principal ${servicePrincipal.id}...`);
|
|
128
|
+
}
|
|
129
|
+
const oauth2PermissionScopesRequestOptions = {
|
|
130
|
+
url: `${this.resource}/v1.0/servicePrincipals/${servicePrincipal.id}/oauth2PermissionScopes`,
|
|
131
|
+
headers: {
|
|
132
|
+
accept: 'application/json;odata.metadata=none'
|
|
133
|
+
},
|
|
134
|
+
responseType: 'json'
|
|
135
|
+
};
|
|
136
|
+
const appRolesRequestOptions = {
|
|
137
|
+
url: `${this.resource}/v1.0/servicePrincipals/${servicePrincipal.id}/appRoles`,
|
|
138
|
+
headers: {
|
|
139
|
+
accept: 'application/json;odata.metadata=none'
|
|
140
|
+
},
|
|
141
|
+
responseType: 'json'
|
|
142
|
+
};
|
|
143
|
+
let permissions;
|
|
144
|
+
if (permissionType === 'all' || permissionType === 'delegated') {
|
|
145
|
+
permissions = await request.get(oauth2PermissionScopesRequestOptions);
|
|
146
|
+
servicePrincipal.oauth2PermissionScopes = permissions.value;
|
|
147
|
+
}
|
|
148
|
+
if (permissionType === 'all' || permissionType === 'application') {
|
|
149
|
+
permissions = await request.get(appRolesRequestOptions);
|
|
150
|
+
servicePrincipal.appRoles = permissions.value;
|
|
151
|
+
}
|
|
152
|
+
return servicePrincipal;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
_EntraAppPermissionListCommand_instances = new WeakSet(), _EntraAppPermissionListCommand_initTelemetry = function _EntraAppPermissionListCommand_initTelemetry() {
|
|
156
|
+
this.telemetry.push((args) => {
|
|
157
|
+
Object.assign(this.telemetryProperties, {
|
|
158
|
+
appId: typeof args.options.appId !== 'undefined',
|
|
159
|
+
appObjectId: typeof args.options.appObjectId !== 'undefined',
|
|
160
|
+
type: typeof args.options.type !== 'undefined'
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}, _EntraAppPermissionListCommand_initOptions = function _EntraAppPermissionListCommand_initOptions() {
|
|
164
|
+
this.options.unshift({ option: '-i, --appId [appId]' }, { option: '--appObjectId [appObjectId]' }, { option: '--type [type]', autocomplete: this.allowedTypes });
|
|
165
|
+
}, _EntraAppPermissionListCommand_initValidators = function _EntraAppPermissionListCommand_initValidators() {
|
|
166
|
+
this.validators.push(async (args) => {
|
|
167
|
+
if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
|
|
168
|
+
return `${args.options.appId} is not a valid GUID`;
|
|
169
|
+
}
|
|
170
|
+
if (args.options.appObjectId && !validation.isValidGuid(args.options.appObjectId)) {
|
|
171
|
+
return `${args.options.appObjectId} is not a valid GUID`;
|
|
172
|
+
}
|
|
173
|
+
if (args.options.type && this.allowedTypes.indexOf(args.options.type.toLowerCase()) === -1) {
|
|
174
|
+
return `${args.options.type} is not a valid type. Allowed types are ${this.allowedTypes.join(', ')}`;
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
});
|
|
178
|
+
}, _EntraAppPermissionListCommand_initOptionSets = function _EntraAppPermissionListCommand_initOptionSets() {
|
|
179
|
+
this.optionSets.push({ options: ['appId', 'appObjectId'] });
|
|
180
|
+
};
|
|
181
|
+
export default new EntraAppPermissionListCommand();
|
|
182
|
+
//# sourceMappingURL=app-permission-list.js.map
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _EntraGroupAddCommand_instances, _EntraGroupAddCommand_initOptions, _EntraGroupAddCommand_initValidators, _EntraGroupAddCommand_initTelemetry;
|
|
7
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
8
|
+
import commands from '../../commands.js';
|
|
9
|
+
import aadCommands from '../../aadCommands.js';
|
|
10
|
+
import { validation } from '../../../../utils/validation.js';
|
|
11
|
+
import request from '../../../../request.js';
|
|
12
|
+
import { entraUser } from '../../../../utils/entraUser.js';
|
|
13
|
+
class EntraGroupAddCommand extends GraphCommand {
|
|
14
|
+
get name() {
|
|
15
|
+
return commands.GROUP_ADD;
|
|
16
|
+
}
|
|
17
|
+
get description() {
|
|
18
|
+
return 'Creates a Microsoft Entra group';
|
|
19
|
+
}
|
|
20
|
+
alias() {
|
|
21
|
+
return [aadCommands.GROUP_ADD];
|
|
22
|
+
}
|
|
23
|
+
allowUnknownOptions() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
_EntraGroupAddCommand_instances.add(this);
|
|
29
|
+
__classPrivateFieldGet(this, _EntraGroupAddCommand_instances, "m", _EntraGroupAddCommand_initTelemetry).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _EntraGroupAddCommand_instances, "m", _EntraGroupAddCommand_initOptions).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _EntraGroupAddCommand_instances, "m", _EntraGroupAddCommand_initValidators).call(this);
|
|
32
|
+
}
|
|
33
|
+
async commandAction(logger, args) {
|
|
34
|
+
let group;
|
|
35
|
+
let ownerIds = [];
|
|
36
|
+
let memberIds = [];
|
|
37
|
+
try {
|
|
38
|
+
const manifest = this.createRequestBody(args.options);
|
|
39
|
+
const requestOptions = {
|
|
40
|
+
url: `${this.resource}/v1.0/groups`,
|
|
41
|
+
headers: {
|
|
42
|
+
accept: 'application/json;odata.metadata=none'
|
|
43
|
+
},
|
|
44
|
+
responseType: 'json',
|
|
45
|
+
data: manifest
|
|
46
|
+
};
|
|
47
|
+
ownerIds = await this.getUserIds(logger, args.options.ownerIds, args.options.ownerUserNames);
|
|
48
|
+
memberIds = await this.getUserIds(logger, args.options.memberIds, args.options.memberUserNames);
|
|
49
|
+
group = await request.post(requestOptions);
|
|
50
|
+
if (ownerIds.length !== 0) {
|
|
51
|
+
await this.addUsers(group.id, 'owners', ownerIds);
|
|
52
|
+
}
|
|
53
|
+
if (memberIds.length !== 0) {
|
|
54
|
+
await this.addUsers(group.id, 'members', memberIds);
|
|
55
|
+
}
|
|
56
|
+
await logger.log(group);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
this.handleRejectedODataJsonPromise(err);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
;
|
|
63
|
+
createRequestBody(options) {
|
|
64
|
+
const requestBody = {
|
|
65
|
+
displayName: options.displayName,
|
|
66
|
+
description: options.description,
|
|
67
|
+
mailNickName: options.mailNickname ?? this.generateMailNickname(),
|
|
68
|
+
visibility: options.visibility ?? 'Public',
|
|
69
|
+
groupTypes: options.type === 'microsoft365' ? ['Unified'] : [],
|
|
70
|
+
mailEnabled: options.type === 'security' ? false : true,
|
|
71
|
+
securityEnabled: true
|
|
72
|
+
};
|
|
73
|
+
this.addUnknownOptionsToPayload(requestBody, options);
|
|
74
|
+
return requestBody;
|
|
75
|
+
}
|
|
76
|
+
generateMailNickname() {
|
|
77
|
+
return `Group${Math.floor(Math.random() * 1000000)}`;
|
|
78
|
+
}
|
|
79
|
+
async getUserIds(logger, userIds, userNames) {
|
|
80
|
+
if (userIds) {
|
|
81
|
+
return userIds.split(',').map(o => o.trim());
|
|
82
|
+
}
|
|
83
|
+
if (!userNames) {
|
|
84
|
+
if (this.verbose) {
|
|
85
|
+
await logger.logToStderr('No users to validate, skipping.');
|
|
86
|
+
}
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
if (this.verbose) {
|
|
90
|
+
await logger.logToStderr('Retrieving user information.');
|
|
91
|
+
}
|
|
92
|
+
const userArr = userNames.split(',').map(o => o.trim());
|
|
93
|
+
if (this.verbose) {
|
|
94
|
+
await logger.logToStderr('Retrieving ID(s) of user(s)...');
|
|
95
|
+
}
|
|
96
|
+
return entraUser.getUserIdsByUpns(userArr);
|
|
97
|
+
}
|
|
98
|
+
async addUsers(groupId, role, userIds) {
|
|
99
|
+
for (let i = 0; i < userIds.length; i += 400) {
|
|
100
|
+
const userIdsBatch = userIds.slice(i, i + 400);
|
|
101
|
+
const requestOptions = {
|
|
102
|
+
url: `${this.resource}/v1.0/$batch`,
|
|
103
|
+
headers: {
|
|
104
|
+
'content-type': 'application/json;odata.metadata=none'
|
|
105
|
+
},
|
|
106
|
+
responseType: 'json',
|
|
107
|
+
data: {
|
|
108
|
+
requests: []
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
// only 20 requests per one batch are allowed
|
|
112
|
+
for (let j = 0; j < userIdsBatch.length; j += 20) {
|
|
113
|
+
// only 20 users can be added in one request
|
|
114
|
+
const userIdsChunk = userIdsBatch.slice(j, j + 20);
|
|
115
|
+
requestOptions.data.requests.push({
|
|
116
|
+
id: j + 1,
|
|
117
|
+
method: 'PATCH',
|
|
118
|
+
url: `/groups/${groupId}`,
|
|
119
|
+
headers: {
|
|
120
|
+
'content-type': 'application/json;odata.metadata=none'
|
|
121
|
+
},
|
|
122
|
+
body: {
|
|
123
|
+
[`${role}@odata.bind`]: userIdsChunk.map(u => `${this.resource}/v1.0/directoryObjects/${u}`)
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const res = await request.post(requestOptions);
|
|
128
|
+
for (const response of res.responses) {
|
|
129
|
+
if (response.status !== 204) {
|
|
130
|
+
throw response.body;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
_EntraGroupAddCommand_instances = new WeakSet(), _EntraGroupAddCommand_initOptions = function _EntraGroupAddCommand_initOptions() {
|
|
137
|
+
this.options.unshift({
|
|
138
|
+
option: '-n, --displayName <displayName>'
|
|
139
|
+
}, {
|
|
140
|
+
option: '-d, --description [description]'
|
|
141
|
+
}, {
|
|
142
|
+
option: '-t, --type <type>',
|
|
143
|
+
autocomplete: ['microsoft365', 'security']
|
|
144
|
+
}, {
|
|
145
|
+
option: '-m, --mailNickname [mailNickname]'
|
|
146
|
+
}, {
|
|
147
|
+
option: '--ownerIds [ownerIds]'
|
|
148
|
+
}, {
|
|
149
|
+
option: '--ownerUserNames [ownerUserNames]'
|
|
150
|
+
}, {
|
|
151
|
+
option: '--memberIds [memberIds]'
|
|
152
|
+
}, {
|
|
153
|
+
option: '--memberUserNames [memberUserNames]'
|
|
154
|
+
}, {
|
|
155
|
+
option: '--visibility [visibility]',
|
|
156
|
+
autocomplete: ['Public', 'Private', 'HiddenMembership']
|
|
157
|
+
});
|
|
158
|
+
}, _EntraGroupAddCommand_initValidators = function _EntraGroupAddCommand_initValidators() {
|
|
159
|
+
this.validators.push(async (args) => {
|
|
160
|
+
if (args.options.displayName.length > 256) {
|
|
161
|
+
return `The maximum amount of characters for 'displayName' is 256.`;
|
|
162
|
+
}
|
|
163
|
+
if (args.options.mailNickname) {
|
|
164
|
+
if (!validation.isValidMailNickname(args.options.mailNickname)) {
|
|
165
|
+
return `Value for option 'mailNickname' must contain only characters in the ASCII character set 0-127 except the following: @ () \ [] " ; : <> , SPACE.`;
|
|
166
|
+
}
|
|
167
|
+
if (args.options.mailNickname.length > 64) {
|
|
168
|
+
return `The maximum amount of characters for 'mailNickname' is 64.`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (args.options.ownerIds) {
|
|
172
|
+
const ids = args.options.ownerIds.split(',').map(i => i.trim());
|
|
173
|
+
if (!validation.isValidGuidArray(ids)) {
|
|
174
|
+
const invalidGuid = ids.find(id => !validation.isValidGuid(id));
|
|
175
|
+
return `'${invalidGuid}' is not a valid GUID for option 'ownerIds'.`;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (args.options.ownerUserNames) {
|
|
179
|
+
const isValidUserPrincipalNameArray = validation.isValidUserPrincipalNameArray(args.options.ownerUserNames.split(',').map(u => u.trim()));
|
|
180
|
+
if (isValidUserPrincipalNameArray !== true) {
|
|
181
|
+
return `User principal name '${isValidUserPrincipalNameArray}' is invalid for option 'ownerUserNames'.`;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (args.options.memberIds) {
|
|
185
|
+
const ids = args.options.memberIds.split(',').map(i => i.trim());
|
|
186
|
+
if (!validation.isValidGuidArray(ids)) {
|
|
187
|
+
const invalidGuid = ids.find(id => !validation.isValidGuid(id));
|
|
188
|
+
return `'${invalidGuid}' is not a valid GUID for option 'memberIds'.`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (args.options.memberUserNames) {
|
|
192
|
+
const isValidUserPrincipalNameArray = validation.isValidUserPrincipalNameArray(args.options.memberUserNames.split(',').map(u => u.trim()));
|
|
193
|
+
if (isValidUserPrincipalNameArray !== true) {
|
|
194
|
+
return `User principal name '${isValidUserPrincipalNameArray}' is invalid for option 'memberUserNames'.`;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (['microsoft365', 'security'].indexOf(args.options.type) === -1) {
|
|
198
|
+
return `Option 'type' must be one of the following values: microsoft365, security.`;
|
|
199
|
+
}
|
|
200
|
+
if (args.options.type === 'microsoft365' && !args.options.visibility) {
|
|
201
|
+
return `Option 'visibility' must be specified if the option 'type' is set to microsoft365`;
|
|
202
|
+
}
|
|
203
|
+
if (args.options.visibility && ['Public', 'Private', 'HiddenMembership'].indexOf(args.options.visibility) === -1) {
|
|
204
|
+
return `Option 'visibility' must be one of the following values: Public, Private, HiddenMembership.`;
|
|
205
|
+
}
|
|
206
|
+
return true;
|
|
207
|
+
});
|
|
208
|
+
}, _EntraGroupAddCommand_initTelemetry = function _EntraGroupAddCommand_initTelemetry() {
|
|
209
|
+
this.telemetry.push((args) => {
|
|
210
|
+
Object.assign(this.telemetryProperties, {
|
|
211
|
+
displayName: typeof args.options.displayName !== 'undefined',
|
|
212
|
+
description: typeof args.options.description !== 'undefined',
|
|
213
|
+
type: typeof args.options.type !== 'undefined',
|
|
214
|
+
mailNickname: typeof args.options.mailNickname !== 'undefined',
|
|
215
|
+
ownerIds: typeof args.options.ownerIds !== 'undefined',
|
|
216
|
+
ownerUserNames: typeof args.options.ownerUserNames !== 'undefined',
|
|
217
|
+
memberIds: typeof args.options.memberIds !== 'undefined',
|
|
218
|
+
memberUserNames: typeof args.options.memberUserNames !== 'undefined',
|
|
219
|
+
visibility: typeof args.options.visibility !== 'undefined'
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
export default new EntraGroupAddCommand();
|
|
224
|
+
//# sourceMappingURL=group-add.js.map
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _EntraGroupGetCommand_instances, _EntraGroupGetCommand_initOptions, _EntraGroupGetCommand_initValidators, _EntraGroupGetCommand_initOptionSets, _EntraGroupGetCommand_initTelemetry;
|
|
7
|
-
import {
|
|
7
|
+
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
8
8
|
import { validation } from '../../../../utils/validation.js';
|
|
9
9
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
10
|
import commands from '../../commands.js';
|
|
@@ -31,10 +31,10 @@ class EntraGroupGetCommand extends GraphCommand {
|
|
|
31
31
|
let group;
|
|
32
32
|
try {
|
|
33
33
|
if (args.options.id) {
|
|
34
|
-
group = await
|
|
34
|
+
group = await entraGroup.getGroupById(args.options.id);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
group = await
|
|
37
|
+
group = await entraGroup.getGroupByDisplayName(args.options.displayName);
|
|
38
38
|
}
|
|
39
39
|
await logger.log(group);
|
|
40
40
|
}
|
|
@@ -8,7 +8,7 @@ import { cli } from '../../../../cli/cli.js';
|
|
|
8
8
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
9
9
|
import commands from '../../commands.js';
|
|
10
10
|
import request from '../../../../request.js';
|
|
11
|
-
import {
|
|
11
|
+
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
12
12
|
import { validation } from '../../../../utils/validation.js';
|
|
13
13
|
import aadCommands from '../../aadCommands.js';
|
|
14
14
|
class EntraGroupRemoveCommand extends GraphCommand {
|
|
@@ -38,7 +38,7 @@ class EntraGroupRemoveCommand extends GraphCommand {
|
|
|
38
38
|
try {
|
|
39
39
|
let groupId = args.options.id;
|
|
40
40
|
if (args.options.displayName) {
|
|
41
|
-
groupId = await
|
|
41
|
+
groupId = await entraGroup.getGroupIdByDisplayName(args.options.displayName);
|
|
42
42
|
}
|
|
43
43
|
const requestOptions = {
|
|
44
44
|
url: `${this.resource}/v1.0/groups/${groupId}`,
|