@pnp/cli-microsoft365 7.10.0-beta.0d80e6e → 7.10.0-beta.a743796

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,124 @@
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 _EntraPimRoleAssignmentEligibilityListCommand_instances, _EntraPimRoleAssignmentEligibilityListCommand_initTelemetry, _EntraPimRoleAssignmentEligibilityListCommand_initOptions, _EntraPimRoleAssignmentEligibilityListCommand_initValidators, _EntraPimRoleAssignmentEligibilityListCommand_initOptionSets;
7
+ import GraphCommand from '../../../base/GraphCommand.js';
8
+ import commands from '../../commands.js';
9
+ import { validation } from '../../../../utils/validation.js';
10
+ import { entraUser } from '../../../../utils/entraUser.js';
11
+ import { entraGroup } from '../../../../utils/entraGroup.js';
12
+ import { odata } from '../../../../utils/odata.js';
13
+ class EntraPimRoleAssignmentEligibilityListCommand extends GraphCommand {
14
+ get name() {
15
+ return commands.PIM_ROLE_ASSIGNMENT_ELIGIBILITY_LIST;
16
+ }
17
+ get description() {
18
+ return 'Retrieves a list of eligible roles a user or group can be assigned to';
19
+ }
20
+ defaultProperties() {
21
+ return ['roleDefinitionId', 'roleDefinitionName', 'principalId'];
22
+ }
23
+ constructor() {
24
+ super();
25
+ _EntraPimRoleAssignmentEligibilityListCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentEligibilityListCommand_instances, "m", _EntraPimRoleAssignmentEligibilityListCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentEligibilityListCommand_instances, "m", _EntraPimRoleAssignmentEligibilityListCommand_initOptions).call(this);
28
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentEligibilityListCommand_instances, "m", _EntraPimRoleAssignmentEligibilityListCommand_initValidators).call(this);
29
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentEligibilityListCommand_instances, "m", _EntraPimRoleAssignmentEligibilityListCommand_initOptionSets).call(this);
30
+ }
31
+ async commandAction(logger, args) {
32
+ if (this.verbose) {
33
+ await logger.logToStderr(`Retrieving list of eligible roles for ${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName || 'all users'}...`);
34
+ }
35
+ const queryParameters = [];
36
+ const expands = [];
37
+ try {
38
+ const principalId = await this.getPrincipalId(logger, args.options);
39
+ if (principalId) {
40
+ queryParameters.push(`$filter=principalId eq '${principalId}'`);
41
+ }
42
+ expands.push('roleDefinition($select=displayName)');
43
+ if (args.options.includePrincipalDetails) {
44
+ expands.push('principal');
45
+ }
46
+ queryParameters.push(`$expand=${expands.join(',')}`);
47
+ const url = `${this.resource}/v1.0/roleManagement/directory/roleEligibilityScheduleInstances?${queryParameters.join('&')}`;
48
+ const results = await odata.getAllItems(url);
49
+ results.forEach(c => {
50
+ const roleDefinition = c['roleDefinition'];
51
+ if (roleDefinition) {
52
+ c.roleDefinitionName = roleDefinition.displayName;
53
+ }
54
+ delete c['roleDefinition'];
55
+ });
56
+ await logger.log(results);
57
+ }
58
+ catch (err) {
59
+ this.handleRejectedODataJsonPromise(err);
60
+ }
61
+ }
62
+ async getPrincipalId(logger, options) {
63
+ let principalId = options.userId;
64
+ if (options.userName) {
65
+ if (this.verbose) {
66
+ await logger.logToStderr(`Retrieving user by its name '${options.userName}'`);
67
+ }
68
+ principalId = await entraUser.getUserIdByUpn(options.userName);
69
+ }
70
+ else if (options.groupId) {
71
+ principalId = options.groupId;
72
+ }
73
+ else if (options.groupName) {
74
+ if (this.verbose) {
75
+ await logger.logToStderr(`Retrieving group by its name '${options.groupName}'`);
76
+ }
77
+ principalId = await entraGroup.getGroupIdByDisplayName(options.groupName);
78
+ }
79
+ return principalId;
80
+ }
81
+ }
82
+ _EntraPimRoleAssignmentEligibilityListCommand_instances = new WeakSet(), _EntraPimRoleAssignmentEligibilityListCommand_initTelemetry = function _EntraPimRoleAssignmentEligibilityListCommand_initTelemetry() {
83
+ this.telemetry.push((args) => {
84
+ Object.assign(this.telemetryProperties, {
85
+ userId: typeof args.options.userId !== 'undefined',
86
+ userName: typeof args.options.userName !== 'undefined',
87
+ groupId: typeof args.options.groupId !== 'undefined',
88
+ groupName: typeof args.options.groupName !== 'undefined',
89
+ includePrincipalDetails: !!args.options.includePrincipalDetails
90
+ });
91
+ });
92
+ }, _EntraPimRoleAssignmentEligibilityListCommand_initOptions = function _EntraPimRoleAssignmentEligibilityListCommand_initOptions() {
93
+ this.options.unshift({
94
+ option: '--userId [userId]'
95
+ }, {
96
+ option: '--userName [userName]'
97
+ }, {
98
+ option: '--groupId [groupId]'
99
+ }, {
100
+ option: '--groupName [groupName]'
101
+ }, {
102
+ option: '--includePrincipalDetails [includePrincipalDetails]'
103
+ });
104
+ }, _EntraPimRoleAssignmentEligibilityListCommand_initValidators = function _EntraPimRoleAssignmentEligibilityListCommand_initValidators() {
105
+ this.validators.push(async (args) => {
106
+ if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
107
+ return `'${args.options.userId} is not a valid GUID for option 'userId'.`;
108
+ }
109
+ if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
110
+ return `'${args.options.userName} is not a valid user principal name for option 'userName'.`;
111
+ }
112
+ if (args.options.groupId && !validation.isValidGuid(args.options.groupId)) {
113
+ return `'${args.options.groupId}' is not a valid GUID for option 'groupId'.`;
114
+ }
115
+ return true;
116
+ });
117
+ }, _EntraPimRoleAssignmentEligibilityListCommand_initOptionSets = function _EntraPimRoleAssignmentEligibilityListCommand_initOptionSets() {
118
+ this.optionSets.push({
119
+ options: ['userId', 'userName', 'groupId', 'groupName'],
120
+ runsWhen: (args) => args.options.userId || args.options.userName || args.options.groupName || args.options.groupId
121
+ });
122
+ };
123
+ export default new EntraPimRoleAssignmentEligibilityListCommand();
124
+ //# sourceMappingURL=pim-role-assignment-eligibility-list.js.map
@@ -0,0 +1,149 @@
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 _EntraPimRoleRequestListCommand_instances, _EntraPimRoleRequestListCommand_initTelemetry, _EntraPimRoleRequestListCommand_initOptions, _EntraPimRoleRequestListCommand_initValidators, _EntraPimRoleRequestListCommand_initOptionSets;
7
+ import GraphCommand from '../../../base/GraphCommand.js';
8
+ import commands from '../../commands.js';
9
+ import { validation } from '../../../../utils/validation.js';
10
+ import { entraUser } from '../../../../utils/entraUser.js';
11
+ import { entraGroup } from '../../../../utils/entraGroup.js';
12
+ import { odata } from '../../../../utils/odata.js';
13
+ class EntraPimRoleRequestListCommand extends GraphCommand {
14
+ get name() {
15
+ return commands.PIM_ROLE_REQUEST_LIST;
16
+ }
17
+ get description() {
18
+ return 'Retrieves a list of PIM requests for roles';
19
+ }
20
+ defaultProperties() {
21
+ return ['id', 'roleDefinitionName', 'principalId'];
22
+ }
23
+ constructor() {
24
+ super();
25
+ _EntraPimRoleRequestListCommand_instances.add(this);
26
+ this.allowedStatuses = ['Canceled', 'Denied', 'Failed', 'Granted', 'PendingAdminDecision', 'PendingApproval', 'PendingProvisioning', 'PendingScheduleCreation', 'Provisioned', 'Revoked', 'ScheduleCreated'];
27
+ __classPrivateFieldGet(this, _EntraPimRoleRequestListCommand_instances, "m", _EntraPimRoleRequestListCommand_initTelemetry).call(this);
28
+ __classPrivateFieldGet(this, _EntraPimRoleRequestListCommand_instances, "m", _EntraPimRoleRequestListCommand_initOptions).call(this);
29
+ __classPrivateFieldGet(this, _EntraPimRoleRequestListCommand_instances, "m", _EntraPimRoleRequestListCommand_initValidators).call(this);
30
+ __classPrivateFieldGet(this, _EntraPimRoleRequestListCommand_instances, "m", _EntraPimRoleRequestListCommand_initOptionSets).call(this);
31
+ }
32
+ async commandAction(logger, args) {
33
+ if (this.verbose) {
34
+ await logger.logToStderr(`Retrieving list of PIM roles requests for ${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName || 'all users'}...`);
35
+ }
36
+ const queryParameters = [];
37
+ const filters = [];
38
+ const expands = [];
39
+ try {
40
+ const principalId = await this.getPrincipalId(logger, args.options);
41
+ if (principalId) {
42
+ filters.push(`principalId eq '${principalId}'`);
43
+ }
44
+ if (args.options.createdDateTime) {
45
+ filters.push(`createdDateTime ge ${args.options.createdDateTime}`);
46
+ }
47
+ if (args.options.status) {
48
+ filters.push(`status eq '${args.options.status}'`);
49
+ }
50
+ if (filters.length > 0) {
51
+ queryParameters.push(`$filter=${filters.join(' and ')}`);
52
+ }
53
+ expands.push('roleDefinition($select=displayName)');
54
+ if (args.options.includePrincipalDetails) {
55
+ expands.push('principal');
56
+ }
57
+ queryParameters.push(`$expand=${expands.join(',')}`);
58
+ const queryString = `?${queryParameters.join('&')}`;
59
+ const url = `${this.resource}/v1.0/roleManagement/directory/roleAssignmentScheduleRequests${queryString}`;
60
+ const results = await odata.getAllItems(url);
61
+ results.forEach(c => {
62
+ const roleDefinition = c['roleDefinition'];
63
+ if (roleDefinition) {
64
+ c.roleDefinitionName = roleDefinition.displayName;
65
+ }
66
+ delete c['roleDefinition'];
67
+ });
68
+ await logger.log(results);
69
+ }
70
+ catch (err) {
71
+ this.handleRejectedODataJsonPromise(err);
72
+ }
73
+ }
74
+ async getPrincipalId(logger, options) {
75
+ let principalId = options.userId;
76
+ if (options.userName) {
77
+ if (this.verbose) {
78
+ await logger.logToStderr(`Retrieving user by its name '${options.userName}'`);
79
+ }
80
+ principalId = await entraUser.getUserIdByUpn(options.userName);
81
+ }
82
+ else if (options.groupId) {
83
+ principalId = options.groupId;
84
+ }
85
+ else if (options.groupName) {
86
+ if (this.verbose) {
87
+ await logger.logToStderr(`Retrieving group by its name '${options.groupName}'`);
88
+ }
89
+ principalId = await entraGroup.getGroupIdByDisplayName(options.groupName);
90
+ }
91
+ return principalId;
92
+ }
93
+ }
94
+ _EntraPimRoleRequestListCommand_instances = new WeakSet(), _EntraPimRoleRequestListCommand_initTelemetry = function _EntraPimRoleRequestListCommand_initTelemetry() {
95
+ this.telemetry.push((args) => {
96
+ Object.assign(this.telemetryProperties, {
97
+ userId: typeof args.options.userId !== 'undefined',
98
+ userName: typeof args.options.userName !== 'undefined',
99
+ groupId: typeof args.options.groupId !== 'undefined',
100
+ groupName: typeof args.options.groupName !== 'undefined',
101
+ createdDateTime: typeof args.options.createdDateTime !== 'undefined',
102
+ status: typeof args.options.status !== 'undefined',
103
+ includePrincipalDetails: !!args.options.includePrincipalDetails
104
+ });
105
+ });
106
+ }, _EntraPimRoleRequestListCommand_initOptions = function _EntraPimRoleRequestListCommand_initOptions() {
107
+ this.options.unshift({
108
+ option: '--userId [userId]'
109
+ }, {
110
+ option: '--userName [userName]'
111
+ }, {
112
+ option: '--groupId [groupId]'
113
+ }, {
114
+ option: '--groupName [groupName]'
115
+ }, {
116
+ option: '-c, --createdDateTime [createdDateTime]'
117
+ }, {
118
+ option: '-s, --status [status]',
119
+ autocomplete: this.allowedStatuses
120
+ }, {
121
+ option: '--includePrincipalDetails [includePrincipalDetails]'
122
+ });
123
+ }, _EntraPimRoleRequestListCommand_initValidators = function _EntraPimRoleRequestListCommand_initValidators() {
124
+ this.validators.push(async (args) => {
125
+ if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
126
+ return `'${args.options.userId}' is not a valid GUID for option 'userId'`;
127
+ }
128
+ if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
129
+ return `'${args.options.userName}' is not a valid user principal name for option 'userName'.`;
130
+ }
131
+ if (args.options.groupId && !validation.isValidGuid(args.options.groupId)) {
132
+ return `'${args.options.groupId}' is not a valid GUID for option 'groupId'`;
133
+ }
134
+ if (args.options.createdDateTime && !validation.isValidISODateTime(args.options.createdDateTime)) {
135
+ return `'${args.options.createdDateTime}' is not a valid ISO 8601 date time string for option 'createdDateTime'`;
136
+ }
137
+ if (args.options.status && !this.allowedStatuses.some(status => status.toLowerCase() === args.options.status.toLowerCase())) {
138
+ return `'${args.options.status}' for option 'status' must be one of the following values: ${this.allowedStatuses.join(', ')}.`;
139
+ }
140
+ return true;
141
+ });
142
+ }, _EntraPimRoleRequestListCommand_initOptionSets = function _EntraPimRoleRequestListCommand_initOptionSets() {
143
+ this.optionSets.push({
144
+ options: ['userId', 'userName', 'groupId', 'groupName'],
145
+ runsWhen: (args) => args.options.userId || args.options.userName || args.options.groupId || args.options.groupName
146
+ });
147
+ };
148
+ export default new EntraPimRoleRequestListCommand();
149
+ //# sourceMappingURL=pim-role-request-list.js.map
@@ -77,6 +77,8 @@ export default {
77
77
  OAUTH2GRANT_SET: `${prefix} oauth2grant set`,
78
78
  PIM_ROLE_ASSIGNMENT_ADD: `${prefix} pim role assignment add`,
79
79
  PIM_ROLE_ASSIGNMENT_LIST: `${prefix} pim role assignment list`,
80
+ PIM_ROLE_ASSIGNMENT_ELIGIBILITY_LIST: `${prefix} pim role assignment eligibility list`,
81
+ PIM_ROLE_REQUEST_LIST: `${prefix} pim role request list`,
80
82
  POLICY_LIST: `${prefix} policy list`,
81
83
  SITECLASSIFICATION_DISABLE: `${prefix} siteclassification disable`,
82
84
  SITECLASSIFICATION_ENABLE: `${prefix} siteclassification enable`,
@@ -28,40 +28,81 @@ class SpoFolderAddCommand extends SpoCommand {
28
28
  }
29
29
  async commandAction(logger, args) {
30
30
  try {
31
- if (this.verbose) {
32
- await logger.logToStderr(`Adding folder to site ${args.options.webUrl}...`);
33
- }
34
31
  const parentFolderServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.parentFolderUrl);
35
32
  const serverRelativeUrl = `${parentFolderServerRelativeUrl}/${args.options.name}`;
36
- const requestOptions = {
37
- headers: {
38
- 'accept': 'application/json;odata=nometadata'
39
- },
40
- responseType: 'json'
41
- };
42
- if (args.options.color === undefined) {
43
- requestOptions.url = `${args.options.webUrl}/_api/web/folders/addUsingPath(decodedUrl='${formatting.encodeQueryParameter(serverRelativeUrl)}')`;
33
+ if (args.options.ensureParentFolders) {
34
+ await this.ensureParentFolderPath(args.options, parentFolderServerRelativeUrl, logger);
44
35
  }
45
- else {
46
- requestOptions.url = `${args.options.webUrl}/_api/foldercoloring/createfolder(DecodedUrl='${formatting.encodeQueryParameter(serverRelativeUrl)}', overwrite=false)`;
47
- requestOptions.data = {
48
- coloringInformation: {
49
- ColorHex: FolderColorValues[args.options.color] || args.options.color
50
- }
51
- };
52
- }
53
- const folder = await request.post(requestOptions);
36
+ const folder = await this.addFolder(serverRelativeUrl, args.options, logger);
54
37
  await logger.log(folder);
55
38
  }
56
39
  catch (err) {
57
40
  this.handleRejectedODataJsonPromise(err);
58
41
  }
59
42
  }
43
+ async ensureParentFolderPath(options, parentFolderPath, logger) {
44
+ if (this.verbose) {
45
+ await logger.logToStderr(`Ensuring parent folders exist...`);
46
+ }
47
+ const parsedUrl = new URL(options.webUrl);
48
+ const absoluteFolderUrl = `${parsedUrl.origin}${parentFolderPath}`;
49
+ const relativeFolderPath = absoluteFolderUrl.replace(options.webUrl, '');
50
+ const parentFolders = relativeFolderPath.split('/').filter(folder => folder !== '');
51
+ for (let i = 1; i < parentFolders.length; i++) {
52
+ const currentFolderPath = parentFolders.slice(0, i + 1).join('/');
53
+ if (this.verbose) {
54
+ await logger.logToStderr(`Checking if folder '${currentFolderPath}' exists...`);
55
+ }
56
+ const folderExists = await this.getFolderExists(options.webUrl, currentFolderPath);
57
+ if (!folderExists) {
58
+ await this.addFolder(currentFolderPath, options, logger);
59
+ }
60
+ }
61
+ }
62
+ async getFolderExists(webUrl, folderServerRelativeUrl) {
63
+ const requestUrl = `${webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderServerRelativeUrl)}')?$select=Exists`;
64
+ const requestOptions = {
65
+ url: requestUrl,
66
+ headers: {
67
+ 'accept': 'application/json;odata=nometadata'
68
+ },
69
+ responseType: 'json'
70
+ };
71
+ const response = await request.get(requestOptions);
72
+ return response.Exists;
73
+ }
74
+ async addFolder(serverRelativeUrl, options, logger) {
75
+ if (this.verbose) {
76
+ const folderName = serverRelativeUrl.split('/').pop();
77
+ const folderLocation = serverRelativeUrl.split('/').slice(0, -1).join('/');
78
+ await logger.logToStderr(`Adding folder with name '${folderName}' at location '${folderLocation}'...`);
79
+ }
80
+ const requestOptions = {
81
+ headers: {
82
+ 'accept': 'application/json;odata=nometadata'
83
+ },
84
+ responseType: 'json'
85
+ };
86
+ if (options.color === undefined) {
87
+ requestOptions.url = `${options.webUrl}/_api/web/folders/addUsingPath(decodedUrl='${formatting.encodeQueryParameter(serverRelativeUrl)}')`;
88
+ }
89
+ else {
90
+ requestOptions.url = `${options.webUrl}/_api/foldercoloring/createfolder(DecodedUrl='${formatting.encodeQueryParameter(serverRelativeUrl)}', overwrite=false)`;
91
+ requestOptions.data = {
92
+ coloringInformation: {
93
+ ColorHex: FolderColorValues[options.color] || options.color
94
+ }
95
+ };
96
+ }
97
+ const response = await request.post(requestOptions);
98
+ return response;
99
+ }
60
100
  }
61
101
  _SpoFolderAddCommand_instances = new WeakSet(), _SpoFolderAddCommand_initTelemetry = function _SpoFolderAddCommand_initTelemetry() {
62
102
  this.telemetry.push((args) => {
63
103
  Object.assign(this.telemetryProperties, {
64
- color: typeof args.options.color !== 'undefined'
104
+ color: typeof args.options.color !== 'undefined',
105
+ ensureParentFolders: !!args.options.ensureParentFolders
65
106
  });
66
107
  });
67
108
  }, _SpoFolderAddCommand_initOptions = function _SpoFolderAddCommand_initOptions() {
@@ -74,6 +115,8 @@ _SpoFolderAddCommand_instances = new WeakSet(), _SpoFolderAddCommand_initTelemet
74
115
  }, {
75
116
  option: '--color [color]',
76
117
  autocomplete: Object.keys(FolderColorValues)
118
+ }, {
119
+ option: '--ensureParentFolders [ensureParentFolders]'
77
120
  });
78
121
  }, _SpoFolderAddCommand_initValidators = function _SpoFolderAddCommand_initValidators() {
79
122
  this.validators.push(async (args) => {
@@ -88,6 +131,7 @@ _SpoFolderAddCommand_instances = new WeakSet(), _SpoFolderAddCommand_initTelemet
88
131
  });
89
132
  }, _SpoFolderAddCommand_initTypes = function _SpoFolderAddCommand_initTypes() {
90
133
  this.types.string.push('webUrl', 'parentFolderUrl', 'name', 'color');
134
+ this.types.boolean.push('ensureParentFolders');
91
135
  };
92
136
  export default new SpoFolderAddCommand();
93
137
  //# sourceMappingURL=folder-add.js.map
@@ -0,0 +1,205 @@
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 eligibility list
6
+
7
+ Retrieves a list of eligible roles a user or group can be assigned to
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 entra pim role assignment eligibility list [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `--userId [userId]`
19
+ : Id of the user for which to list eligible roles. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, all eligible roles will be listed.
20
+
21
+ `--userName [userName]`
22
+ : UPN of the user for which to list eligible roles. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, all eligible roles will be listed.
23
+
24
+ `--groupId [groupId]`
25
+ : Id of the group for which to list eligible roles. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, all eligible roles will be listed.
26
+
27
+ `--groupName [groupName]`
28
+ : Display name of the group for which to list eligible roles. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, all eligible roles will be listed.
29
+
30
+ `--includePrincipalDetails`
31
+ : An optional flag to include details of the principals that were eligible for a role.
32
+ ```
33
+
34
+ <Global />
35
+
36
+ ## Examples
37
+
38
+ Get a list of eligible roles for any user.
39
+
40
+ ```sh
41
+ m365 entra pim role assignment eligibility list
42
+ ```
43
+
44
+ Get a list of eligible roles for the current user.
45
+
46
+ ```sh
47
+ m365 entra pim role assignment eligibility list --userId '@meID'
48
+ ```
49
+
50
+ Get a list of eligible roles for any user with principal details.
51
+
52
+ ```sh
53
+ m365 entra pim role assignment eligibility list --includePrincipalDetails
54
+ ```
55
+
56
+ ## Response
57
+
58
+ ### Standard response
59
+
60
+ <Tabs>
61
+ <TabItem value="JSON">
62
+
63
+ ```json
64
+ [
65
+ {
66
+ "id": "XrtkCdube02sKVjnlIYqQBht8lJR0U9DrhSkqDEisrI-1-e",
67
+ "principalId": "52f26d18-d151-434f-ae14-a4a83122b2b2",
68
+ "roleDefinitionId": "0964bb5e-9bdb-4d7b-ac29-58e794862a40",
69
+ "directoryScopeId": "/",
70
+ "appScopeId": null,
71
+ "startDateTime": "2024-04-08T10:14:01.153Z",
72
+ "endDateTime": null,
73
+ "memberType": "Direct",
74
+ "roleEligibilityScheduleId": "7a135e3d-5be5-403c-bdad-47ccbac434e3",
75
+ "roleDefinitionName": "displayName": "Search Administrator"
76
+ }
77
+ ]
78
+ ```
79
+
80
+ </TabItem>
81
+ <TabItem value="Text">
82
+
83
+ ```text
84
+ roleDefinitionId roleDefinitionName principalId
85
+ ------------------------------------ -------------------- ------------------------------------
86
+ 0964bb5e-9bdb-4d7b-ac29-58e794862a40 Search Administrator 52f26d18-d151-434f-ae14-a4a83122b2b2
87
+ 744ec460-397e-42ad-a462-8b3f9747a02c Knowledge Manager 61b0c52f-a902-4769-9a09-c6628335b00a
88
+ ```
89
+
90
+ </TabItem>
91
+ <TabItem value="CSV">
92
+
93
+ ```csv
94
+ id,principalId,roleDefinitionId,directoryScopeId,appScopeId,startDateTime,endDateTime,memberType,roleEligibilityScheduleId,roleDefinitionName
95
+ XrtkCdube02sKVjnlIYqQBht8lJR0U9DrhSkqDEisrI-1-e,52f26d18-d151-434f-ae14-a4a83122b2b2,0964bb5e-9bdb-4d7b-ac29-58e794862a40,/,,2024-04-08T10:14:01.153Z,,Direct,7a135e3d-5be5-403c-bdad-47ccbac434e3,Search Administrator
96
+ YMROdH45rUKkYos_l0egLC_FsGECqWlHmgnGYoM1sAo-1-e,61b0c52f-a902-4769-9a09-c6628335b00a,744ec460-397e-42ad-a462-8b3f9747a02c,/,,2024-04-08T10:13:04.913Z,2025-04-08T10:12:36.9Z,Direct,0606b8a1-ba92-42b7-804c-8e32dfdec2b8,Knowledge Manager
97
+ ```
98
+
99
+ </TabItem>
100
+ <TabItem value="Markdown">
101
+
102
+ ```md
103
+ # entra pim role assignment eligibility list
104
+
105
+ Date: 4/8/2024
106
+
107
+ ## XrtkCdube02sKVjnlIYqQBht8lJR0U9DrhSkqDEisrI-1-e
108
+
109
+ Property | Value
110
+ ---------|-------
111
+ id | XrtkCdube02sKVjnlIYqQBht8lJR0U9DrhSkqDEisrI-1-e
112
+ principalId | 52f26d18-d151-434f-ae14-a4a83122b2b2
113
+ roleDefinitionId | 0964bb5e-9bdb-4d7b-ac29-58e794862a40
114
+ directoryScopeId | /
115
+ startDateTime | 2024-04-08T10:14:01.153Z
116
+ memberType | Direct
117
+ roleEligibilityScheduleId | 7a135e3d-5be5-403c-bdad-47ccbac434e3
118
+ roleDefinitionName | Search Administrator
119
+ ```
120
+
121
+ </TabItem>
122
+ </Tabs>
123
+
124
+ ### `includePrincipalDetails` response
125
+
126
+ When we make use of the option `includePrincipalDetails` the response will differ.
127
+
128
+ <Tabs>
129
+ <TabItem value="JSON">
130
+
131
+ ```json
132
+ [
133
+ {
134
+ "id": "XrtkCdube02sKVjnlIYqQBht8lJR0U9DrhSkqDEisrI-1-e",
135
+ "principalId": "52f26d18-d151-434f-ae14-a4a83122b2b2",
136
+ "roleDefinitionId": "0964bb5e-9bdb-4d7b-ac29-58e794862a40",
137
+ "directoryScopeId": "/",
138
+ "appScopeId": null,
139
+ "startDateTime": "2024-04-08T10:14:01.153Z",
140
+ "endDateTime": null,
141
+ "memberType": "Direct",
142
+ "roleEligibilityScheduleId": "7a135e3d-5be5-403c-bdad-47ccbac434e3",
143
+ "roleDefinitionName": "Search Administrator",
144
+ "principal": {
145
+ "id": "52f26d18-d151-434f-ae14-a4a83122b2b2",
146
+ "displayName": "Alex Wilber",
147
+ "userPrincipalName": "AlexW@contoso.onmicrosoft.com",
148
+ "mail": "AlexW@contoso.onmicrosoft.com",
149
+ "businessPhones": [
150
+ "+1 858 555 0110"
151
+ ],
152
+ "givenName": "Alex",
153
+ "jobTitle": "Marketing Assistant",
154
+ "mobilePhone": null,
155
+ "officeLocation": "131/1104",
156
+ "preferredLanguage": "en-US",
157
+ "surname": "Wilber"
158
+ }
159
+ }
160
+ ]
161
+ ```
162
+
163
+ </TabItem>
164
+ <TabItem value="Text">
165
+
166
+ ```text
167
+ roleDefinitionId roleDefinitionName principalId
168
+ ------------------------------------ -------------------- ------------------------------------
169
+ 0964bb5e-9bdb-4d7b-ac29-58e794862a40 Search Administrator 52f26d18-d151-434f-ae14-a4a83122b2b2
170
+ 744ec460-397e-42ad-a462-8b3f9747a02c Knowledge Manager 61b0c52f-a902-4769-9a09-c6628335b00a
171
+ ```
172
+
173
+ </TabItem>
174
+ <TabItem value="CSV">
175
+
176
+ ```csv
177
+ id,principalId,roleDefinitionId,directoryScopeId,appScopeId,startDateTime,endDateTime,memberType,roleEligibilityScheduleId,roleDefinitionName
178
+ XrtkCdube02sKVjnlIYqQBht8lJR0U9DrhSkqDEisrI-1-e,52f26d18-d151-434f-ae14-a4a83122b2b2,0964bb5e-9bdb-4d7b-ac29-58e794862a40,/,,2024-04-08T10:14:01.153Z,,Direct,7a135e3d-5be5-403c-bdad-47ccbac434e3,Search Administrator
179
+ YMROdH45rUKkYos_l0egLC_FsGECqWlHmgnGYoM1sAo-1-e,61b0c52f-a902-4769-9a09-c6628335b00a,744ec460-397e-42ad-a462-8b3f9747a02c,/,,2024-04-08T10:13:04.913Z,2025-04-08T10:12:36.9Z,Direct,0606b8a1-ba92-42b7-804c-8e32dfdec2b8,Knowledge Manager
180
+ ```
181
+
182
+ </TabItem>
183
+ <TabItem value="Markdown">
184
+
185
+ ```md
186
+ # entra pim role assignment eligibility list --includePrincipalDetails "true"
187
+
188
+ Date: 4/8/2024
189
+
190
+ ## XrtkCdube02sKVjnlIYqQBht8lJR0U9DrhSkqDEisrI-1-e
191
+
192
+ Property | Value
193
+ ---------|-------
194
+ id | XrtkCdube02sKVjnlIYqQBht8lJR0U9DrhSkqDEisrI-1-e
195
+ principalId | 52f26d18-d151-434f-ae14-a4a83122b2b2
196
+ roleDefinitionId | 0964bb5e-9bdb-4d7b-ac29-58e794862a40
197
+ directoryScopeId | /
198
+ startDateTime | 2024-04-08T10:14:01.153Z
199
+ memberType | Direct
200
+ roleEligibilityScheduleId | 7a135e3d-5be5-403c-bdad-47ccbac434e3
201
+ roleDefinitionName | Search Administrator
202
+ ```
203
+
204
+ </TabItem>
205
+ </Tabs>