@pnp/cli-microsoft365 10.2.0-beta.8c41470 → 10.2.0-beta.9e186e5

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.
@@ -0,0 +1,58 @@
1
+ import GraphCommand from '../../../base/GraphCommand.js';
2
+ import commands from '../../commands.js';
3
+ import { z } from 'zod';
4
+ import { globalOptionsZod } from '../../../../Command.js';
5
+ import { zod } from '../../../../utils/zod.js';
6
+ import { roleDefinition } from '../../../../utils/roleDefinition.js';
7
+ import { validation } from '../../../../utils/validation.js';
8
+ const options = globalOptionsZod
9
+ .extend({
10
+ id: zod.alias('i', z.string().optional()),
11
+ displayName: zod.alias('n', z.string().optional()),
12
+ properties: zod.alias('p', z.string().optional())
13
+ })
14
+ .strict();
15
+ class EntraRoleDefinitionGetCommand extends GraphCommand {
16
+ get name() {
17
+ return commands.ROLEDEFINITION_GET;
18
+ }
19
+ get description() {
20
+ return 'Gets a specific Microsoft Entra ID role definition';
21
+ }
22
+ get schema() {
23
+ return options;
24
+ }
25
+ getRefinedSchema(schema) {
26
+ return schema
27
+ .refine(options => !options.id !== !options.displayName, {
28
+ message: 'Specify either id or displayName, but not both'
29
+ })
30
+ .refine(options => options.id || options.displayName, {
31
+ message: 'Specify either id or displayName'
32
+ })
33
+ .refine(options => (!options.id && !options.displayName) || options.displayName || (options.id && validation.isValidGuid(options.id)), options => ({
34
+ message: `The '${options.id}' must be a valid GUID`,
35
+ path: ['id']
36
+ }));
37
+ }
38
+ async commandAction(logger, args) {
39
+ if (this.verbose) {
40
+ await logger.logToStderr('Getting Microsoft Entra ID role definition...');
41
+ }
42
+ try {
43
+ let result;
44
+ if (args.options.id) {
45
+ result = await roleDefinition.getRoleDefinitionById(args.options.id, args.options.properties);
46
+ }
47
+ else {
48
+ result = await roleDefinition.getRoleDefinitionByDisplayName(args.options.displayName, args.options.properties);
49
+ }
50
+ await logger.log(result);
51
+ }
52
+ catch (err) {
53
+ this.handleRejectedODataJsonPromise(err);
54
+ }
55
+ }
56
+ }
57
+ export default new EntraRoleDefinitionGetCommand();
58
+ //# sourceMappingURL=roledefinition-get.js.map
@@ -0,0 +1,74 @@
1
+ import GraphCommand from '../../../base/GraphCommand.js';
2
+ import commands from '../../commands.js';
3
+ import { z } from 'zod';
4
+ import { globalOptionsZod } from '../../../../Command.js';
5
+ import { zod } from '../../../../utils/zod.js';
6
+ import { roleDefinition } from '../../../../utils/roleDefinition.js';
7
+ import { validation } from '../../../../utils/validation.js';
8
+ import request from '../../../../request.js';
9
+ import { cli } from '../../../../cli/cli.js';
10
+ const options = globalOptionsZod
11
+ .extend({
12
+ id: zod.alias('i', z.string().optional()),
13
+ displayName: zod.alias('n', z.string().optional()),
14
+ force: zod.alias('f', z.boolean().optional())
15
+ })
16
+ .strict();
17
+ class EntraRoleDefinitionRemoveCommand extends GraphCommand {
18
+ get name() {
19
+ return commands.ROLEDEFINITION_REMOVE;
20
+ }
21
+ get description() {
22
+ return 'Removes a specific Microsoft Entra ID role definition';
23
+ }
24
+ get schema() {
25
+ return options;
26
+ }
27
+ getRefinedSchema(schema) {
28
+ return schema
29
+ .refine(options => !options.id !== !options.displayName, {
30
+ message: 'Specify either id or displayName, but not both'
31
+ })
32
+ .refine(options => options.id || options.displayName, {
33
+ message: 'Specify either id or displayName'
34
+ })
35
+ .refine(options => (!options.id && !options.displayName) || options.displayName || (options.id && validation.isValidGuid(options.id)), options => ({
36
+ message: `The '${options.id}' must be a valid GUID`,
37
+ path: ['id']
38
+ }));
39
+ }
40
+ async commandAction(logger, args) {
41
+ const removeRoleDefinition = async () => {
42
+ try {
43
+ let roleDefinitionId = args.options.id;
44
+ if (args.options.displayName) {
45
+ roleDefinitionId = (await roleDefinition.getRoleDefinitionByDisplayName(args.options.displayName, 'id')).id;
46
+ }
47
+ if (args.options.verbose) {
48
+ await logger.logToStderr(`Removing role definition with ID ${roleDefinitionId}...`);
49
+ }
50
+ const requestOptions = {
51
+ url: `${this.resource}/v1.0/roleManagement/directory/roleDefinitions/${roleDefinitionId}`,
52
+ headers: {
53
+ accept: 'application/json;odata.metadata=none'
54
+ }
55
+ };
56
+ await request.delete(requestOptions);
57
+ }
58
+ catch (err) {
59
+ this.handleRejectedODataJsonPromise(err);
60
+ }
61
+ };
62
+ if (args.options.force) {
63
+ await removeRoleDefinition();
64
+ }
65
+ else {
66
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove role definition '${args.options.id || args.options.displayName}'?` });
67
+ if (result) {
68
+ await removeRoleDefinition();
69
+ }
70
+ }
71
+ }
72
+ }
73
+ export default new EntraRoleDefinitionRemoveCommand();
74
+ //# sourceMappingURL=roledefinition-remove.js.map
@@ -88,6 +88,8 @@ export default {
88
88
  PIM_ROLE_REQUEST_LIST: `${prefix} pim role request list`,
89
89
  POLICY_LIST: `${prefix} policy list`,
90
90
  ROLEDEFINITION_LIST: `${prefix} roledefinition list`,
91
+ ROLEDEFINITION_GET: `${prefix} roledefinition get`,
92
+ ROLEDEFINITION_REMOVE: `${prefix} roledefinition remove`,
91
93
  SITECLASSIFICATION_DISABLE: `${prefix} siteclassification disable`,
92
94
  SITECLASSIFICATION_ENABLE: `${prefix} siteclassification enable`,
93
95
  SITECLASSIFICATION_GET: `${prefix} siteclassification get`,
@@ -106,10 +106,10 @@ class TeamsCacheRemoveCommand extends AnonymousCommand {
106
106
  switch (platform) {
107
107
  case 'win32':
108
108
  if (client === 'classic') {
109
- cmd = 'wmic process where caption="Teams.exe" get ProcessId';
109
+ cmd = 'tasklist /FI "IMAGENAME eq Teams.exe" /FO csv';
110
110
  }
111
111
  else {
112
- cmd = 'wmic process where caption="ms-teams.exe" get ProcessId';
112
+ cmd = 'tasklist /FI "IMAGENAME eq ms-teams.exe" /FO csv';
113
113
  }
114
114
  break;
115
115
  case 'darwin':
@@ -131,7 +131,7 @@ class TeamsCacheRemoveCommand extends AnonymousCommand {
131
131
  else if (platform === 'win32') {
132
132
  const processJson = formatting.parseCsvToJson(cmdOutput.stdout);
133
133
  for (const proc of processJson) {
134
- process.kill(proc.ProcessId);
134
+ process.kill(proc.PID);
135
135
  }
136
136
  }
137
137
  if (this.verbose) {
@@ -0,0 +1,32 @@
1
+ import request from '../../../../request.js';
2
+ import GraphCommand from '../../../base/GraphCommand.js';
3
+ import commands from '../../commands.js';
4
+ class TenantPeoplePronounsGetCommand extends GraphCommand {
5
+ get name() {
6
+ return commands.PEOPLE_PRONOUNS_GET;
7
+ }
8
+ get description() {
9
+ return 'Retrieves information about pronouns settings for an organization';
10
+ }
11
+ async commandAction(logger) {
12
+ try {
13
+ if (this.verbose) {
14
+ await logger.logToStderr('Retrieving information about pronouns settings...');
15
+ }
16
+ const requestOptions = {
17
+ url: `${this.resource}/v1.0/admin/people/pronouns`,
18
+ headers: {
19
+ accept: 'application/json;odata.metadata=none'
20
+ },
21
+ responseType: 'json'
22
+ };
23
+ const pronouns = await request.get(requestOptions);
24
+ await logger.log(pronouns);
25
+ }
26
+ catch (err) {
27
+ this.handleRejectedODataJsonPromise(err);
28
+ }
29
+ }
30
+ }
31
+ export default new TenantPeoplePronounsGetCommand();
32
+ //# sourceMappingURL=people-pronouns-get.js.map
@@ -7,6 +7,7 @@ export default {
7
7
  PEOPLE_PROFILECARDPROPERTY_LIST: `${prefix} people profilecardproperty list`,
8
8
  PEOPLE_PROFILECARDPROPERTY_REMOVE: `${prefix} people profilecardproperty remove`,
9
9
  PEOPLE_PROFILECARDPROPERTY_SET: `${prefix} people profilecardproperty set`,
10
+ PEOPLE_PRONOUNS_GET: `${prefix} people pronouns get`,
10
11
  REPORT_ACTIVEUSERCOUNTS: `${prefix} report activeusercounts`,
11
12
  REPORT_ACTIVEUSERDETAIL: `${prefix} report activeuserdetail`,
12
13
  REPORT_OFFICE365ACTIVATIONCOUNTS: `${prefix} report office365activationcounts`,
@@ -1,15 +1,21 @@
1
1
  import { cli } from '../cli/cli.js';
2
2
  import { formatting } from './formatting.js';
3
3
  import { odata } from './odata.js';
4
+ import request from '../request.js';
4
5
  export const roleDefinition = {
5
6
  /**
6
- * Get a directory (Microsoft Entra) role
7
+ * Get an Entra ID (directory) role by its name
7
8
  * @param displayName Role definition display name.
9
+ * @param properties Comma-separated list of properties to include in the response.
8
10
  * @returns The role definition.
9
11
  * @throws Error when role definition was not found.
10
12
  */
11
- async getRoleDefinitionByDisplayName(displayName) {
12
- const roleDefinitions = await odata.getAllItems(`https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'`);
13
+ async getRoleDefinitionByDisplayName(displayName, properties) {
14
+ let url = `https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'`;
15
+ if (properties) {
16
+ url += `&$select=${properties}`;
17
+ }
18
+ const roleDefinitions = await odata.getAllItems(url);
13
19
  if (roleDefinitions.length === 0) {
14
20
  throw `The specified role definition '${displayName}' does not exist.`;
15
21
  }
@@ -19,6 +25,27 @@ export const roleDefinition = {
19
25
  return selectedRoleDefinition;
20
26
  }
21
27
  return roleDefinitions[0];
28
+ },
29
+ /**
30
+ * Get an Entra ID (directory) role by its id
31
+ * @param id Role definition id.
32
+ * @param properties Comma-separated list of properties to include in the response.
33
+ * @returns The role definition.
34
+ * @throws Error when role definition was not found.
35
+ */
36
+ async getRoleDefinitionById(id, properties) {
37
+ let url = `https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions/${id}`;
38
+ if (properties) {
39
+ url += `?$select=${properties}`;
40
+ }
41
+ const requestOptions = {
42
+ url: url,
43
+ headers: {
44
+ accept: 'application/json;odata.metadata=none'
45
+ },
46
+ responseType: 'json'
47
+ };
48
+ return await request.get(requestOptions);
22
49
  }
23
50
  };
24
51
  //# sourceMappingURL=roleDefinition.js.map
package/dist/utils/spo.js CHANGED
@@ -1673,7 +1673,14 @@ export const spo = {
1673
1673
  throw new Error(errorLog.Message);
1674
1674
  }
1675
1675
  // Get the destination object information
1676
- const objectInfo = logs.find(l => l.Event === 'JobFinishedObjectInfo');
1676
+ let objectInfo = logs.find(l => l.Event === 'JobFinishedObjectInfo');
1677
+ // In rare cases, the object info may not be available yet
1678
+ if (!objectInfo) {
1679
+ // By doing a final poll, we can get the object info
1680
+ progress = await request.post(requestOptions);
1681
+ const newLogs = progress.Logs?.map(l => JSON.parse(l));
1682
+ objectInfo = newLogs.find(l => l.Event === 'JobFinishedObjectInfo');
1683
+ }
1677
1684
  return objectInfo;
1678
1685
  },
1679
1686
  /**
@@ -0,0 +1,150 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # entra roledefinition get
6
+
7
+ Gets a specific Microsoft Entra ID role definition.
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 entra roledefinition get [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-i, --id [id]`
19
+ : The id of the role definition. Specify either `id` or `displayName`, but not both.
20
+
21
+ `-n, --displayName [displayName]`
22
+ : The display name of the role definition. Specify either `id` or `displayName`, but not both.
23
+
24
+ `-p, --properties [properties]`
25
+ : Comma-separated list of properties to retrieve.
26
+ ```
27
+
28
+ <Global />
29
+
30
+ ## Examples
31
+
32
+ Get info about a role specified by the id
33
+
34
+ ```sh
35
+ m365 entra roledefinition get --id 62e90394-69f5-4237-9190-012177145e10
36
+ ```
37
+
38
+ Get limited info about a role specified by the display name
39
+
40
+ ```sh
41
+ m365 entra roledefinition get --displayName 'Custom SharePoint Role' --properties 'description,isEnabled'
42
+ ```
43
+
44
+ ## Response
45
+
46
+ ### Standard response
47
+
48
+ <Tabs>
49
+ <TabItem value="JSON">
50
+
51
+ ```json
52
+ {
53
+ "id": "f28a1f50-f6e7-4571-818b-6a12f2af6b6c",
54
+ "description": "Can manage all aspects of the SharePoint service.",
55
+ "displayName": "SharePoint Administrator",
56
+ "isBuiltIn": true,
57
+ "isEnabled": true,
58
+ "resourceScopes": [
59
+ "/"
60
+ ],
61
+ "templateId": "f28a1f50-f6e7-4571-818b-6a12f2af6b6c",
62
+ "version": "1",
63
+ "rolePermissions": [
64
+ {
65
+ "allowedResourceActions": [
66
+ "microsoft.azure.serviceHealth/allEntities/allTasks",
67
+ "microsoft.azure.supportTickets/allEntities/allTasks",
68
+ "microsoft.backup/oneDriveForBusinessProtectionPolicies/allProperties/allTasks",
69
+ "microsoft.backup/oneDriveForBusinessRestoreSessions/allProperties/allTasks",
70
+ "microsoft.backup/restorePoints/sites/allProperties/allTasks",
71
+ "microsoft.backup/restorePoints/userDrives/allProperties/allTasks",
72
+ "microsoft.backup/sharePointProtectionPolicies/allProperties/allTasks",
73
+ "microsoft.backup/sharePointRestoreSessions/allProperties/allTasks",
74
+ "microsoft.backup/siteProtectionUnits/allProperties/allTasks",
75
+ "microsoft.backup/siteRestoreArtifacts/allProperties/allTasks",
76
+ "microsoft.backup/userDriveProtectionUnits/allProperties/allTasks",
77
+ "microsoft.backup/userDriveRestoreArtifacts/allProperties/allTasks",
78
+ "microsoft.directory/groups/hiddenMembers/read",
79
+ "microsoft.directory/groups.unified/basic/update",
80
+ "microsoft.directory/groups.unified/create",
81
+ "microsoft.directory/groups.unified/delete",
82
+ "microsoft.directory/groups.unified/members/update",
83
+ "microsoft.directory/groups.unified/owners/update",
84
+ "microsoft.directory/groups.unified/restore",
85
+ "microsoft.office365.migrations/allEntities/allProperties/allTasks",
86
+ "microsoft.office365.network/performance/allProperties/read",
87
+ "microsoft.office365.serviceHealth/allEntities/allTasks",
88
+ "microsoft.office365.sharePoint/allEntities/allTasks",
89
+ "microsoft.office365.supportTickets/allEntities/allTasks",
90
+ "microsoft.office365.usageReports/allEntities/allProperties/read",
91
+ "microsoft.office365.webPortal/allEntities/standard/read"
92
+ ],
93
+ "condition": null
94
+ }
95
+ ],
96
+ "inheritsPermissionsFrom": [
97
+ {
98
+ "id": "88d8e3e3-8f55-4a1e-953a-9b9898b8876b"
99
+ }
100
+ ]
101
+ }
102
+ ```
103
+
104
+ </TabItem>
105
+ <TabItem value="Text">
106
+
107
+ ```text
108
+ description : Can manage all aspects of the SharePoint service.
109
+ displayName : SharePoint Administrator
110
+ id : f28a1f50-f6e7-4571-818b-6a12f2af6b6c
111
+ inheritsPermissionsFrom: [{"id":"88d8e3e3-8f55-4a1e-953a-9b9898b8876b"}]
112
+ isBuiltIn : true
113
+ isEnabled : true
114
+ resourceScopes : ["/"]
115
+ rolePermissions : [{"allowedResourceActions":["microsoft.azure.serviceHealth/allEntities/allTasks","microsoft.azure.supportTickets/allEntities/allTasks","microsoft.office365.webPortal/allEntities/standard/read"],"condition":null}]
116
+ templateId : f28a1f50-f6e7-4571-818b-6a12f2af6b6c
117
+ version : 1
118
+ ```
119
+
120
+ </TabItem>
121
+ <TabItem value="CSV">
122
+
123
+ ```csv
124
+ id,description,displayName,isBuiltIn,isEnabled,templateId,version
125
+ f28a1f50-f6e7-4571-818b-6a12f2af6b6c,Can manage all aspects of the SharePoint service.,SharePoint Administrator,1,1,f28a1f50-f6e7-4571-818b-6a12f2af6b6c,1
126
+ ```
127
+
128
+ </TabItem>
129
+ <TabItem value="Markdown">
130
+
131
+ ```md
132
+ # entra roledefinition get --id "f28a1f50-f6e7-4571-818b-6a12f2af6b6c"
133
+
134
+ Date: 11/15/2024
135
+
136
+ ## SharePoint Administrator (f28a1f50-f6e7-4571-818b-6a12f2af6b6c)
137
+
138
+ Property | Value
139
+ ---------|-------
140
+ id | f28a1f50-f6e7-4571-818b-6a12f2af6b6c
141
+ description | Can manage all aspects of the SharePoint service.
142
+ displayName | SharePoint Administrator
143
+ isBuiltIn | true
144
+ isEnabled | true
145
+ templateId | f28a1f50-f6e7-4571-818b-6a12f2af6b6c
146
+ version | 1
147
+ ```
148
+
149
+ </TabItem>
150
+ </Tabs>
@@ -0,0 +1,52 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+
3
+ # entra roledefinition remove
4
+
5
+ Removes a custom Microsoft Entra role definition
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ m365 entra roledefinition remove [options]
11
+ ```
12
+
13
+ ## Options
14
+
15
+ ```md definition-list
16
+ `-i, --id [id]`
17
+ : The id of the role definition. Specify either `id` or `displayName`, but not both.
18
+
19
+ `-n, --displayName [displayName]`
20
+ : The name of the role definition. Specify either `id` or `displayName`, but not both.
21
+
22
+ `-f, --force`
23
+ : Don't prompt for confirmation.
24
+ ```
25
+
26
+ <Global />
27
+
28
+ ## Remarks
29
+
30
+ :::info
31
+
32
+ When the role definition is removed, all the associated role assignments are deleted.
33
+
34
+ :::
35
+
36
+ ## Examples
37
+
38
+ Remove a role definition specified by id without prompting
39
+
40
+ ```sh
41
+ m365 entra roledefinition remove --id 0bed8b86-5026-4a93-ac7d-56750cc099f1 --force
42
+ ```
43
+
44
+ Remove a role definition specified by name and prompt for confirmation
45
+
46
+ ```sh
47
+ m365 entra roledefinition remove --displayName 'Custom Role'
48
+ ```
49
+
50
+ ## Response
51
+
52
+ The command won't return a response on success
@@ -0,0 +1,71 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # tenant people pronouns get
6
+
7
+ Retrieves information about pronouns settings for an organization
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 tenant people pronouns get [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ <Global />
18
+
19
+ ## Examples
20
+
21
+ Retrieve information about pronouns settings
22
+
23
+ ```sh
24
+ m365 tenant people pronouns get
25
+ ```
26
+
27
+ ## Response
28
+
29
+ <Tabs>
30
+ <TabItem value="JSON">
31
+
32
+ ```json
33
+ {
34
+ "isEnabledInOrganization": true
35
+ }
36
+ ```
37
+
38
+ </TabItem>
39
+ <TabItem value="Text">
40
+
41
+ ```text
42
+ isEnabledInOrganization: true
43
+ ```
44
+
45
+ </TabItem>
46
+ <TabItem value="CSV">
47
+
48
+ ```csv
49
+ isEnabledInOrganization
50
+ 1
51
+ ```
52
+
53
+ </TabItem>
54
+ <TabItem value="Markdown">
55
+
56
+ ```md
57
+ # tenant people pronouns get
58
+
59
+ Date: 12/5/2024
60
+
61
+ Property | Value
62
+ ---------|-------
63
+ isEnabledInOrganization | true
64
+ ```
65
+
66
+ </TabItem>
67
+ </Tabs>
68
+
69
+ ## More information
70
+
71
+ - https://learn.microsoft.com/graph/api/peopleadminsettings-list-pronouns