@pnp/cli-microsoft365 7.1.0 → 7.2.0-beta.194fd07

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/.eslintrc.cjs CHANGED
@@ -5,6 +5,7 @@ const dictionary = [
5
5
  'activation',
6
6
  'activations',
7
7
  'adaptive',
8
+ 'administrative',
8
9
  'ai',
9
10
  'app',
10
11
  'application',
@@ -90,6 +91,7 @@ const dictionary = [
90
91
  'threat',
91
92
  'token',
92
93
  'type',
94
+ 'unit',
93
95
  'user',
94
96
  'web',
95
97
  'webhook'
package/dist/cli/Cli.js CHANGED
@@ -707,9 +707,10 @@ export class Cli {
707
707
  const maxLength = Math.max(...namesOfCommandsToPrint.map(s => s.length)) + 10;
708
708
  Cli.log(`Commands:`);
709
709
  Cli.log();
710
- for (const commandName in commandsToPrint) {
710
+ const sortedCommandNamesToPrint = Object.getOwnPropertyNames(commandsToPrint).sort();
711
+ sortedCommandNamesToPrint.forEach(commandName => {
711
712
  Cli.log(` ${`${commandName} [options]`.padEnd(maxLength, ' ')} ${commandsToPrint[commandName].command.description}`);
712
- }
713
+ });
713
714
  }
714
715
  const namesOfCommandGroupsToPrint = Object.keys(commandGroupsToPrint);
715
716
  if (namesOfCommandGroupsToPrint.length > 0) {
@@ -0,0 +1,61 @@
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 _AadAdministrativeUnitAddCommand_instances, _AadAdministrativeUnitAddCommand_initTelemetry, _AadAdministrativeUnitAddCommand_initOptions;
7
+ import request from "../../../../request.js";
8
+ import GraphCommand from "../../../base/GraphCommand.js";
9
+ import commands from "../../commands.js";
10
+ class AadAdministrativeUnitAddCommand extends GraphCommand {
11
+ get name() {
12
+ return commands.ADMINISTRATIVEUNIT_ADD;
13
+ }
14
+ get description() {
15
+ return 'Creates an administrative unit';
16
+ }
17
+ constructor() {
18
+ super();
19
+ _AadAdministrativeUnitAddCommand_instances.add(this);
20
+ __classPrivateFieldGet(this, _AadAdministrativeUnitAddCommand_instances, "m", _AadAdministrativeUnitAddCommand_initTelemetry).call(this);
21
+ __classPrivateFieldGet(this, _AadAdministrativeUnitAddCommand_instances, "m", _AadAdministrativeUnitAddCommand_initOptions).call(this);
22
+ }
23
+ async commandAction(logger, args) {
24
+ const requestOptions = {
25
+ url: `${this.resource}/v1.0/directory/administrativeUnits`,
26
+ headers: {
27
+ 'accept': 'application/json;odata.metadata=none'
28
+ },
29
+ responseType: 'json',
30
+ data: {
31
+ description: args.options.description,
32
+ displayName: args.options.displayName,
33
+ visibility: args.options.hiddenMembership ? 'HiddenMembership' : null
34
+ }
35
+ };
36
+ try {
37
+ const administrativeUnit = await request.post(requestOptions);
38
+ await logger.log(administrativeUnit);
39
+ }
40
+ catch (err) {
41
+ this.handleRejectedODataJsonPromise(err);
42
+ }
43
+ }
44
+ }
45
+ _AadAdministrativeUnitAddCommand_instances = new WeakSet(), _AadAdministrativeUnitAddCommand_initTelemetry = function _AadAdministrativeUnitAddCommand_initTelemetry() {
46
+ this.telemetry.push((args) => {
47
+ Object.assign(this.telemetryProperties, {
48
+ hiddenMembership: args.options.hiddenMembership
49
+ });
50
+ });
51
+ }, _AadAdministrativeUnitAddCommand_initOptions = function _AadAdministrativeUnitAddCommand_initOptions() {
52
+ this.options.unshift({
53
+ option: '-n, --displayName <displayName>'
54
+ }, {
55
+ option: '-d, --description [description]'
56
+ }, {
57
+ option: '--hiddenMembership [hiddenMembership]'
58
+ });
59
+ };
60
+ export default new AadAdministrativeUnitAddCommand();
61
+ //# sourceMappingURL=administrativeunit-add.js.map
@@ -0,0 +1,93 @@
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 _AadAdministrativeUnitGetCommand_instances, _AadAdministrativeUnitGetCommand_initTelemetry, _AadAdministrativeUnitGetCommand_initOptions, _AadAdministrativeUnitGetCommand_initValidators, _AadAdministrativeUnitGetCommand_initOptionSets, _AadAdministrativeUnitGetCommand_initTypes;
7
+ import { validation } from "../../../../utils/validation.js";
8
+ import request from "../../../../request.js";
9
+ import GraphCommand from "../../../base/GraphCommand.js";
10
+ import commands from "../../commands.js";
11
+ import { odata } from "../../../../utils/odata.js";
12
+ import { formatting } from "../../../../utils/formatting.js";
13
+ import { Cli } from "../../../../cli/Cli.js";
14
+ class AadAdministrativeUnitGetCommand extends GraphCommand {
15
+ get name() {
16
+ return commands.ADMINISTRATIVEUNIT_GET;
17
+ }
18
+ get description() {
19
+ return 'Gets information about a specific administrative unit';
20
+ }
21
+ constructor() {
22
+ super();
23
+ _AadAdministrativeUnitGetCommand_instances.add(this);
24
+ __classPrivateFieldGet(this, _AadAdministrativeUnitGetCommand_instances, "m", _AadAdministrativeUnitGetCommand_initTelemetry).call(this);
25
+ __classPrivateFieldGet(this, _AadAdministrativeUnitGetCommand_instances, "m", _AadAdministrativeUnitGetCommand_initOptions).call(this);
26
+ __classPrivateFieldGet(this, _AadAdministrativeUnitGetCommand_instances, "m", _AadAdministrativeUnitGetCommand_initValidators).call(this);
27
+ __classPrivateFieldGet(this, _AadAdministrativeUnitGetCommand_instances, "m", _AadAdministrativeUnitGetCommand_initOptionSets).call(this);
28
+ __classPrivateFieldGet(this, _AadAdministrativeUnitGetCommand_instances, "m", _AadAdministrativeUnitGetCommand_initTypes).call(this);
29
+ }
30
+ async commandAction(logger, args) {
31
+ let administrativeUnit;
32
+ try {
33
+ if (args.options.id) {
34
+ administrativeUnit = await this.getAdministrativeUnitById(args.options.id);
35
+ }
36
+ else {
37
+ administrativeUnit = await this.getAdministrativeUnitByDisplayName(args.options.displayName);
38
+ }
39
+ await logger.log(administrativeUnit);
40
+ }
41
+ catch (err) {
42
+ this.handleRejectedODataJsonPromise(err);
43
+ }
44
+ }
45
+ async getAdministrativeUnitById(id) {
46
+ const requestOptions = {
47
+ url: `${this.resource}/v1.0/directory/administrativeUnits/${id}`,
48
+ headers: {
49
+ accept: 'application/json;odata.metadata=none'
50
+ },
51
+ responseType: 'json'
52
+ };
53
+ return await request.get(requestOptions);
54
+ }
55
+ async getAdministrativeUnitByDisplayName(displayName) {
56
+ const administrativeUnits = await odata.getAllItems(`${this.resource}/v1.0/directory/administrativeUnits?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'`);
57
+ if (administrativeUnits.length === 0) {
58
+ throw `The specified administrative unit '${displayName}' does not exist.`;
59
+ }
60
+ if (administrativeUnits.length > 1) {
61
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', administrativeUnits);
62
+ return await Cli.handleMultipleResultsFound(`Multiple administrative units with name '${displayName}' found.`, resultAsKeyValuePair);
63
+ }
64
+ return administrativeUnits[0];
65
+ }
66
+ }
67
+ _AadAdministrativeUnitGetCommand_instances = new WeakSet(), _AadAdministrativeUnitGetCommand_initTelemetry = function _AadAdministrativeUnitGetCommand_initTelemetry() {
68
+ this.telemetry.push((args) => {
69
+ Object.assign(this.telemetryProperties, {
70
+ id: typeof args.options.id !== 'undefined',
71
+ displayName: typeof args.options.displayName !== 'undefined'
72
+ });
73
+ });
74
+ }, _AadAdministrativeUnitGetCommand_initOptions = function _AadAdministrativeUnitGetCommand_initOptions() {
75
+ this.options.unshift({
76
+ option: '-i, --id [id]'
77
+ }, {
78
+ option: '-n, --displayName [displayName]'
79
+ });
80
+ }, _AadAdministrativeUnitGetCommand_initValidators = function _AadAdministrativeUnitGetCommand_initValidators() {
81
+ this.validators.push(async (args) => {
82
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
83
+ return `${args.options.id} is not a valid GUID`;
84
+ }
85
+ return true;
86
+ });
87
+ }, _AadAdministrativeUnitGetCommand_initOptionSets = function _AadAdministrativeUnitGetCommand_initOptionSets() {
88
+ this.optionSets.push({ options: ['id', 'displayName'] });
89
+ }, _AadAdministrativeUnitGetCommand_initTypes = function _AadAdministrativeUnitGetCommand_initTypes() {
90
+ this.types.string.push('displayName');
91
+ };
92
+ export default new AadAdministrativeUnitGetCommand();
93
+ //# sourceMappingURL=administrativeunit-get.js.map
@@ -0,0 +1,25 @@
1
+ import { odata } from '../../../../utils/odata.js';
2
+ import GraphCommand from '../../../base/GraphCommand.js';
3
+ import commands from '../../commands.js';
4
+ class AadAdministrativeUnitListCommand extends GraphCommand {
5
+ get name() {
6
+ return commands.ADMINISTRATIVEUNIT_LIST;
7
+ }
8
+ get description() {
9
+ return 'Retrieves a list of administrative units';
10
+ }
11
+ defaultProperties() {
12
+ return ['id', 'displayName', 'visibility'];
13
+ }
14
+ async commandAction(logger) {
15
+ try {
16
+ const results = await odata.getAllItems(`${this.resource}/v1.0/directory/administrativeUnits`);
17
+ await logger.log(results);
18
+ }
19
+ catch (err) {
20
+ this.handleRejectedODataJsonPromise(err);
21
+ }
22
+ }
23
+ }
24
+ export default new AadAdministrativeUnitListCommand();
25
+ //# sourceMappingURL=administrativeunit-list.js.map
@@ -0,0 +1,108 @@
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 _AadAdministrativeUnitRemoveCommand_instances, _AadAdministrativeUnitRemoveCommand_initTelemetry, _AadAdministrativeUnitRemoveCommand_initOptions, _AadAdministrativeUnitRemoveCommand_initOptionSets, _AadAdministrativeUnitRemoveCommand_initValidators, _AadAdministrativeUnitRemoveCommand_initTypes;
7
+ import { validation } from "../../../../utils/validation.js";
8
+ import request from "../../../../request.js";
9
+ import GraphCommand from "../../../base/GraphCommand.js";
10
+ import commands from "../../commands.js";
11
+ import { odata } from "../../../../utils/odata.js";
12
+ import { formatting } from "../../../../utils/formatting.js";
13
+ import { Cli } from "../../../../cli/Cli.js";
14
+ class AadAdministrativeUnitRemoveCommand extends GraphCommand {
15
+ get name() {
16
+ return commands.ADMINISTRATIVEUNIT_REMOVE;
17
+ }
18
+ get description() {
19
+ return 'Removes an administrative unit';
20
+ }
21
+ constructor() {
22
+ super();
23
+ _AadAdministrativeUnitRemoveCommand_instances.add(this);
24
+ __classPrivateFieldGet(this, _AadAdministrativeUnitRemoveCommand_instances, "m", _AadAdministrativeUnitRemoveCommand_initOptions).call(this);
25
+ __classPrivateFieldGet(this, _AadAdministrativeUnitRemoveCommand_instances, "m", _AadAdministrativeUnitRemoveCommand_initValidators).call(this);
26
+ __classPrivateFieldGet(this, _AadAdministrativeUnitRemoveCommand_instances, "m", _AadAdministrativeUnitRemoveCommand_initOptionSets).call(this);
27
+ __classPrivateFieldGet(this, _AadAdministrativeUnitRemoveCommand_instances, "m", _AadAdministrativeUnitRemoveCommand_initTelemetry).call(this);
28
+ __classPrivateFieldGet(this, _AadAdministrativeUnitRemoveCommand_instances, "m", _AadAdministrativeUnitRemoveCommand_initTypes).call(this);
29
+ }
30
+ async commandAction(logger, args) {
31
+ const removeAdministrativeUnit = async () => {
32
+ try {
33
+ let administrativeUnitId = args.options.id;
34
+ if (args.options.displayName) {
35
+ administrativeUnitId = await this.getAdministrativeUnitIdByDisplayName(args.options.displayName);
36
+ }
37
+ const requestOptions = {
38
+ url: `${this.resource}/v1.0/directory/administrativeUnits/${administrativeUnitId}`,
39
+ headers: {
40
+ accept: 'application/json;odata.metadata=none'
41
+ }
42
+ };
43
+ await request.delete(requestOptions);
44
+ }
45
+ catch (err) {
46
+ this.handleRejectedODataJsonPromise(err);
47
+ }
48
+ };
49
+ if (args.options.force) {
50
+ await removeAdministrativeUnit();
51
+ }
52
+ else {
53
+ const result = await Cli.prompt({
54
+ type: 'confirm',
55
+ name: 'continue',
56
+ default: false,
57
+ message: `Are you sure you want to remove administrative unit '${args.options.id || args.options.displayName}'?`
58
+ });
59
+ if (result.continue) {
60
+ await removeAdministrativeUnit();
61
+ }
62
+ }
63
+ }
64
+ async getAdministrativeUnitIdByDisplayName(displayName) {
65
+ const administrativeUnits = await odata.getAllItems(`${this.resource}/v1.0/directory/administrativeUnits?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'&$select=id`);
66
+ if (administrativeUnits.length === 0) {
67
+ throw `The specified administrative unit '${displayName}' does not exist.`;
68
+ }
69
+ if (administrativeUnits.length > 1) {
70
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', administrativeUnits);
71
+ const selectedAdministrativeUnit = await Cli.handleMultipleResultsFound(`Multiple administrative units with name '${displayName}' found.`, resultAsKeyValuePair);
72
+ return selectedAdministrativeUnit.id;
73
+ }
74
+ return administrativeUnits[0].id;
75
+ }
76
+ }
77
+ _AadAdministrativeUnitRemoveCommand_instances = new WeakSet(), _AadAdministrativeUnitRemoveCommand_initTelemetry = function _AadAdministrativeUnitRemoveCommand_initTelemetry() {
78
+ this.telemetry.push((args) => {
79
+ Object.assign(this.telemetryProperties, {
80
+ id: args.options.id !== 'undefined',
81
+ displayName: args.options.displayName !== 'undefined',
82
+ force: !!args.options.force
83
+ });
84
+ });
85
+ }, _AadAdministrativeUnitRemoveCommand_initOptions = function _AadAdministrativeUnitRemoveCommand_initOptions() {
86
+ this.options.unshift({
87
+ option: '-i, --id [id]'
88
+ }, {
89
+ option: '-n, --displayName [displayName]'
90
+ }, {
91
+ option: '-f, --force'
92
+ });
93
+ }, _AadAdministrativeUnitRemoveCommand_initOptionSets = function _AadAdministrativeUnitRemoveCommand_initOptionSets() {
94
+ this.optionSets.push({
95
+ options: ['id', 'displayName']
96
+ });
97
+ }, _AadAdministrativeUnitRemoveCommand_initValidators = function _AadAdministrativeUnitRemoveCommand_initValidators() {
98
+ this.validators.push(async (args) => {
99
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
100
+ return `${args.options.id} is not a valid GUID for option id.`;
101
+ }
102
+ return true;
103
+ });
104
+ }, _AadAdministrativeUnitRemoveCommand_initTypes = function _AadAdministrativeUnitRemoveCommand_initTypes() {
105
+ this.types.string.push('id', 'displayName');
106
+ };
107
+ export default new AadAdministrativeUnitRemoveCommand();
108
+ //# sourceMappingURL=administrativeunit-remove.js.map
@@ -1,5 +1,9 @@
1
1
  const prefix = 'aad';
2
2
  export default {
3
+ ADMINISTRATIVEUNIT_ADD: `${prefix} administrativeunit add`,
4
+ ADMINISTRATIVEUNIT_GET: `${prefix} administrativeunit get`,
5
+ ADMINISTRATIVEUNIT_LIST: `${prefix} administrativeunit list`,
6
+ ADMINISTRATIVEUNIT_REMOVE: `${prefix} administrativeunit remove`,
3
7
  APP_ADD: `${prefix} app add`,
4
8
  APP_GET: `${prefix} app get`,
5
9
  APP_LIST: `${prefix} app list`,
@@ -8,6 +8,7 @@ import fs from 'fs';
8
8
  import { Cli } from '../../cli/Cli.js';
9
9
  import Command, { CommandError } from '../../Command.js';
10
10
  import { validation } from '../../utils/validation.js';
11
+ import { formatting } from '../../utils/formatting.js';
11
12
  class AppCommand extends Command {
12
13
  get resource() {
13
14
  return 'https://graph.microsoft.com';
@@ -52,18 +53,8 @@ class AppCommand extends Command {
52
53
  return super.action(logger, args);
53
54
  }
54
55
  if (this.m365rcJson.apps.length > 1) {
55
- const result = await Cli.prompt({
56
- message: `Multiple Azure AD apps found in ${m365rcJsonPath}. Which app would you like to use?`,
57
- type: 'list',
58
- choices: this.m365rcJson.apps.map((app, i) => {
59
- return {
60
- name: `${app.name} (${app.appId})`,
61
- value: i
62
- };
63
- }),
64
- default: 0,
65
- name: 'appIdIndex'
66
- });
56
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('appIdIndex', this.m365rcJson.apps);
57
+ const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD apps found in ${m365rcJsonPath}.`, resultAsKeyValuePair);
67
58
  this.appId = this.m365rcJson.apps[result.appIdIndex].appId;
68
59
  await super.action(logger, args);
69
60
  }
@@ -11,6 +11,7 @@ import { formatting } from '../../../../utils/formatting.js';
11
11
  import { validation } from '../../../../utils/validation.js';
12
12
  import GraphCommand from '../../../base/GraphCommand.js';
13
13
  import commands from '../../commands.js';
14
+ import { Cli } from '../../../../cli/Cli.js';
14
15
  class TeamsAppUpdateCommand extends GraphCommand {
15
16
  get name() {
16
17
  return commands.APP_UPDATE;
@@ -29,7 +30,7 @@ class TeamsAppUpdateCommand extends GraphCommand {
29
30
  async commandAction(logger, args) {
30
31
  const { filePath } = args.options;
31
32
  try {
32
- const appId = await this.getAppId(args);
33
+ const appId = await this.getAppId(args.options);
33
34
  const fullPath = path.resolve(filePath);
34
35
  if (this.verbose) {
35
36
  await logger.logToStderr(`Updating app with id '${appId}' and file '${fullPath}' in the app catalog...`);
@@ -47,12 +48,12 @@ class TeamsAppUpdateCommand extends GraphCommand {
47
48
  this.handleRejectedODataJsonPromise(err);
48
49
  }
49
50
  }
50
- async getAppId(args) {
51
- if (args.options.id) {
52
- return args.options.id;
51
+ async getAppId(options) {
52
+ if (options.id) {
53
+ return options.id;
53
54
  }
54
55
  const requestOptions = {
55
- url: `${this.resource}/v1.0/appCatalogs/teamsApps?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.name)}'`,
56
+ url: `${this.resource}/v1.0/appCatalogs/teamsApps?$filter=displayName eq '${formatting.encodeQueryParameter(options.name)}'`,
56
57
  headers: {
57
58
  accept: 'application/json;odata.metadata=none'
58
59
  },
@@ -64,7 +65,9 @@ class TeamsAppUpdateCommand extends GraphCommand {
64
65
  throw `The specified Teams app does not exist`;
65
66
  }
66
67
  if (response.value.length > 1) {
67
- throw `Multiple Teams apps with name ${args.options.name} found. Please choose one of these ids: ${response.value.map(x => x.id).join(', ')}`;
68
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
69
+ const result = await Cli.handleMultipleResultsFound(`Multiple Teams apps with name ${options.name} found.`, resultAsKeyValuePair);
70
+ return result.id;
68
71
  }
69
72
  return app.id;
70
73
  }
@@ -54,7 +54,9 @@ export const aadGroup = {
54
54
  throw Error(`The specified group '${displayName}' does not exist.`);
55
55
  }
56
56
  if (groups.length > 1) {
57
- throw Error(`Multiple groups with name '${displayName}' found: ${groups.map(x => x.id).join(',')}.`);
57
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', groups);
58
+ const result = await Cli.handleMultipleResultsFound(`Multiple groups with name '${displayName}' found.`, resultAsKeyValuePair);
59
+ return result.id;
58
60
  }
59
61
  return groups[0].id;
60
62
  },
@@ -0,0 +1,115 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # aad administrativeunit add
6
+
7
+ Creates a new administrative unit
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 aad administrativeunit add [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-n, --displayname <displayName>`
19
+ : Display name for the administrative unit.
20
+
21
+ `-d, --description [description]`
22
+ : Description for the administrative unit.
23
+
24
+ `--hiddenMembership [hiddenMembership]`
25
+ : Indicates whether the administrative unit and its members are hidden.
26
+ ```
27
+
28
+ <Global />
29
+
30
+ ## Remarks
31
+
32
+ :::info
33
+
34
+ To use this command you must be either **Global Administrator** or **Privileged Role Administrator**.
35
+
36
+ :::
37
+
38
+ ## Examples
39
+
40
+ Create an administrative unit with a specific display name
41
+
42
+ ```sh
43
+ m365 aad administrativeunit add --displayName 'Marketing Division'
44
+ ```
45
+
46
+ Create an administrative unit with a specific display name and description
47
+
48
+ ```sh
49
+ m365 aad administrativeunit add --displayName 'Marketing Division' --description 'Marketing department administration'
50
+ ```
51
+
52
+ Create a hidden administrative unit with a specific display name
53
+
54
+ ```sh
55
+ m365 aad administrativeunit add --displayName 'Marketing Division' --hiddenMembership
56
+ ```
57
+
58
+ ## Response
59
+
60
+ <Tabs>
61
+ <TabItem value="JSON">
62
+
63
+ ```json
64
+ {
65
+ "id": "00b45a1b-7632-4e94-a3bd-f06aec976d31",
66
+ "deletedDateTime": null,
67
+ "displayName": "Marketing Division",
68
+ "description": "Marketing department administration",
69
+ "membershipRule": null,
70
+ "membershipType": null,
71
+ "membershipRuleProcessingState": null,
72
+ "visibility": null
73
+ }
74
+ ```
75
+
76
+ </TabItem>
77
+ <TabItem value="Text">
78
+
79
+ ```text
80
+ deletedDateTime : null
81
+ description : Marketing department administration
82
+ displayName : Marketing Division
83
+ id : 00b45a1b-7632-4e94-a3bd-f06aec976d31
84
+ membershipRule : null
85
+ membershipRuleProcessingState: null
86
+ membershipType : null
87
+ visibility : null
88
+ ```
89
+
90
+ </TabItem>
91
+ <TabItem value="CSV">
92
+
93
+ ```csv
94
+ id,displayName,description,visibility
95
+ 00b45a1b-7632-4e94-a3bd-f06aec976d31,Marketing Division,Marketing department administration,HiddenMembership
96
+ ```
97
+
98
+ </TabItem>
99
+ <TabItem value="Markdown">
100
+
101
+ ```md
102
+ Date: 10/23/2023
103
+
104
+ ## Marketing Division (00b45a1b-7632-4e94-a3bd-f06aec976d31)
105
+
106
+ Property | Value
107
+ ---------|-------
108
+ id | 00b45a1b-7632-4e94-a3bd-f06aec976d31
109
+ displayName | Marketing Division
110
+ description | Marketing department administration
111
+ visibility | HiddenMembership
112
+ ```
113
+
114
+ </TabItem>
115
+ </Tabs>
@@ -0,0 +1,98 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # aad administrativeunit get
6
+
7
+ Gets information about a specific administrative unit
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 aad administrativeunit get [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-i, --id [id]`
19
+ : The id of the administrative unit. Specify either `id` or `displayName` but not both.
20
+
21
+ `-n, --displayName [displayName]`
22
+ : The display name of the administrative unit. Specify either `id` or `displayName` but not both.
23
+ ```
24
+
25
+ <Global />
26
+
27
+ ## Examples
28
+
29
+ Get information about the administrative unit by its id
30
+
31
+ ```sh
32
+ m365 aad administrativeunit get --id 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7
33
+ ```
34
+
35
+ Get information about the administrative unit by its display name
36
+
37
+ ```sh
38
+ m365 aad administrativeunit get --displayName 'Marketing Division'
39
+ ```
40
+
41
+ ## Response
42
+
43
+ <Tabs>
44
+ <TabItem value="JSON">
45
+
46
+ ```json
47
+ {
48
+ "id": "0a22c83d-c4ac-43e2-bb5e-87af3015d49f",
49
+ "deletedDateTime": null,
50
+ "displayName": "Marketing Division",
51
+ "description": "Marketing Department Administration",
52
+ "membershipRule": null,
53
+ "membershipType": null,
54
+ "membershipRuleProcessingState": null,
55
+ "visibility": "HiddenMembership"
56
+ }
57
+ ```
58
+
59
+ </TabItem>
60
+ <TabItem value="Text">
61
+
62
+ ```text
63
+ deletedDateTime : null
64
+ description : Marketing Department Administration
65
+ displayName : Marketing Division
66
+ id : 0a22c83d-c4ac-43e2-bb5e-87af3015d49f
67
+ membershipRule : null
68
+ membershipRuleProcessingState: null
69
+ membershipType : null
70
+ visibility : HiddenMembership
71
+ ```
72
+
73
+ </TabItem>
74
+ <TabItem value="CSV">
75
+
76
+ ```csv
77
+ id,displayName,description,visibility
78
+ 0a22c83d-c4ac-43e2-bb5e-87af3015d49f,Marketing Division,Marketing Department Administration,HiddenMembership
79
+ ```
80
+
81
+ </TabItem>
82
+ <TabItem value="Markdown">
83
+
84
+ ```md
85
+ Date: 10/23/2023
86
+
87
+ ## Marketing Division (0a22c83d-c4ac-43e2-bb5e-87af3015d49f)
88
+
89
+ Property | Value
90
+ ---------|-------
91
+ id | 0a22c83d-c4ac-43e2-bb5e-87af3015d49f
92
+ displayName | Marketing Division
93
+ description | Marketing Department Administration
94
+ visibility | HiddenMembership
95
+ ```
96
+
97
+ </TabItem>
98
+ </Tabs>
@@ -0,0 +1,83 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # aad administrativeunit list
6
+
7
+ Retrieves a list of administrative units
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 aad administrativeunit list [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ <Global />
18
+
19
+ ## Examples
20
+
21
+ Retrieve a list of administrative units
22
+
23
+ ```sh
24
+ m365 aad administrativeunit list
25
+ ```
26
+
27
+ ## Response
28
+
29
+ <Tabs>
30
+ <TabItem value="JSON">
31
+
32
+ ```json
33
+ [
34
+ {
35
+ "id": "0a22c83d-c4ac-43e2-bb5e-87af3015d49f",
36
+ "deletedDateTime": null,
37
+ "displayName": "Marketing Department",
38
+ "description": "Marketing Department Administration",
39
+ "membershipRule": null,
40
+ "membershipType": null,
41
+ "membershipRuleProcessingState": null,
42
+ "visibility": "HiddenMembership"
43
+ }
44
+ ]
45
+ ```
46
+
47
+ </TabItem>
48
+ <TabItem value="Text">
49
+
50
+ ```text
51
+ displayName: 0a22c83d-c4ac-43e2-bb5e-87af3015d49f
52
+ id : Marketing Department
53
+ visibility : HiddenMembership
54
+ ```
55
+
56
+ </TabItem>
57
+ <TabItem value="CSV">
58
+
59
+ ```csv
60
+ id,displayName,description,visibility
61
+ 0a22c83d-c4ac-43e2-bb5e-87af3015d49f,Marketing Department,Marketing Department Administration,HiddenMembership
62
+ ```
63
+
64
+ </TabItem>
65
+ <TabItem value="Markdown">
66
+
67
+ ```md
68
+ # aad administrativeunit list
69
+
70
+ Date: 2023-10-16
71
+
72
+ ## Marketing Department (0a22c83d-c4ac-43e2-bb5e-87af3015d49f)
73
+
74
+ Property | Value
75
+ ---------|-------
76
+ id | 0a22c83d-c4ac-43e2-bb5e-87af3015d49f
77
+ displayName | Marketing Department
78
+ description | Marketing Department Administration
79
+ visibility | HiddenMembership
80
+ ```
81
+
82
+ </TabItem>
83
+ </Tabs>
@@ -0,0 +1,52 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+
3
+ # aad administrativeunit remove
4
+
5
+ Removes an administrative unit
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ m365 aad administrativeunit remove [options]
11
+ ```
12
+
13
+ ## options
14
+
15
+ ```md definition-list
16
+ `-i, --id [id]`
17
+ : The id of the administrative unit. Specify either `id` or `displayName` but not both.
18
+
19
+ `-n, --displayName [displayName]`
20
+ : The display name of the administrative unit. Specify either `id` or `displayName` but not both.
21
+
22
+ `-f, --force [force]`
23
+ : Don't prompt for confirmation.
24
+ ```
25
+
26
+ <Global />
27
+
28
+ ## Remarks
29
+
30
+ :::info
31
+
32
+ To use this command you must be either **Global Administrator** or **Privileged Role Administrator**.
33
+
34
+ :::
35
+
36
+ ## Examples
37
+
38
+ Remove an administrative unit by its id
39
+
40
+ ```sh
41
+ m365 aad administrativeunit remove --id 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7
42
+ ```
43
+
44
+ Remove an administrative unit by it displayName
45
+
46
+ ```sh
47
+ m365 aad administrativeunit remove --displayName 'Marketing Division'
48
+ ```
49
+
50
+ ## Response
51
+
52
+ The command won't return a response on success
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@pnp/cli-microsoft365",
9
- "version": "7.1.0",
9
+ "version": "7.2.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@azure/msal-common": "^13.2.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "7.1.0",
3
+ "version": "7.2.0-beta.194fd07",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",
@@ -300,4 +300,4 @@
300
300
  "sinon": "^15.2.0",
301
301
  "source-map-support": "^0.5.21"
302
302
  }
303
- }
303
+ }