@pnp/cli-microsoft365 7.4.0-beta.5c123d7 → 7.4.0-beta.ac45e93

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/dist/Auth.js CHANGED
@@ -262,7 +262,8 @@ export class Auth {
262
262
  },
263
263
  piiLoggingEnabled: false,
264
264
  logLevel: debug ? LogLevel.Verbose : LogLevel.Error
265
- }
265
+ },
266
+ proxyUrl: process.env.HTTP_PROXY || process.env.HTTPS_PROXY
266
267
  }
267
268
  };
268
269
  }
@@ -24,6 +24,8 @@ appInsightsClient.commonProperties = {
24
24
  env: env,
25
25
  ci: Boolean(process.env.CI).toString()
26
26
  };
27
+ appInsightsClient.config.proxyHttpUrl = process.env.HTTP_PROXY ?? '';
28
+ appInsightsClient.config.proxyHttpsUrl = process.env.HTTPS_PROXY ?? '';
27
29
  appInsightsClient.context.tags['ai.cloud.roleInstance'] = crypto.createHash('sha256').update(appInsightsClient.context.tags['ai.cloud.roleInstance']).digest('hex');
28
30
  delete appInsightsClient.context.tags['ai.cloud.role'];
29
31
  delete appInsightsClient.context.tags['ai.cloud.roleName'];
@@ -7,6 +7,7 @@ export default {
7
7
  ADMINISTRATIVEUNIT_MEMBER_ADD: `${prefix} administrativeunit member add`,
8
8
  ADMINISTRATIVEUNIT_MEMBER_GET: `${prefix} administrativeunit member get`,
9
9
  ADMINISTRATIVEUNIT_MEMBER_LIST: `${prefix} administrativeunit member list`,
10
+ ADMINISTRATIVEUNIT_ROLEASSIGNMENT_ADD: `${prefix} administrativeunit roleassignment add`,
10
11
  APP_ADD: `${prefix} app add`,
11
12
  APP_GET: `${prefix} app get`,
12
13
  APP_LIST: `${prefix} app list`,
@@ -0,0 +1,102 @@
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 _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, _EntraAdministrativeUnitRoleAssignmentAddCommand_initTelemetry, _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptions, _EntraAdministrativeUnitRoleAssignmentAddCommand_initValidators, _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptionSets;
7
+ import { aadAdministrativeUnit } from '../../../../utils/aadAdministrativeUnit.js';
8
+ import { aadUser } from '../../../../utils/aadUser.js';
9
+ import { roleAssignment } from '../../../../utils/roleAssignment.js';
10
+ import { roleDefinition } from '../../../../utils/roleDefinition.js';
11
+ import { validation } from '../../../../utils/validation.js';
12
+ import GraphCommand from '../../../base/GraphCommand.js';
13
+ import commands from '../../commands.js';
14
+ class EntraAdministrativeUnitRoleAssignmentAddCommand extends GraphCommand {
15
+ get name() {
16
+ return commands.ADMINISTRATIVEUNIT_ROLEASSIGNMENT_ADD;
17
+ }
18
+ get description() {
19
+ return 'Assigns a Microsoft Entra role with administrative unit scope to a user';
20
+ }
21
+ constructor() {
22
+ super();
23
+ _EntraAdministrativeUnitRoleAssignmentAddCommand_instances.add(this);
24
+ __classPrivateFieldGet(this, _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, "m", _EntraAdministrativeUnitRoleAssignmentAddCommand_initTelemetry).call(this);
25
+ __classPrivateFieldGet(this, _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, "m", _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptions).call(this);
26
+ __classPrivateFieldGet(this, _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, "m", _EntraAdministrativeUnitRoleAssignmentAddCommand_initValidators).call(this);
27
+ __classPrivateFieldGet(this, _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, "m", _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptionSets).call(this);
28
+ }
29
+ async commandAction(logger, args) {
30
+ try {
31
+ let { administrativeUnitId, roleDefinitionId, userId } = args.options;
32
+ if (args.options.administrativeUnitName) {
33
+ if (this.verbose) {
34
+ await logger.logToStderr(`Retrieving administrative unit by its name '${args.options.administrativeUnitName}'`);
35
+ }
36
+ administrativeUnitId = (await aadAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.administrativeUnitName)).id;
37
+ }
38
+ if (args.options.roleDefinitionName) {
39
+ if (this.verbose) {
40
+ await logger.logToStderr(`Retrieving role definition by its name '${args.options.roleDefinitionName}'`);
41
+ }
42
+ roleDefinitionId = (await roleDefinition.getRoleDefinitionByDisplayName(args.options.roleDefinitionName)).id;
43
+ }
44
+ if (args.options.userName) {
45
+ if (this.verbose) {
46
+ await logger.logToStderr(`Retrieving user by UPN '${args.options.userName}'`);
47
+ }
48
+ userId = await aadUser.getUserIdByUpn(args.options.userName);
49
+ }
50
+ const unifiedRoleAssignment = await roleAssignment.createRoleAssignmentWithAdministrativeUnitScope(roleDefinitionId, userId, administrativeUnitId);
51
+ await logger.log(unifiedRoleAssignment);
52
+ }
53
+ catch (err) {
54
+ this.handleRejectedODataJsonPromise(err);
55
+ }
56
+ }
57
+ }
58
+ _EntraAdministrativeUnitRoleAssignmentAddCommand_instances = new WeakSet(), _EntraAdministrativeUnitRoleAssignmentAddCommand_initTelemetry = function _EntraAdministrativeUnitRoleAssignmentAddCommand_initTelemetry() {
59
+ this.telemetry.push((args) => {
60
+ Object.assign(this.telemetryProperties, {
61
+ administrativeUnitId: typeof args.options.administrativeUnitId !== 'undefined',
62
+ administrativeUnitName: typeof args.options.administrativeUnitName !== 'undefined',
63
+ roleDefinitionId: typeof args.options.roleDefinitionId !== 'undefined',
64
+ roleDefinitionName: typeof args.options.roleDefinitionName !== 'undefined',
65
+ userId: typeof args.options.userId !== 'undefined',
66
+ userName: typeof args.options.userName !== 'undefined'
67
+ });
68
+ });
69
+ }, _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptions = function _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptions() {
70
+ this.options.unshift({
71
+ option: '-i, --administrativeUnitId [administrativeUnitId]'
72
+ }, {
73
+ option: '-n, --administrativeUnitName [administrativeUnitName]'
74
+ }, {
75
+ option: '--roleDefinitionId [roleDefinitionId]'
76
+ }, {
77
+ option: '--roleDefinitionName [roleDefinitionName]'
78
+ }, {
79
+ option: '--userId [userId]'
80
+ }, {
81
+ option: '--userName [userName]'
82
+ });
83
+ }, _EntraAdministrativeUnitRoleAssignmentAddCommand_initValidators = function _EntraAdministrativeUnitRoleAssignmentAddCommand_initValidators() {
84
+ this.validators.push(async (args) => {
85
+ if (args.options.administrativeUnitId && !validation.isValidGuid(args.options.administrativeUnitId)) {
86
+ return `${args.options.administrativeUnitId} is not a valid GUID`;
87
+ }
88
+ if (args.options.roleDefinitionId && !validation.isValidGuid(args.options.roleDefinitionId)) {
89
+ return `${args.options.roleDefinitionId} is not a valid GUID`;
90
+ }
91
+ if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
92
+ return `${args.options.userId} is not a valid GUID`;
93
+ }
94
+ return true;
95
+ });
96
+ }, _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptionSets = function _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptionSets() {
97
+ this.optionSets.push({ options: ['administrativeUnitId', 'administrativeUnitName'] });
98
+ this.optionSets.push({ options: ['roleDefinitionId', 'roleDefinitionName'] });
99
+ this.optionSets.push({ options: ['userId', 'userName'] });
100
+ };
101
+ export default new EntraAdministrativeUnitRoleAssignmentAddCommand();
102
+ //# sourceMappingURL=administrativeunit-roleassignment-add.js.map
@@ -7,6 +7,7 @@ export default {
7
7
  ADMINISTRATIVEUNIT_MEMBER_ADD: `${prefix} administrativeunit member add`,
8
8
  ADMINISTRATIVEUNIT_MEMBER_GET: `${prefix} administrativeunit member get`,
9
9
  ADMINISTRATIVEUNIT_MEMBER_LIST: `${prefix} administrativeunit member list`,
10
+ ADMINISTRATIVEUNIT_ROLEASSIGNMENT_ADD: `${prefix} administrativeunit roleassignment add`,
10
11
  APP_ADD: `${prefix} app add`,
11
12
  APP_GET: `${prefix} app get`,
12
13
  APP_LIST: `${prefix} app list`,
@@ -0,0 +1,69 @@
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 _ExternalConnectionUrlToItemResolverAddCommand_instances, _ExternalConnectionUrlToItemResolverAddCommand_initOptions;
7
+ import request from '../../../../request.js';
8
+ import GraphCommand from '../../../base/GraphCommand.js';
9
+ import commands from '../../commands.js';
10
+ class ExternalConnectionUrlToItemResolverAddCommand extends GraphCommand {
11
+ get name() {
12
+ return commands.CONNECTION_URLTOITEMRESOLVER_ADD;
13
+ }
14
+ get description() {
15
+ return 'Adds a URL to item resolver to an external connection';
16
+ }
17
+ constructor() {
18
+ super();
19
+ _ExternalConnectionUrlToItemResolverAddCommand_instances.add(this);
20
+ __classPrivateFieldGet(this, _ExternalConnectionUrlToItemResolverAddCommand_instances, "m", _ExternalConnectionUrlToItemResolverAddCommand_initOptions).call(this);
21
+ }
22
+ async commandAction(logger, args) {
23
+ const baseUrls = args.options.baseUrls.split(',').map(b => b.trim());
24
+ const itemIdResolver = {
25
+ itemId: args.options.itemId,
26
+ priority: args.options.priority,
27
+ urlMatchInfo: {
28
+ baseUrls: baseUrls,
29
+ urlPattern: args.options.urlPattern
30
+ }
31
+ };
32
+ // not a part of the type definition, but required by the API
33
+ itemIdResolver['@odata.type'] = '#microsoft.graph.externalConnectors.itemIdResolver';
34
+ const requestOptions = {
35
+ url: `${this.resource}/v1.0/external/connections/${args.options.externalConnectionId}`,
36
+ headers: {
37
+ accept: 'application/json;odata.metadata=none',
38
+ 'content-type': 'application/json'
39
+ },
40
+ responseType: 'json',
41
+ data: {
42
+ activitySettings: {
43
+ urlToItemResolvers: [itemIdResolver]
44
+ }
45
+ }
46
+ };
47
+ try {
48
+ await request.patch(requestOptions);
49
+ }
50
+ catch (err) {
51
+ this.handleRejectedODataJsonPromise(err);
52
+ }
53
+ }
54
+ }
55
+ _ExternalConnectionUrlToItemResolverAddCommand_instances = new WeakSet(), _ExternalConnectionUrlToItemResolverAddCommand_initOptions = function _ExternalConnectionUrlToItemResolverAddCommand_initOptions() {
56
+ this.options.unshift({
57
+ option: '-c, --externalConnectionId <externalConnectionId>'
58
+ }, {
59
+ option: '--baseUrls <baseUrls>'
60
+ }, {
61
+ option: '--urlPattern <urlPattern>'
62
+ }, {
63
+ option: '-i, --itemId <itemId>'
64
+ }, {
65
+ option: '-p, --priority <priority>'
66
+ });
67
+ };
68
+ export default new ExternalConnectionUrlToItemResolverAddCommand();
69
+ //# sourceMappingURL=connection-urltoitemresolver-add.js.map
@@ -7,6 +7,7 @@ export default {
7
7
  CONNECTION_LIST: `${prefix} connection list`,
8
8
  CONNECTION_REMOVE: `${prefix} connection remove`,
9
9
  CONNECTION_SCHEMA_ADD: `${prefix} connection schema add`,
10
+ CONNECTION_URLTOITEMRESOLVER_ADD: `${prefix} connection urltoitemresolver add`,
10
11
  EXTERNALCONNECTION_ADD: `${searchPrefix} externalconnection add`,
11
12
  EXTERNALCONNECTION_GET: `${searchPrefix} externalconnection get`,
12
13
  EXTERNALCONNECTION_LIST: `${searchPrefix} externalconnection list`,
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _TeamsUserAppAddCommand_instances, _TeamsUserAppAddCommand_initTelemetry, _TeamsUserAppAddCommand_initOptions, _TeamsUserAppAddCommand_initValidators, _TeamsUserAppAddCommand_initOptionSets;
7
+ import { cli } from '../../../../cli/cli.js';
7
8
  import request from '../../../../request.js';
8
9
  import { formatting } from '../../../../utils/formatting.js';
9
10
  import { validation } from '../../../../utils/validation.js';
@@ -25,8 +26,12 @@ class TeamsUserAppAddCommand extends GraphCommand {
25
26
  __classPrivateFieldGet(this, _TeamsUserAppAddCommand_instances, "m", _TeamsUserAppAddCommand_initOptionSets).call(this);
26
27
  }
27
28
  async commandAction(logger, args) {
29
+ const appId = await this.getAppId(args);
28
30
  const userId = (args.options.userId ?? args.options.userName);
29
31
  const endpoint = `${this.resource}/v1.0`;
32
+ if (this.verbose) {
33
+ await logger.logToStderr(`Removing app with ID ${appId} for user ${args.options.userId}`);
34
+ }
30
35
  const requestOptions = {
31
36
  url: `${endpoint}/users/${formatting.encodeQueryParameter(userId)}/teamwork/installedApps`,
32
37
  headers: {
@@ -35,7 +40,7 @@ class TeamsUserAppAddCommand extends GraphCommand {
35
40
  },
36
41
  responseType: 'json',
37
42
  data: {
38
- 'teamsApp@odata.bind': `${endpoint}/appCatalogs/teamsApps/${args.options.id}`
43
+ 'teamsApp@odata.bind': `${endpoint}/appCatalogs/teamsApps/${appId}`
39
44
  }
40
45
  };
41
46
  try {
@@ -45,17 +50,43 @@ class TeamsUserAppAddCommand extends GraphCommand {
45
50
  this.handleRejectedODataJsonPromise(err);
46
51
  }
47
52
  }
53
+ async getAppId(args) {
54
+ if (args.options.id) {
55
+ return args.options.id;
56
+ }
57
+ const requestOptions = {
58
+ url: `${this.resource}/v1.0/appCatalogs/teamsApps?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.name)}'`,
59
+ headers: {
60
+ accept: 'application/json;odata.metadata=none'
61
+ },
62
+ responseType: 'json'
63
+ };
64
+ const response = await request.get(requestOptions);
65
+ if (response.value.length === 1) {
66
+ return response.value[0].id;
67
+ }
68
+ if (response.value.length === 0) {
69
+ throw `The specified Teams app does not exist`;
70
+ }
71
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
72
+ const result = (await cli.handleMultipleResultsFound(`Multiple Teams apps with name '${args.options.name}' found.`, resultAsKeyValuePair));
73
+ return result.id;
74
+ }
48
75
  }
49
76
  _TeamsUserAppAddCommand_instances = new WeakSet(), _TeamsUserAppAddCommand_initTelemetry = function _TeamsUserAppAddCommand_initTelemetry() {
50
77
  this.telemetry.push((args) => {
51
78
  Object.assign(this.telemetryProperties, {
79
+ id: typeof args.options.id !== 'undefined',
80
+ name: typeof args.options.name !== 'undefined',
52
81
  userId: typeof args.options.userId !== 'undefined',
53
82
  userName: typeof args.options.userName !== 'undefined'
54
83
  });
55
84
  });
56
85
  }, _TeamsUserAppAddCommand_initOptions = function _TeamsUserAppAddCommand_initOptions() {
57
86
  this.options.unshift({
58
- option: '--id <id>'
87
+ option: '--id [id]'
88
+ }, {
89
+ option: '--name [name]'
59
90
  }, {
60
91
  option: '--userId [userId]'
61
92
  }, {
@@ -63,7 +94,7 @@ _TeamsUserAppAddCommand_instances = new WeakSet(), _TeamsUserAppAddCommand_initT
63
94
  });
64
95
  }, _TeamsUserAppAddCommand_initValidators = function _TeamsUserAppAddCommand_initValidators() {
65
96
  this.validators.push(async (args) => {
66
- if (!validation.isValidGuid(args.options.id)) {
97
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
67
98
  return `${args.options.id} is not a valid GUID`;
68
99
  }
69
100
  if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
@@ -75,6 +106,7 @@ _TeamsUserAppAddCommand_instances = new WeakSet(), _TeamsUserAppAddCommand_initT
75
106
  return true;
76
107
  });
77
108
  }, _TeamsUserAppAddCommand_initOptionSets = function _TeamsUserAppAddCommand_initOptionSets() {
109
+ this.optionSets.push({ options: ['id', 'name'] });
78
110
  this.optionSets.push({ options: ['userId', 'userName'] });
79
111
  };
80
112
  export default new TeamsUserAppAddCommand();
package/dist/request.js CHANGED
@@ -154,6 +154,10 @@ class Request {
154
154
  options.headers.authorization = `Bearer ${accessToken}`;
155
155
  }
156
156
  }
157
+ const proxyUrl = process.env.HTTP_PROXY || process.env.HTTPS_PROXY;
158
+ if (proxyUrl) {
159
+ options.proxy = this.createProxyConfigFromUrl(proxyUrl);
160
+ }
157
161
  return this.req(options);
158
162
  })
159
163
  .then((res) => {
@@ -199,6 +203,18 @@ class Request {
199
203
  const cloudUrl = Auth.getEndpointForResource(hostname, cloudType);
200
204
  options.url = options.url.replace(hostname, cloudUrl);
201
205
  }
206
+ createProxyConfigFromUrl(url) {
207
+ const parsedUrl = new URL(url);
208
+ const port = parsedUrl.port || (url.toLowerCase().startsWith('https') ? 443 : 80);
209
+ let authObject = null;
210
+ if (parsedUrl.username && parsedUrl.password) {
211
+ authObject = {
212
+ username: parsedUrl.username,
213
+ password: parsedUrl.password
214
+ };
215
+ }
216
+ return { host: parsedUrl.hostname, port: Number(port), protocol: 'http', ...(authObject && { auth: authObject }) };
217
+ }
202
218
  }
203
219
  export default new Request();
204
220
  //# sourceMappingURL=request.js.map
@@ -0,0 +1,42 @@
1
+ import request from '../request.js';
2
+ const getRequestOptions = (roleDefinitionId, principalId, directoryScopeId) => ({
3
+ url: `https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments`,
4
+ headers: {
5
+ accept: 'application/json;odata.metadata=none'
6
+ },
7
+ responseType: 'json',
8
+ data: {
9
+ roleDefinitionId: roleDefinitionId,
10
+ principalId: principalId,
11
+ directoryScopeId: directoryScopeId
12
+ }
13
+ });
14
+ /**
15
+ * Utils for RBAC.
16
+ * Supported RBAC providers:
17
+ * - Directory (Entra ID)
18
+ */
19
+ export const roleAssignment = {
20
+ /**
21
+ * Assigns a specific role to a principal with scope to an administrative unit
22
+ * @param roleDefinitionId Role which lists the actions that can be performed
23
+ * @param principalId Object that represents a user, group, service principal, or managed identity that is requesting access to resources
24
+ * @param administrativeUnitId Administrative unit which represents a current scope for a role assignment
25
+ * @returns Returns unified role assignment object that represents a role definition assigned to a principal with scope to an administrative unit
26
+ */
27
+ async createRoleAssignmentWithAdministrativeUnitScope(roleDefinitionId, principalId, administrativeUnitId) {
28
+ const requestOptions = getRequestOptions(roleDefinitionId, principalId, `/administrativeUnits/${administrativeUnitId}`);
29
+ return await request.post(requestOptions);
30
+ },
31
+ /**
32
+ * Assigns a specific role to a principal with scope to the whole tenant
33
+ * @param roleDefinitionId Role which lists the actions that can be performed
34
+ * @param principalId Object that represents a user, group, service principal, or managed identity that is requesting access to resources
35
+ * @returns Returns unified role assignment object that represents a role definition assigned to a principal with scope to the whole tenant
36
+ */
37
+ async createRoleAssignmentWithTenantScope(roleDefinitionId, principalId) {
38
+ const requestOptions = getRequestOptions(roleDefinitionId, principalId, '/');
39
+ return await request.post(requestOptions);
40
+ }
41
+ };
42
+ //# sourceMappingURL=roleAssignment.js.map
@@ -0,0 +1,24 @@
1
+ import { cli } from '../cli/cli.js';
2
+ import { formatting } from './formatting.js';
3
+ import { odata } from './odata.js';
4
+ export const roleDefinition = {
5
+ /**
6
+ * Get a directory (Microsoft Entra) role
7
+ * @param displayName Role definition display name.
8
+ * @returns The role definition.
9
+ * @throws Error when role definition was not found.
10
+ */
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
+ if (roleDefinitions.length === 0) {
14
+ throw `The specified role definition '${displayName}' does not exist.`;
15
+ }
16
+ if (roleDefinitions.length > 1) {
17
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', roleDefinitions);
18
+ const selectedRoleDefinition = await cli.handleMultipleResultsFound(`Multiple role definitions with name '${displayName}' found.`, resultAsKeyValuePair);
19
+ return selectedRoleDefinition;
20
+ }
21
+ return roleDefinitions[0];
22
+ }
23
+ };
24
+ //# sourceMappingURL=roleDefinition.js.map
@@ -0,0 +1,116 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # entra administrativeunit roleassignment add
6
+
7
+ Assigns a Microsoft Entra role with administrative unit scope to a user
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 entra administrativeunit roleassignment add [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-i, --administrativeUnitId [administrativeUnitId]`
19
+ : The id of the administrative unit. Specify either `administrativeUnitId` or `administrativeUnitName`.
20
+
21
+ `-n, --administrativeUnitName [administrativeUnitName]`
22
+ : The name of the administrative unit. Specify either `administrativeUnitId` or `administrativeUnitName`.
23
+
24
+ `--roleDefinitionId [roleDefinitionId]`
25
+ : The id of the role definition that the member is in. Specify either `roleDefinitionId` or `roleDefinitionName`.
26
+
27
+ `--roleDefinitionName [roleDefinitionName]`
28
+ : The name of the role definition that the member is in. Specify either `roleDefinitionId` or `roleDefinitionName`.
29
+
30
+ `--userId [userId]`
31
+ : The id of the user that is a member of the scoped role. Specify either `userId` or `userName`.
32
+
33
+ `--userName [userName]`
34
+ : The name of the user that is a member of the scoped role. Specify either `userId` or `userName`.
35
+ ```
36
+
37
+ <Global />
38
+
39
+ ## Remarks
40
+
41
+ :::info
42
+
43
+ To use this command you must be either **Global Administrator** or **Privileged Role Administrator**.
44
+
45
+ :::
46
+
47
+ ## Examples
48
+
49
+ Assign a role definition specified by id to a user specified by id for an administrative unit specified by id
50
+
51
+ ```sh
52
+ m365 entra administrativeunit roleassignment add --administrativeUnitId 81bb36e4-f4c6-4984-8e56-d4f8feae9e09 --roleDefinitionId 4d6ac14f-3453-41d0-bef9-a3e0c569773a --userId 5f91f951-7305-4a27-9b63-7b00906de09f
53
+ ```
54
+
55
+ Assign a role definition specified by name to a user specified by name for an administrative unit specified by name
56
+
57
+ ```sh
58
+ m365 entra administrativeunit roleassignment add --administrativeUnitName 'Marketing Division' --roleDefinitionName 'License Administrator' --userName 'john.doe@contoso.com'
59
+ ```
60
+
61
+ ## Response
62
+
63
+ <Tabs>
64
+ <TabItem value="JSON">
65
+
66
+ ```json
67
+ {
68
+ "id": "5wuT_mJe20eRr5jDpJo4sVH5kV8FcydKm2N7AJBt4J_kNruBxvSESY5W1Pj-rp4J-2",
69
+ "principalId": "5f91f951-7305-4a27-9b63-7b00906de09f",
70
+ "directoryScopeId": "/administrativeUnits/81bb36e4-f4c6-4984-8e56-d4f8feae9e09",
71
+ "roleDefinitionId": "4d6ac14f-3453-41d0-bef9-a3e0c569773a"
72
+ }
73
+ ```
74
+
75
+ </TabItem>
76
+ <TabItem value="Text">
77
+
78
+ ```text
79
+ directoryScopeId: /administrativeUnits/81bb36e4-f4c6-4984-8e56-d4f8feae9e09
80
+ id : 4yeYchSc90m7G5YI8Va7uFH5kV8FcydKm2N7AJBt4J_kNruBxvSESY5W1Pj-rp4J-2
81
+ principalId : 5f91f951-7305-4a27-9b63-7b00906de09f
82
+ roleDefinitionId: 4d6ac14f-3453-41d0-bef9-a3e0c569773a
83
+ ```
84
+
85
+ </TabItem>
86
+ <TabItem value="CSV">
87
+
88
+ ```csv
89
+ id,principalId,directoryScopeId,roleDefinitionId
90
+ UB-K8uf2cUWBi2oS8q9rbFH5kV8FcydKm2N7AJBt4J_kNruBxvSESY5W1Pj-rp4J-2,5f91f951-7305-4a27-9b63-7b00906de09f,/administrativeUnits/81bb36e4-f4c6-4984-8e56-d4f8feae9e09,4d6ac14f-3453-41d0-bef9-a3e0c569773a
91
+ ```
92
+
93
+ </TabItem>
94
+ <TabItem value="Markdown">
95
+
96
+ ```md
97
+ # entra administrativeunit roleassignment add --administrativeUnitId "81bb36e4-f4c6-4984-8e56-d4f8feae9e09" --roleDefinitionId "4d6ac14f-3453-41d0-bef9-a3e0c569773a" --userId "5f91f951-7305-4a27-9b63-7b00906de09f"
98
+
99
+ Date: 11/16/2023
100
+
101
+ ## T8FqTVM00EG--aPgxWl3OlH5kV8FcydKm2N7AJBt4J_kNruBxvSESY5W1Pj-rp4J-2
102
+
103
+ Property | Value
104
+ ---------|-------
105
+ id | T8FqTVM00EG--aPgxWl3OlH5kV8FcydKm2N7AJBt4J\_kNruBxvSESY5W1Pj-rp4J-2
106
+ principalId | 5f91f951-7305-4a27-9b63-7b00906de09f
107
+ directoryScopeId | /administrativeUnits/81bb36e4-f4c6-4984-8e56-d4f8feae9e09
108
+ roleDefinitionId | 4d6ac14f-3453-41d0-bef9-a3e0c569773a
109
+ ```
110
+
111
+ </TabItem>
112
+ </Tabs>
113
+
114
+ ## More information
115
+
116
+ - [Roles with administrative unit scope](https://learn.microsoft.com/entra/identity/role-based-access-control/admin-units-assign-roles#roles-that-can-be-assigned-with-administrative-unit-scope)
@@ -0,0 +1,47 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+
3
+ # external connection urltoitemresolver add
4
+
5
+ Adds a URL to item resolver to an external connection
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ m365 external connection urltoitemresolver add [options]
11
+ ```
12
+
13
+ ## Options
14
+
15
+ ```md definition-list
16
+ `-c, --externalConnectionId <externalConnectionId>`
17
+ : The ID of the external connection to which to add the resolver
18
+
19
+ `--baseUrls <baseUrls>`
20
+ : Comma-separated list of base URLs
21
+
22
+ `--urlPattern <urlPattern>`
23
+ : Regex pattern to match URLs
24
+
25
+ `-i, --itemId <itemId>`
26
+ : Pattern that matches captured matches from the URL with the external item ID
27
+
28
+ `-p, --priority <priority>`
29
+ : Integer that defines the resolution order
30
+ ```
31
+ <Global />
32
+
33
+ ## Examples
34
+
35
+ Adds a URL to item resolver to an existing connection
36
+
37
+ ```sh
38
+ m365 external connection urltoitemresolver add --externalConnectionId "samplesolutiongallery" --baseUrls "https://adoption.microsoft.com" --urlPattern "/sample-solution-gallery/sample/(?<sampleId>[^/]+)" --itemId "{sampleId}" --priority 1
39
+ ```
40
+
41
+ ## Response
42
+
43
+ The command won't return a response on success.
44
+
45
+ ## More information
46
+
47
+ - Microsoft Graph external connection activitySettings: [https://learn.microsoft.com/graph/api/resources/externalconnectors-activitysettings?view=graph-rest-1.0](https://learn.microsoft.com/graph/api/resources/externalconnectors-activitysettings?view=graph-rest-1.0)
@@ -13,8 +13,11 @@ m365 teams user app add [options]
13
13
  ## Options
14
14
 
15
15
  ```md definition-list
16
- `--id <id>`
17
- : The ID of the app to install.
16
+ `--id [id]`
17
+ : The ID of the app to install. Specify either `id` or `name` but not both.
18
+
19
+ `--name [name]`
20
+ : Name of the app to install. Specify either `id` or `name` but not both.
18
21
 
19
22
  `--userId [userId]`
20
23
  : The ID of the user to install the app for. Specify either `userId` or `userName` but not both.
@@ -31,16 +34,16 @@ The `id` has to be the ID of the app from the Microsoft Teams App Catalog. Do no
31
34
 
32
35
  ## Examples
33
36
 
34
- Install an app from the catalog for the specified user by id.
37
+ Install an app by id from the catalog for the specified user by id.
35
38
 
36
39
  ```sh
37
40
  m365 teams user app add --id 4440558e-8c73-4597-abc7-3644a64c4bce --userId 2609af39-7775-4f94-a3dc-0dd67657e900
38
41
  ```
39
42
 
40
- Install an app from the catalog for the specified user by name.
43
+ Install an app by name from the catalog for the specified user by name.
41
44
 
42
45
  ```sh
43
- m365 teams user app add --id 4440558e-8c73-4597-abc7-3644a64c4bce --userName admin@contoso.com
46
+ m365 teams user app add --name HelloWorld --userName admin@contoso.com
44
47
  ```
45
48
 
46
49
  ## Response
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "7.4.0-beta.5c123d7",
3
+ "version": "7.4.0-beta.ac45e93",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",