@pnp/cli-microsoft365 10.3.0-beta.cd20f0c → 10.3.0-beta.df85113

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.
Files changed (68) hide show
  1. package/.eslintrc.cjs +2 -0
  2. package/README.md +11 -6
  3. package/allCommands.json +1 -1
  4. package/allCommandsFull.json +1 -1
  5. package/dist/config.js +2 -1
  6. package/dist/m365/commands/login.js +6 -6
  7. package/dist/m365/entra/commands/app/app-add.js +3 -0
  8. package/dist/m365/entra/commands/approleassignment/approleassignment-remove.js +1 -1
  9. package/dist/m365/entra/commands/group/group-list.js +3 -2
  10. package/dist/m365/entra/commands/pim/pim-role-assignment-remove.js +186 -0
  11. package/dist/m365/entra/commands/roledefinition/roledefinition-add.js +58 -0
  12. package/dist/m365/entra/commands/roledefinition/roledefinition-set.js +84 -0
  13. package/dist/m365/entra/commands/rolepermission/rolepermission-list.js +42 -0
  14. package/dist/m365/entra/commands.js +4 -0
  15. package/dist/m365/exo/commands/approleassignment/approleassignment-add.js +235 -0
  16. package/dist/m365/exo/commands.js +5 -0
  17. package/dist/m365/outlook/commands/mailbox/mailbox-settings-set.js +163 -0
  18. package/dist/m365/outlook/commands.js +1 -0
  19. package/dist/m365/pp/commands/website/website-get.js +60 -0
  20. package/dist/m365/pp/commands.js +2 -1
  21. package/dist/m365/spe/commands/container/container-activate.js +50 -0
  22. package/dist/m365/spe/commands.js +1 -0
  23. package/dist/m365/spo/commands/file/file-roleassignment-add.js +26 -2
  24. package/dist/m365/spo/commands/file/file-roleassignment-remove.js +26 -2
  25. package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +27 -24
  26. package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +24 -7
  27. package/dist/m365/spo/commands/list/list-defaultvalue-clear.js +184 -0
  28. package/dist/m365/spo/commands/list/list-defaultvalue-list.js +140 -0
  29. package/dist/m365/spo/commands/list/list-defaultvalue-remove.js +181 -0
  30. package/dist/m365/spo/commands/list/list-defaultvalue-set.js +210 -0
  31. package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +25 -7
  32. package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +22 -5
  33. package/dist/m365/spo/commands/web/web-roleassignment-add.js +22 -5
  34. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +22 -5
  35. package/dist/m365/spo/commands.js +4 -0
  36. package/dist/m365/tenant/commands/people/people-pronouns-set.js +46 -0
  37. package/dist/m365/tenant/commands/report/report-settings-set.js +47 -0
  38. package/dist/m365/tenant/commands.js +2 -0
  39. package/dist/utils/customAppScope.js +29 -0
  40. package/dist/utils/entraServicePrincipal.js +46 -0
  41. package/dist/utils/powerPlatform.js +38 -0
  42. package/dist/utils/roleDefinition.js +23 -0
  43. package/dist/utils/validation.js +4 -0
  44. package/docs/docs/cmd/entra/app/app-add.mdx +1 -1
  45. package/docs/docs/cmd/entra/pim/pim-role-assignment-remove.mdx +197 -0
  46. package/docs/docs/cmd/entra/roledefinition/roledefinition-add.mdx +131 -0
  47. package/docs/docs/cmd/entra/roledefinition/roledefinition-set.mdx +64 -0
  48. package/docs/docs/cmd/entra/rolepermission/rolepermission-list.mdx +162 -0
  49. package/docs/docs/cmd/exo/approleassignment/approleassignment-add.mdx +170 -0
  50. package/docs/docs/cmd/outlook/mailbox/mailbox-settings-set.mdx +166 -0
  51. package/docs/docs/cmd/pp/website/website-get.mdx +153 -0
  52. package/docs/docs/cmd/spe/container/container-activate.mdx +34 -0
  53. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +21 -4
  54. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +21 -3
  55. package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +15 -3
  56. package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +15 -3
  57. package/docs/docs/cmd/spo/list/list-defaultvalue-clear.mdx +62 -0
  58. package/docs/docs/cmd/spo/list/list-defaultvalue-list.mdx +110 -0
  59. package/docs/docs/cmd/spo/list/list-defaultvalue-remove.mdx +62 -0
  60. package/docs/docs/cmd/spo/list/list-defaultvalue-set.mdx +112 -0
  61. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.mdx +15 -3
  62. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.mdx +17 -5
  63. package/docs/docs/cmd/spo/web/web-roleassignment-add.mdx +15 -3
  64. package/docs/docs/cmd/spo/web/web-roleassignment-remove.mdx +15 -3
  65. package/docs/docs/cmd/tenant/people/people-pronouns-set.mdx +82 -0
  66. package/docs/docs/cmd/tenant/report/report-settings-set.mdx +32 -0
  67. package/npm-shrinkwrap.json +54 -74
  68. package/package.json +9 -9
@@ -11,6 +11,8 @@ import SpoCommand from '../../../base/SpoCommand.js';
11
11
  import commands from '../../commands.js';
12
12
  import spoGroupGetCommand from '../group/group-get.js';
13
13
  import spoUserGetCommand from '../user/user-get.js';
14
+ import { entraGroup } from '../../../../utils/entraGroup.js';
15
+ import { spo } from '../../../../utils/spo.js';
14
16
  class SpoWebRoleAssignmentRemoveCommand extends SpoCommand {
15
17
  get name() {
16
18
  return commands.WEB_ROLEASSIGNMENT_REMOVE;
@@ -44,15 +46,21 @@ class SpoWebRoleAssignmentRemoveCommand extends SpoCommand {
44
46
  try {
45
47
  if (options.upn) {
46
48
  options.principalId = await this.getUserPrincipalId(options);
47
- await this.removeRoleAssignmentWithOptions(logger, options);
48
49
  }
49
50
  else if (options.groupName) {
50
51
  options.principalId = await this.getGroupPrincipalId(options);
51
- await this.removeRoleAssignmentWithOptions(logger, options);
52
52
  }
53
- else {
54
- await this.removeRoleAssignmentWithOptions(logger, options);
53
+ else if (options.entraGroupId || options.entraGroupName) {
54
+ if (this.verbose) {
55
+ await logger.logToStderr('Retrieving group information...');
56
+ }
57
+ const group = options.entraGroupId
58
+ ? await entraGroup.getGroupById(options.entraGroupId)
59
+ : await entraGroup.getGroupByDisplayName(options.entraGroupName);
60
+ const siteUser = await spo.ensureEntraGroup(options.webUrl, group);
61
+ options.principalId = siteUser.Id;
55
62
  }
63
+ await this.removeRoleAssignmentWithOptions(logger, options);
56
64
  }
57
65
  catch (err) {
58
66
  this.handleRejectedODataJsonPromise(err);
@@ -102,6 +110,8 @@ _SpoWebRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoWebRoleAssignm
102
110
  principalId: typeof args.options.principalId !== 'undefined',
103
111
  upn: typeof args.options.upn !== 'undefined',
104
112
  groupName: typeof args.options.groupName !== 'undefined',
113
+ entraGroupId: typeof args.options.entraGroupId !== 'undefined',
114
+ entraGroupName: typeof args.options.entraGroupName !== 'undefined',
105
115
  force: (!(!args.options.force)).toString()
106
116
  });
107
117
  });
@@ -114,6 +124,10 @@ _SpoWebRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoWebRoleAssignm
114
124
  option: '--upn [upn]'
115
125
  }, {
116
126
  option: '--groupName [groupName]'
127
+ }, {
128
+ option: '--entraGroupId [entraGroupId]'
129
+ }, {
130
+ option: '--entraGroupName [entraGroupName]'
117
131
  }, {
118
132
  option: '-f, --force'
119
133
  });
@@ -126,10 +140,13 @@ _SpoWebRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoWebRoleAssignm
126
140
  if (args.options.principalId && isNaN(args.options.principalId)) {
127
141
  return `Specified principalId ${args.options.principalId} is not a number`;
128
142
  }
143
+ if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
144
+ return `'${args.options.entraGroupId}' is not a valid GUID for option entraGroupId.`;
145
+ }
129
146
  return true;
130
147
  });
131
148
  }, _SpoWebRoleAssignmentRemoveCommand_initOptionSets = function _SpoWebRoleAssignmentRemoveCommand_initOptionSets() {
132
- this.optionSets.push({ options: ['principalId', 'upn', 'groupName'] });
149
+ this.optionSets.push({ options: ['principalId', 'upn', 'groupName', 'entraGroupId', 'entraGroupName'] });
133
150
  };
134
151
  export default new SpoWebRoleAssignmentRemoveCommand();
135
152
  //# sourceMappingURL=web-roleassignment-remove.js.map
@@ -137,6 +137,10 @@ export default {
137
137
  LIST_CONTENTTYPE_LIST: `${prefix} list contenttype list`,
138
138
  LIST_CONTENTTYPE_REMOVE: `${prefix} list contenttype remove`,
139
139
  LIST_CONTENTTYPE_DEFAULT_SET: `${prefix} list contenttype default set`,
140
+ LIST_DEFAULTVALUE_CLEAR: `${prefix} list defaultvalue clear`,
141
+ LIST_DEFAULTVALUE_LIST: `${prefix} list defaultvalue list`,
142
+ LIST_DEFAULTVALUE_REMOVE: `${prefix} list defaultvalue remove`,
143
+ LIST_DEFAULTVALUE_SET: `${prefix} list defaultvalue set`,
140
144
  LIST_GET: `${prefix} list get`,
141
145
  LIST_LIST: `${prefix} list list`,
142
146
  LIST_REMOVE: `${prefix} list remove`,
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
3
+ import request from '../../../../request.js';
4
+ import { zod } from '../../../../utils/zod.js';
5
+ import GraphCommand from '../../../base/GraphCommand.js';
6
+ import commands from '../../commands.js';
7
+ const options = globalOptionsZod
8
+ .extend({
9
+ enabled: zod.alias('e', z.boolean())
10
+ })
11
+ .strict();
12
+ class TenantPeoplePronounsSetCommand extends GraphCommand {
13
+ get name() {
14
+ return commands.PEOPLE_PRONOUNS_SET;
15
+ }
16
+ get description() {
17
+ return 'Manage pronouns settings for an organization';
18
+ }
19
+ get schema() {
20
+ return options;
21
+ }
22
+ async commandAction(logger, args) {
23
+ try {
24
+ if (this.verbose) {
25
+ await logger.logToStderr('Updating pronouns settings...');
26
+ }
27
+ const requestOptions = {
28
+ url: `${this.resource}/v1.0/admin/people/pronouns`,
29
+ headers: {
30
+ accept: 'application/json;odata.metadata=none'
31
+ },
32
+ data: {
33
+ isEnabledInOrganization: args.options.enabled
34
+ },
35
+ responseType: 'json'
36
+ };
37
+ const pronouns = await request.patch(requestOptions);
38
+ await logger.log(pronouns);
39
+ }
40
+ catch (err) {
41
+ this.handleRejectedODataJsonPromise(err);
42
+ }
43
+ }
44
+ }
45
+ export default new TenantPeoplePronounsSetCommand();
46
+ //# sourceMappingURL=people-pronouns-set.js.map
@@ -0,0 +1,47 @@
1
+ import request from '../../../../request.js';
2
+ import GraphCommand from '../../../base/GraphCommand.js';
3
+ import commands from '../../commands.js';
4
+ import { z } from 'zod';
5
+ import { globalOptionsZod } from '../../../../Command.js';
6
+ import { zod } from '../../../../utils/zod.js';
7
+ const options = globalOptionsZod
8
+ .extend({
9
+ displayConcealedNames: zod.alias('d', z.boolean())
10
+ })
11
+ .strict();
12
+ class TenantReportSettingsSetCommand extends GraphCommand {
13
+ get name() {
14
+ return commands.REPORT_SETTINGS_SET;
15
+ }
16
+ get description() {
17
+ return 'Update tenant-level settings for Microsoft 365 reports';
18
+ }
19
+ get schema() {
20
+ return options;
21
+ }
22
+ async commandAction(logger, args) {
23
+ try {
24
+ const { displayConcealedNames } = args.options;
25
+ if (this.verbose) {
26
+ await logger.logToStderr(`Updating report setting displayConcealedNames to ${displayConcealedNames}`);
27
+ }
28
+ const requestOptions = {
29
+ url: `${this.resource}/v1.0/admin/reportSettings`,
30
+ headers: {
31
+ accept: 'application/json;odata.metadata=none',
32
+ 'content-type': 'application/json'
33
+ },
34
+ responseType: 'json',
35
+ data: {
36
+ displayConcealedNames
37
+ }
38
+ };
39
+ await request.patch(requestOptions);
40
+ }
41
+ catch (err) {
42
+ this.handleRejectedODataJsonPromise(err);
43
+ }
44
+ }
45
+ }
46
+ export default new TenantReportSettingsSetCommand();
47
+ //# sourceMappingURL=report-settings-set.js.map
@@ -8,12 +8,14 @@ export default {
8
8
  PEOPLE_PROFILECARDPROPERTY_REMOVE: `${prefix} people profilecardproperty remove`,
9
9
  PEOPLE_PROFILECARDPROPERTY_SET: `${prefix} people profilecardproperty set`,
10
10
  PEOPLE_PRONOUNS_GET: `${prefix} people pronouns get`,
11
+ PEOPLE_PRONOUNS_SET: `${prefix} people pronouns set`,
11
12
  REPORT_ACTIVEUSERCOUNTS: `${prefix} report activeusercounts`,
12
13
  REPORT_ACTIVEUSERDETAIL: `${prefix} report activeuserdetail`,
13
14
  REPORT_OFFICE365ACTIVATIONCOUNTS: `${prefix} report office365activationcounts`,
14
15
  REPORT_OFFICE365ACTIVATIONSUSERDETAIL: `${prefix} report office365activationsuserdetail`,
15
16
  REPORT_OFFICE365ACTIVATIONSUSERCOUNTS: `${prefix} report office365activationsusercounts`,
16
17
  REPORT_SERVICESUSERCOUNTS: `${prefix} report servicesusercounts`,
18
+ REPORT_SETTINGS_SET: `${prefix} report settings set`,
17
19
  SECURITY_ALERTS_LIST: `${prefix} security alerts list`,
18
20
  SERVICEANNOUNCEMENT_HEALTHISSUE_GET: `${prefix} serviceannouncement healthissue get`,
19
21
  SERVICEANNOUNCEMENT_HEALTH_GET: `${prefix} serviceannouncement health get`,
@@ -0,0 +1,29 @@
1
+ import { cli } from '../cli/cli.js';
2
+ import { formatting } from './formatting.js';
3
+ import { odata } from './odata.js';
4
+ export const customAppScope = {
5
+ /**
6
+ * Get a custom application scope by its name
7
+ * @param displayName Custom application scope display name.
8
+ * @param properties Comma-separated list of properties to include in the response.
9
+ * @returns The custom application scope.
10
+ * @throws Error when role definition was not found.
11
+ */
12
+ async getCustomAppScopeByDisplayName(displayName, properties) {
13
+ let url = `https://graph.microsoft.com/beta/roleManagement/exchange/customAppScopes?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'`;
14
+ if (properties) {
15
+ url += `&$select=${properties}`;
16
+ }
17
+ const customAppScopes = await odata.getAllItems(url);
18
+ if (customAppScopes.length === 0) {
19
+ throw `The specified custom application scope '${displayName}' does not exist.`;
20
+ }
21
+ if (customAppScopes.length > 1) {
22
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', customAppScopes);
23
+ const selectedCustomAppScope = await cli.handleMultipleResultsFound(`Multiple custom application scopes with name '${displayName}' found.`, resultAsKeyValuePair);
24
+ return selectedCustomAppScope;
25
+ }
26
+ return customAppScopes[0];
27
+ }
28
+ };
29
+ //# sourceMappingURL=customAppScope.js.map
@@ -0,0 +1,46 @@
1
+ import { odata } from './odata.js';
2
+ import { formatting } from './formatting.js';
3
+ import { cli } from '../cli/cli.js';
4
+ export const entraServicePrincipal = {
5
+ /**
6
+ * Get service principal by its appId
7
+ * @param appId App id.
8
+ * @param properties Comma-separated list of properties to include in the response.
9
+ * @returns The service principal.
10
+ * @throws Error when service principal was not found.
11
+ */
12
+ async getServicePrincipalByAppId(appId, properties) {
13
+ let url = `https://graph.microsoft.com/v1.0/servicePrincipals?$filter=appId eq '${appId}'`;
14
+ if (properties) {
15
+ url += `&$select=${properties}`;
16
+ }
17
+ const apps = await odata.getAllItems(url);
18
+ if (apps.length === 0) {
19
+ throw `Service principal with appId '${appId}' not found in Microsoft Entra ID`;
20
+ }
21
+ return apps[0];
22
+ },
23
+ /**
24
+ * Get service principal by its name
25
+ * @param appName Service principal name.
26
+ * @param properties Comma-separated list of properties to include in the response.
27
+ * @returns The service principal.
28
+ * @throws Error when service principal was not found.
29
+ */
30
+ async getServicePrincipalByAppName(appName, properties) {
31
+ let url = `https://graph.microsoft.com/v1.0/servicePrincipals?$filter=displayName eq '${formatting.encodeQueryParameter(appName)}'`;
32
+ if (properties) {
33
+ url += `&$select=${properties}`;
34
+ }
35
+ const apps = await odata.getAllItems(url);
36
+ if (apps.length === 0) {
37
+ throw `Service principal with name '${appName}' not found in Microsoft Entra ID`;
38
+ }
39
+ if (apps.length > 1) {
40
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', apps);
41
+ return await cli.handleMultipleResultsFound(`Multiple service principals with name '${appName}' found in Microsoft Entra ID.`, resultAsKeyValuePair);
42
+ }
43
+ return apps[0];
44
+ }
45
+ };
46
+ //# sourceMappingURL=entraServicePrincipal.js.map
@@ -1,5 +1,7 @@
1
+ import { cli } from "../cli/cli.js";
1
2
  import request from "../request.js";
2
3
  import { formatting } from "./formatting.js";
4
+ import { odata } from "./odata.js";
3
5
  const powerPlatformResource = 'https://api.bap.microsoft.com';
4
6
  export const powerPlatform = {
5
7
  async getDynamicsInstanceApiUrl(environment, asAdmin) {
@@ -24,6 +26,42 @@ export const powerPlatform = {
24
26
  catch (ex) {
25
27
  throw Error(`The environment '${environment}' could not be retrieved. See the inner exception for more details: ${ex.message}`);
26
28
  }
29
+ },
30
+ async getWebsiteById(environment, id) {
31
+ const requestOptions = {
32
+ url: `https://api.powerplatform.com/powerpages/environments/${environment}/websites/${id}?api-version=2022-03-01-preview`,
33
+ headers: {
34
+ accept: 'application/json;odata.metadata=none'
35
+ },
36
+ responseType: 'json'
37
+ };
38
+ try {
39
+ const response = await request.get(requestOptions);
40
+ return response;
41
+ }
42
+ catch (ex) {
43
+ throw Error(`The specified Power Page website with id '${id}' does not exist.`);
44
+ }
45
+ },
46
+ async getWebsiteByName(environment, websiteName) {
47
+ const response = await odata.getAllItems(`https://api.powerplatform.com/powerpages/environments/${environment}/websites?api-version=2022-03-01-preview`);
48
+ const items = response.filter(response => response.name === websiteName);
49
+ if (items.length === 0) {
50
+ throw Error(`The specified Power Page website '${websiteName}' does not exist.`);
51
+ }
52
+ if (items.length > 1) {
53
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('websiteUrl', items);
54
+ return cli.handleMultipleResultsFound(`Multiple Power Page websites with name '${websiteName}' found`, resultAsKeyValuePair);
55
+ }
56
+ return items[0];
57
+ },
58
+ async getWebsiteByUrl(environment, url) {
59
+ const response = await odata.getAllItems(`https://api.powerplatform.com/powerpages/environments/${environment}/websites?api-version=2022-03-01-preview`);
60
+ const items = response.filter(response => response.websiteUrl === url);
61
+ if (items.length === 0) {
62
+ throw Error(`The specified Power Page website with url '${url}' does not exist.`);
63
+ }
64
+ return items[0];
27
65
  }
28
66
  };
29
67
  //# sourceMappingURL=powerPlatform.js.map
@@ -46,6 +46,29 @@ export const roleDefinition = {
46
46
  responseType: 'json'
47
47
  };
48
48
  return await request.get(requestOptions);
49
+ },
50
+ /**
51
+ * Get an Exchange role by its name
52
+ * @param displayName Role definition display name.
53
+ * @param properties Comma-separated list of properties to include in the response.
54
+ * @returns The role definition.
55
+ * @throws Error when role definition was not found.
56
+ */
57
+ async getExchangeRoleDefinitionByDisplayName(displayName, properties) {
58
+ let url = `https://graph.microsoft.com/beta/roleManagement/exchange/roleDefinitions?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'`;
59
+ if (properties) {
60
+ url += `&$select=${properties}`;
61
+ }
62
+ const roleDefinitions = await odata.getAllItems(url);
63
+ if (roleDefinitions.length === 0) {
64
+ throw `The specified role definition '${displayName}' does not exist.`;
65
+ }
66
+ if (roleDefinitions.length > 1) {
67
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', roleDefinitions);
68
+ const selectedRoleDefinition = await cli.handleMultipleResultsFound(`Multiple role definitions with name '${displayName}' found.`, resultAsKeyValuePair);
69
+ return selectedRoleDefinition;
70
+ }
71
+ return roleDefinitions[0];
49
72
  }
50
73
  };
51
74
  //# sourceMappingURL=roleDefinition.js.map
@@ -357,6 +357,10 @@ export const validation = {
357
357
  .split(' ')
358
358
  .filter(permission => permission.indexOf('/') < 0);
359
359
  return invalidPermissions.length > 0 ? invalidPermissions : true;
360
+ },
361
+ isValidPowerPagesUrl(url) {
362
+ const powerPagesUrlPattern = /^https:\/\/[a-zA-Z0-9-]+\.powerappsportals\.com$/;
363
+ return powerPagesUrlPattern.test(url);
360
364
  }
361
365
  };
362
366
  //# sourceMappingURL=validation.js.map
@@ -31,7 +31,7 @@ m365 entra appregistration add [options]
31
31
  : Comma-separated list of redirect URIs. Requires `platform` to be specified.
32
32
 
33
33
  `-p, --platform [platform]`
34
- : Platform for which the `redirectUris` should be configured. Allowed values `spa`, `web`, `publicClient`.
34
+ : Platform for which the `redirectUris` should be configured. Allowed values `spa`, `web`, `publicClient`. Requires `redirectUris` to be specified.
35
35
 
36
36
  `--implicitFlow`
37
37
  : Specify, to indicate that the authorization endpoint should return ID and access tokens.
@@ -0,0 +1,197 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # entra pim role assignment remove
6
+
7
+ Request deactivation of an Entra role assignment for a user or group.
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 entra pim role assignment remove [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-n, --roleDefinitionName [roleDefinitionName]`
19
+ : Name of the role definition that should be assigned. Specify either `roleDefinitionName` or `roleDefinitionId` but not both.
20
+
21
+ `-i, --roleDefinitionId [roleDefinitionId]`
22
+ : Id of the role definition that is being assigned. Specify either `roleDefinitionName` or `roleDefinitionId` but not both.
23
+
24
+ `--userId [userId]`
25
+ : Id of the user that will be granted the assignment. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, the current user will be used.
26
+
27
+ `--userName [userName]`
28
+ : UPN of the user that will be granted the assignment. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, the current user will be used.
29
+
30
+ `--groupId [groupId]`
31
+ : Id of the group that will be granted the assignment. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, the current user will be used.
32
+
33
+ `--groupName [groupName]`
34
+ : Display name of the group that will be granted the assignment. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, the current user will be used.
35
+
36
+ `--administrativeUnitId [administrativeUnitId]`
37
+ : Id of the administrative unit representing the scope of the assignment. Specify either `administrativeUnitId` or `applicationId`. If not specified, default scope will be tenant-wide.
38
+
39
+ `--applicationId [applicationId]`
40
+ : Object Id of the application representing the scope of the assignment. Specify either `administrativeUnitId` or `applicationId`. If not specified, default scope will be tenant-wide.
41
+
42
+ `-j, --justification [justification]`
43
+ : An optional justification message.
44
+
45
+ `--ticketNumber [ticketNumber]`
46
+ : Optional ticket number value to communicate with the request.
47
+
48
+ `--ticketSystem [ticketSystem]`
49
+ : Optional ticket system to communicate with the request.
50
+ ```
51
+
52
+ <Global />
53
+
54
+ ## Remarks
55
+
56
+ :::info
57
+
58
+ When deactivating a role for other users, you must be **Privileged Role Administrator**.
59
+
60
+ :::
61
+
62
+ ## Examples
63
+
64
+ Request deactivation of the SharePoint Administrator Entra role assignment for the current user.
65
+
66
+ ```sh
67
+ m365 entra pim role assignment remove --roleDefinitionName 'SharePoint Administrator'
68
+ ```
69
+
70
+ Request deactivation of an Entra role assignment for the current user.
71
+
72
+ ```sh
73
+ m365 entra pim role assignment remove --roleDefinitionId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690'
74
+ ```
75
+
76
+ Request deactivation of an Entra role assignment for the current user with a justification
77
+
78
+ ```sh
79
+ m365 entra pim role assignment remove --roleDefinitionId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690' --justification 'Need Global Admin to release application xyz to production'
80
+ ```
81
+
82
+ Request deactivation of an Entra role assignment for a specified user with tenant scope.
83
+
84
+ ```sh
85
+ m365 entra pim role assignment remove --roleDefinitionId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690' --userId '3488d6b8-6b2e-41c3-9583-1991205323c2'
86
+ ```
87
+
88
+ Request deactivation of the User Administrator Entra role assignment for a specified group with administrative unit scope.
89
+
90
+ ```sh
91
+ m365 entra pim role assignment remove --roleDefinitionName 'User Administrator' --groupId '3488d6b8-6b2e-41c3-9583-1991205323c2' --administrativeUnitId '03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7'
92
+ ```
93
+
94
+ Request deactivation of the Application Administrator Entra role assignment for a specified group with scope to a specific application.
95
+
96
+ ```sh
97
+ m365 entra pim role assignment remove --roleDefinitionName 'Application Administrator' --groupName 'Applications admins' --applicationId '03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7'
98
+ ```
99
+
100
+ ## Response
101
+
102
+ <Tabs>
103
+ <TabItem value="JSON">
104
+
105
+ ```json
106
+ {
107
+ "id": "3f7d1bd6-a9a5-45bc-b831-00cfa3e3c649",
108
+ "status": "Revoked",
109
+ "createdDateTime": "2024-07-30T12:08:29.7734603Z",
110
+ "completedDateTime": null,
111
+ "approvalId": null,
112
+ "customData": null,
113
+ "action": "adminRemove",
114
+ "principalId": "61b0c52f-a902-4769-9a09-c6628335b00a",
115
+ "roleDefinitionId": "f28a1f50-f6e7-4571-818b-6a12f2af6b6c",
116
+ "directoryScopeId": "/",
117
+ "appScopeId": null,
118
+ "isValidationOnly": false,
119
+ "targetScheduleId": null,
120
+ "justification": "Removing SharePoint Administrator role",
121
+ "createdBy": {
122
+ "application": null,
123
+ "device": null,
124
+ "user": {
125
+ "displayName": null,
126
+ "id": "893f9116-e024-4bc6-8e98-54c245129485"
127
+ }
128
+ },
129
+ "scheduleInfo": null,
130
+ "ticketInfo": {
131
+ "ticketNumber": null,
132
+ "ticketSystem": null
133
+ }
134
+ }
135
+ ```
136
+
137
+ </TabItem>
138
+ <TabItem value="Text">
139
+
140
+ ```text
141
+ action : adminRemove
142
+ appScopeId : null
143
+ approvalId : null
144
+ completedDateTime: null
145
+ createdBy : null
146
+ createdDateTime : 2024-07-30T12:08:29.7734603Z
147
+ customData : null
148
+ directoryScopeId : /
149
+ id : c221e106-0711-470a-83cf-f8d7cbc51ecd
150
+ isValidationOnly : false
151
+ justification : Removing SharePoint Administrator role
152
+ principalId : 61b0c52f-a902-4769-9a09-c6628335b00a
153
+ roleDefinitionId : f28a1f50-f6e7-4571-818b-6a12f2af6b6c
154
+ scheduleInfo : null
155
+ status : Revoked
156
+ targetScheduleId : c221e106-0711-470a-83cf-f8d7cbc51ecd
157
+ ticketInfo : {"ticketNumber":null,"ticketSystem":null}
158
+ ```
159
+
160
+ </TabItem>
161
+ <TabItem value="CSV">
162
+
163
+ ```csv
164
+ id,status,createdDateTime,completedDateTime,approvalId,customData,action,principalId,roleDefinitionId,directoryScopeId,appScopeId,isValidationOnly,targetScheduleId,justification
165
+ 7d727f44-c2dd-459e-8665-99ce003d12a9,Revoked,2024-07-30T12:08:29.7734603Z,,,,adminRemove,61b0c52f-a902-4769-9a09-c6628335b00a,f28a1f50-f6e7-4571-818b-6a12f2af6b6c,/,,,7d727f44-c2dd-459e-8665-99ce003d12a9,Removing SharePoint Administrator role
166
+ ```
167
+
168
+ </TabItem>
169
+ <TabItem value="Markdown">
170
+
171
+ ```md
172
+ # entra pim roleassignment remove --roleDefinitionId "f28a1f50-f6e7-4571-818b-6a12f2af6b6c" --userId "61b0c52f-a902-4769-9a09-c6628335b00a" --justification "Removing SharePoint Administrator role"
173
+
174
+ Date: 7/30/2024
175
+
176
+ ## 7622802f-648b-4dd9-820f-dccaf8bbbab5
177
+
178
+ Property | Value
179
+ ---------|-------
180
+ id | 7622802f-648b-4dd9-820f-dccaf8bbbab5
181
+ status | Revoked
182
+ createdDateTime | 2024-07-30T12:08:29.7734603Z
183
+ action | adminRemove
184
+ principalId | 61b0c52f-a902-4769-9a09-c6628335b00a
185
+ roleDefinitionId | f28a1f50-f6e7-4571-818b-6a12f2af6b6c
186
+ directoryScopeId | /
187
+ isValidationOnly | false
188
+ targetScheduleId | 7622802f-648b-4dd9-820f-dccaf8bbbab5
189
+ justification | Removing SharePoint Administrator role
190
+ ```
191
+
192
+ </TabItem>
193
+ </Tabs>
194
+
195
+ ## More information
196
+
197
+ - Role assignment request: https://learn.microsoft.com/graph/api/rbacapplication-post-roleassignmentschedulerequests