@pnp/cli-microsoft365 10.1.0-beta.deac605 → 10.1.0
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/m365/base/AppCommand.js +5 -2
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +18 -4
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +34 -2
- package/dist/m365/entra/commands/app/app-get.js +17 -5
- package/dist/m365/entra/commands/app/app-list.js +34 -2
- package/dist/m365/entra/commands/group/group-get.js +6 -3
- package/dist/m365/entra/commands/group/group-list.js +16 -1
- package/dist/utils/entraAdministrativeUnit.js +14 -2
- package/dist/utils/entraGroup.js +31 -6
- package/docs/docs/cmd/entra/administrativeunit/administrativeunit-get.mdx +10 -3
- package/docs/docs/cmd/entra/administrativeunit/administrativeunit-list.mdx +16 -1
- package/docs/docs/cmd/entra/app/app-get.mdx +13 -8
- package/docs/docs/cmd/entra/app/app-list.mdx +16 -1
- package/docs/docs/cmd/entra/group/group-get.mdx +10 -3
- package/docs/docs/cmd/entra/group/group-list.mdx +9 -2
- package/package.json +2 -2
|
@@ -53,9 +53,12 @@ class AppCommand extends Command {
|
|
|
53
53
|
return super.action(logger, args);
|
|
54
54
|
}
|
|
55
55
|
if (this.m365rcJson.apps.length > 1) {
|
|
56
|
-
|
|
56
|
+
this.m365rcJson.apps.forEach((app, index) => {
|
|
57
|
+
app.appIdIndex = index;
|
|
58
|
+
});
|
|
59
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('appId', this.m365rcJson.apps);
|
|
57
60
|
const result = await cli.handleMultipleResultsFound(`Multiple Entra apps found in ${m365rcJsonPath}.`, resultAsKeyValuePair);
|
|
58
|
-
this.appId =
|
|
61
|
+
this.appId = result.appId;
|
|
59
62
|
await super.action(logger, args);
|
|
60
63
|
}
|
|
61
64
|
}
|
|
@@ -29,7 +29,7 @@ class EntraAdministrativeUnitGetCommand extends GraphCommand {
|
|
|
29
29
|
let administrativeUnit;
|
|
30
30
|
try {
|
|
31
31
|
if (args.options.id) {
|
|
32
|
-
administrativeUnit = await this.getAdministrativeUnitById(args.options.id);
|
|
32
|
+
administrativeUnit = await this.getAdministrativeUnitById(args.options.id, args.options.properties);
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
administrativeUnit = await entraAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.displayName);
|
|
@@ -40,9 +40,20 @@ class EntraAdministrativeUnitGetCommand extends GraphCommand {
|
|
|
40
40
|
this.handleRejectedODataJsonPromise(err);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
async getAdministrativeUnitById(id) {
|
|
43
|
+
async getAdministrativeUnitById(id, properties) {
|
|
44
|
+
const queryParameters = [];
|
|
45
|
+
if (properties) {
|
|
46
|
+
const allProperties = properties.split(',');
|
|
47
|
+
const selectProperties = allProperties.filter(prop => !prop.includes('/'));
|
|
48
|
+
if (selectProperties.length > 0) {
|
|
49
|
+
queryParameters.push(`$select=${selectProperties}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const queryString = queryParameters.length > 0
|
|
53
|
+
? `?${queryParameters.join('&')}`
|
|
54
|
+
: '';
|
|
44
55
|
const requestOptions = {
|
|
45
|
-
url: `${this.resource}/v1.0/directory/administrativeUnits/${id}`,
|
|
56
|
+
url: `${this.resource}/v1.0/directory/administrativeUnits/${id}${queryString}`,
|
|
46
57
|
headers: {
|
|
47
58
|
accept: 'application/json;odata.metadata=none'
|
|
48
59
|
},
|
|
@@ -55,7 +66,8 @@ _EntraAdministrativeUnitGetCommand_instances = new WeakSet(), _EntraAdministrati
|
|
|
55
66
|
this.telemetry.push((args) => {
|
|
56
67
|
Object.assign(this.telemetryProperties, {
|
|
57
68
|
id: typeof args.options.id !== 'undefined',
|
|
58
|
-
displayName: typeof args.options.displayName !== 'undefined'
|
|
69
|
+
displayName: typeof args.options.displayName !== 'undefined',
|
|
70
|
+
properties: typeof args.options.properties !== 'undefined'
|
|
59
71
|
});
|
|
60
72
|
});
|
|
61
73
|
}, _EntraAdministrativeUnitGetCommand_initOptions = function _EntraAdministrativeUnitGetCommand_initOptions() {
|
|
@@ -63,6 +75,8 @@ _EntraAdministrativeUnitGetCommand_instances = new WeakSet(), _EntraAdministrati
|
|
|
63
75
|
option: '-i, --id [id]'
|
|
64
76
|
}, {
|
|
65
77
|
option: '-n, --displayName [displayName]'
|
|
78
|
+
}, {
|
|
79
|
+
option: '-p, --properties [properties]'
|
|
66
80
|
});
|
|
67
81
|
}, _EntraAdministrativeUnitGetCommand_initValidators = function _EntraAdministrativeUnitGetCommand_initValidators() {
|
|
68
82
|
this.validators.push(async (args) => {
|
|
@@ -1,3 +1,9 @@
|
|
|
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 _EntraAdministrativeUnitListCommand_instances, _EntraAdministrativeUnitListCommand_initTelemetry, _EntraAdministrativeUnitListCommand_initOptions;
|
|
1
7
|
import { odata } from '../../../../utils/odata.js';
|
|
2
8
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
3
9
|
import commands from '../../commands.js';
|
|
@@ -11,9 +17,26 @@ class EntraAdministrativeUnitListCommand extends GraphCommand {
|
|
|
11
17
|
defaultProperties() {
|
|
12
18
|
return ['id', 'displayName', 'visibility'];
|
|
13
19
|
}
|
|
14
|
-
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
_EntraAdministrativeUnitListCommand_instances.add(this);
|
|
23
|
+
__classPrivateFieldGet(this, _EntraAdministrativeUnitListCommand_instances, "m", _EntraAdministrativeUnitListCommand_initTelemetry).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _EntraAdministrativeUnitListCommand_instances, "m", _EntraAdministrativeUnitListCommand_initOptions).call(this);
|
|
25
|
+
}
|
|
26
|
+
async commandAction(logger, args) {
|
|
27
|
+
const queryParameters = [];
|
|
28
|
+
if (args.options.properties) {
|
|
29
|
+
const allProperties = args.options.properties.split(',');
|
|
30
|
+
const selectProperties = allProperties.filter(prop => !prop.includes('/'));
|
|
31
|
+
if (selectProperties.length > 0) {
|
|
32
|
+
queryParameters.push(`$select=${selectProperties}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const queryString = queryParameters.length > 0
|
|
36
|
+
? `?${queryParameters.join('&')}`
|
|
37
|
+
: '';
|
|
15
38
|
try {
|
|
16
|
-
const results = await odata.getAllItems(`${this.resource}/v1.0/directory/administrativeUnits`);
|
|
39
|
+
const results = await odata.getAllItems(`${this.resource}/v1.0/directory/administrativeUnits${queryString}`);
|
|
17
40
|
await logger.log(results);
|
|
18
41
|
}
|
|
19
42
|
catch (err) {
|
|
@@ -21,5 +44,14 @@ class EntraAdministrativeUnitListCommand extends GraphCommand {
|
|
|
21
44
|
}
|
|
22
45
|
}
|
|
23
46
|
}
|
|
47
|
+
_EntraAdministrativeUnitListCommand_instances = new WeakSet(), _EntraAdministrativeUnitListCommand_initTelemetry = function _EntraAdministrativeUnitListCommand_initTelemetry() {
|
|
48
|
+
this.telemetry.push((args) => {
|
|
49
|
+
Object.assign(this.telemetryProperties, {
|
|
50
|
+
properties: typeof args.options.properties !== 'undefined'
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}, _EntraAdministrativeUnitListCommand_initOptions = function _EntraAdministrativeUnitListCommand_initOptions() {
|
|
54
|
+
this.options.unshift({ option: '-p, --properties [properties]' });
|
|
55
|
+
};
|
|
24
56
|
export default new EntraAdministrativeUnitListCommand();
|
|
25
57
|
//# sourceMappingURL=administrativeunit-list.js.map
|
|
@@ -29,7 +29,7 @@ class EntraAppGetCommand extends GraphCommand {
|
|
|
29
29
|
async commandAction(logger, args) {
|
|
30
30
|
try {
|
|
31
31
|
const appObjectId = await this.getAppObjectId(args);
|
|
32
|
-
const appInfo = await this.getAppInfo(appObjectId);
|
|
32
|
+
const appInfo = await this.getAppInfo(appObjectId, args.options.properties);
|
|
33
33
|
const res = await this.saveAppInfo(args, appInfo, logger);
|
|
34
34
|
await logger.log(res);
|
|
35
35
|
}
|
|
@@ -64,9 +64,20 @@ class EntraAppGetCommand extends GraphCommand {
|
|
|
64
64
|
const result = await cli.handleMultipleResultsFound(`Multiple Microsoft Entra application registrations with name '${name}' found.`, resultAsKeyValuePair);
|
|
65
65
|
return result.id;
|
|
66
66
|
}
|
|
67
|
-
async getAppInfo(appObjectId) {
|
|
67
|
+
async getAppInfo(appObjectId, properties) {
|
|
68
|
+
const queryParameters = [];
|
|
69
|
+
if (properties) {
|
|
70
|
+
const allProperties = properties.split(',');
|
|
71
|
+
const selectProperties = allProperties.filter(prop => !prop.includes('/'));
|
|
72
|
+
if (selectProperties.length > 0) {
|
|
73
|
+
queryParameters.push(`$select=${selectProperties}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const queryString = queryParameters.length > 0
|
|
77
|
+
? `?${queryParameters.join('&')}`
|
|
78
|
+
: '';
|
|
68
79
|
const requestOptions = {
|
|
69
|
-
url: `${this.resource}/v1.0/myorganization/applications/${appObjectId}`,
|
|
80
|
+
url: `${this.resource}/v1.0/myorganization/applications/${appObjectId}${queryString}`,
|
|
70
81
|
headers: {
|
|
71
82
|
accept: 'application/json;odata.metadata=none'
|
|
72
83
|
},
|
|
@@ -121,11 +132,12 @@ _EntraAppGetCommand_instances = new WeakSet(), _EntraAppGetCommand_initTelemetry
|
|
|
121
132
|
Object.assign(this.telemetryProperties, {
|
|
122
133
|
appId: typeof args.options.appId !== 'undefined',
|
|
123
134
|
objectId: typeof args.options.objectId !== 'undefined',
|
|
124
|
-
name: typeof args.options.name !== 'undefined'
|
|
135
|
+
name: typeof args.options.name !== 'undefined',
|
|
136
|
+
properties: typeof args.options.properties !== 'undefined'
|
|
125
137
|
});
|
|
126
138
|
});
|
|
127
139
|
}, _EntraAppGetCommand_initOptions = function _EntraAppGetCommand_initOptions() {
|
|
128
|
-
this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '--name [name]' }, { option: '--save' });
|
|
140
|
+
this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '--name [name]' }, { option: '--save' }, { option: '-p, --properties [properties]' });
|
|
129
141
|
}, _EntraAppGetCommand_initValidators = function _EntraAppGetCommand_initValidators() {
|
|
130
142
|
this.validators.push(async (args) => {
|
|
131
143
|
if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
|
|
@@ -1,3 +1,9 @@
|
|
|
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 _EntraAppListCommand_instances, _EntraAppListCommand_initTelemetry, _EntraAppListCommand_initOptions;
|
|
1
7
|
import { odata } from "../../../../utils/odata.js";
|
|
2
8
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
3
9
|
import commands from '../../commands.js';
|
|
@@ -8,12 +14,29 @@ class EntraAppListCommand extends GraphCommand {
|
|
|
8
14
|
get description() {
|
|
9
15
|
return 'Retrieves a list of Entra app registrations';
|
|
10
16
|
}
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
_EntraAppListCommand_instances.add(this);
|
|
20
|
+
__classPrivateFieldGet(this, _EntraAppListCommand_instances, "m", _EntraAppListCommand_initTelemetry).call(this);
|
|
21
|
+
__classPrivateFieldGet(this, _EntraAppListCommand_instances, "m", _EntraAppListCommand_initOptions).call(this);
|
|
22
|
+
}
|
|
11
23
|
defaultProperties() {
|
|
12
24
|
return ['appId', 'id', 'displayName', "signInAudience"];
|
|
13
25
|
}
|
|
14
|
-
async commandAction(logger) {
|
|
26
|
+
async commandAction(logger, args) {
|
|
27
|
+
const queryParameters = [];
|
|
28
|
+
if (args.options.properties) {
|
|
29
|
+
const allProperties = args.options.properties.split(',');
|
|
30
|
+
const selectProperties = allProperties.filter(prop => !prop.includes('/'));
|
|
31
|
+
if (selectProperties.length > 0) {
|
|
32
|
+
queryParameters.push(`$select=${selectProperties}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const queryString = queryParameters.length > 0
|
|
36
|
+
? `?${queryParameters.join('&')}`
|
|
37
|
+
: '';
|
|
15
38
|
try {
|
|
16
|
-
const results = await odata.getAllItems(`${this.resource}/v1.0/applications`);
|
|
39
|
+
const results = await odata.getAllItems(`${this.resource}/v1.0/applications${queryString}`);
|
|
17
40
|
await logger.log(results);
|
|
18
41
|
}
|
|
19
42
|
catch (err) {
|
|
@@ -21,5 +44,14 @@ class EntraAppListCommand extends GraphCommand {
|
|
|
21
44
|
}
|
|
22
45
|
}
|
|
23
46
|
}
|
|
47
|
+
_EntraAppListCommand_instances = new WeakSet(), _EntraAppListCommand_initTelemetry = function _EntraAppListCommand_initTelemetry() {
|
|
48
|
+
this.telemetry.push((args) => {
|
|
49
|
+
Object.assign(this.telemetryProperties, {
|
|
50
|
+
properties: typeof args.options.properties !== 'undefined'
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}, _EntraAppListCommand_initOptions = function _EntraAppListCommand_initOptions() {
|
|
54
|
+
this.options.unshift({ option: '-p, --properties [properties]' });
|
|
55
|
+
};
|
|
24
56
|
export default new EntraAppListCommand();
|
|
25
57
|
//# sourceMappingURL=app-list.js.map
|
|
@@ -27,10 +27,10 @@ class EntraGroupGetCommand extends GraphCommand {
|
|
|
27
27
|
let group;
|
|
28
28
|
try {
|
|
29
29
|
if (args.options.id) {
|
|
30
|
-
group = await entraGroup.getGroupById(args.options.id);
|
|
30
|
+
group = await entraGroup.getGroupById(args.options.id, args.options.properties);
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
group = await entraGroup.getGroupByDisplayName(args.options.displayName);
|
|
33
|
+
group = await entraGroup.getGroupByDisplayName(args.options.displayName, args.options.properties);
|
|
34
34
|
}
|
|
35
35
|
await logger.log(group);
|
|
36
36
|
}
|
|
@@ -44,6 +44,8 @@ _EntraGroupGetCommand_instances = new WeakSet(), _EntraGroupGetCommand_initOptio
|
|
|
44
44
|
option: '-i, --id [id]'
|
|
45
45
|
}, {
|
|
46
46
|
option: '-n, --displayName [displayName]'
|
|
47
|
+
}, {
|
|
48
|
+
option: '-p, --properties [properties]'
|
|
47
49
|
});
|
|
48
50
|
}, _EntraGroupGetCommand_initValidators = function _EntraGroupGetCommand_initValidators() {
|
|
49
51
|
this.validators.push(async (args) => {
|
|
@@ -58,7 +60,8 @@ _EntraGroupGetCommand_instances = new WeakSet(), _EntraGroupGetCommand_initOptio
|
|
|
58
60
|
this.telemetry.push((args) => {
|
|
59
61
|
Object.assign(this.telemetryProperties, {
|
|
60
62
|
id: typeof args.options.id !== 'undefined',
|
|
61
|
-
displayName: typeof args.options.displayName !== 'undefined'
|
|
63
|
+
displayName: typeof args.options.displayName !== 'undefined',
|
|
64
|
+
properties: typeof args.options.properties !== 'undefined'
|
|
62
65
|
});
|
|
63
66
|
});
|
|
64
67
|
};
|
|
@@ -47,6 +47,18 @@ class EntraGroupListCommand extends GraphCommand {
|
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
const queryParameters = [];
|
|
51
|
+
if (args.options.properties) {
|
|
52
|
+
const allProperties = args.options.properties.split(',');
|
|
53
|
+
const selectProperties = allProperties.filter(prop => !prop.includes('/'));
|
|
54
|
+
if (selectProperties.length > 0) {
|
|
55
|
+
queryParameters.push(`$select=${selectProperties}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const queryString = queryParameters.length > 0
|
|
59
|
+
? `?${queryParameters.join('&')}`
|
|
60
|
+
: '';
|
|
61
|
+
requestUrl += queryString;
|
|
50
62
|
let groups = [];
|
|
51
63
|
if (useConsistencyLevelHeader) {
|
|
52
64
|
// While using not() function in the filter, we need to specify the ConsistencyLevel header.
|
|
@@ -89,13 +101,16 @@ class EntraGroupListCommand extends GraphCommand {
|
|
|
89
101
|
_a = EntraGroupListCommand, _EntraGroupListCommand_instances = new WeakSet(), _EntraGroupListCommand_initTelemetry = function _EntraGroupListCommand_initTelemetry() {
|
|
90
102
|
this.telemetry.push((args) => {
|
|
91
103
|
Object.assign(this.telemetryProperties, {
|
|
92
|
-
type: typeof args.options.type !== 'undefined'
|
|
104
|
+
type: typeof args.options.type !== 'undefined',
|
|
105
|
+
properties: typeof args.options.properties !== 'undefined'
|
|
93
106
|
});
|
|
94
107
|
});
|
|
95
108
|
}, _EntraGroupListCommand_initOptions = function _EntraGroupListCommand_initOptions() {
|
|
96
109
|
this.options.unshift({
|
|
97
110
|
option: '--type [type]',
|
|
98
111
|
autocomplete: _a.groupTypes
|
|
112
|
+
}, {
|
|
113
|
+
option: '-p, --properties [properties]'
|
|
99
114
|
});
|
|
100
115
|
}, _EntraGroupListCommand_initValidators = function _EntraGroupListCommand_initValidators() {
|
|
101
116
|
this.validators.push(async (args) => {
|
|
@@ -5,12 +5,24 @@ export const entraAdministrativeUnit = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Get an administrative unit by its display name.
|
|
7
7
|
* @param displayName Administrative unit display name.
|
|
8
|
+
* @param properties Properties to include in the response.
|
|
8
9
|
* @returns The administrative unit.
|
|
9
10
|
* @throws Error when administrative unit was not found.
|
|
10
11
|
*/
|
|
11
|
-
async getAdministrativeUnitByDisplayName(displayName) {
|
|
12
|
+
async getAdministrativeUnitByDisplayName(displayName, properties) {
|
|
13
|
+
const queryParameters = [];
|
|
14
|
+
if (properties) {
|
|
15
|
+
const allProperties = properties.split(',');
|
|
16
|
+
const selectProperties = allProperties.filter(prop => !prop.includes('/'));
|
|
17
|
+
if (selectProperties.length > 0) {
|
|
18
|
+
queryParameters.push(`$select=${selectProperties}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const queryString = queryParameters.length > 0
|
|
22
|
+
? `?${queryParameters.join('&')}`
|
|
23
|
+
: '';
|
|
12
24
|
const graphResource = 'https://graph.microsoft.com';
|
|
13
|
-
const administrativeUnits = await odata.getAllItems(`${graphResource}/v1.0/directory/administrativeUnits?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'`);
|
|
25
|
+
const administrativeUnits = await odata.getAllItems(`${graphResource}/v1.0/directory/administrativeUnits?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'${queryString}`);
|
|
14
26
|
if (administrativeUnits.length === 0) {
|
|
15
27
|
throw `The specified administrative unit '${displayName}' does not exist.`;
|
|
16
28
|
}
|
package/dist/utils/entraGroup.js
CHANGED
|
@@ -7,10 +7,22 @@ export const entraGroup = {
|
|
|
7
7
|
/**
|
|
8
8
|
* Retrieve a single group.
|
|
9
9
|
* @param id Group ID.
|
|
10
|
+
* @param properties Properties to include in the response.
|
|
10
11
|
*/
|
|
11
|
-
async getGroupById(id) {
|
|
12
|
+
async getGroupById(id, properties) {
|
|
13
|
+
const queryParameters = [];
|
|
14
|
+
if (properties) {
|
|
15
|
+
const allProperties = properties.split(',');
|
|
16
|
+
const selectProperties = allProperties.filter(prop => !prop.includes('/'));
|
|
17
|
+
if (selectProperties.length > 0) {
|
|
18
|
+
queryParameters.push(`$select=${selectProperties}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const queryString = queryParameters.length > 0
|
|
22
|
+
? `?${queryParameters.join('&')}`
|
|
23
|
+
: '';
|
|
12
24
|
const requestOptions = {
|
|
13
|
-
url: `${graphResource}/v1.0/groups/${id}`,
|
|
25
|
+
url: `${graphResource}/v1.0/groups/${id}${queryString}`,
|
|
14
26
|
headers: {
|
|
15
27
|
accept: 'application/json;odata.metadata=none'
|
|
16
28
|
},
|
|
@@ -21,18 +33,31 @@ export const entraGroup = {
|
|
|
21
33
|
/**
|
|
22
34
|
* Get a list of groups by display name.
|
|
23
35
|
* @param displayName Group display name.
|
|
36
|
+
* @param properties Properties to include in the response.
|
|
24
37
|
*/
|
|
25
|
-
async getGroupsByDisplayName(displayName) {
|
|
26
|
-
|
|
38
|
+
async getGroupsByDisplayName(displayName, properties) {
|
|
39
|
+
const queryParameters = [];
|
|
40
|
+
if (properties) {
|
|
41
|
+
const allProperties = properties.split(',');
|
|
42
|
+
const selectProperties = allProperties.filter(prop => !prop.includes('/'));
|
|
43
|
+
if (selectProperties.length > 0) {
|
|
44
|
+
queryParameters.push(`$select=${selectProperties}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const queryString = queryParameters.length > 0
|
|
48
|
+
? `&${queryParameters.join('&')}`
|
|
49
|
+
: '';
|
|
50
|
+
return odata.getAllItems(`${graphResource}/v1.0/groups?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'${queryString}`);
|
|
27
51
|
},
|
|
28
52
|
/**
|
|
29
53
|
* Get a single group by its display name.
|
|
30
54
|
* @param displayName Group display name.
|
|
55
|
+
* @param properties Properties to include in the response.
|
|
31
56
|
* @throws Error when group was not found.
|
|
32
57
|
* @throws Error when multiple groups with the same name were found.
|
|
33
58
|
*/
|
|
34
|
-
async getGroupByDisplayName(displayName) {
|
|
35
|
-
const groups = await this.getGroupsByDisplayName(displayName);
|
|
59
|
+
async getGroupByDisplayName(displayName, properties) {
|
|
60
|
+
const groups = await this.getGroupsByDisplayName(displayName, properties);
|
|
36
61
|
if (!groups.length) {
|
|
37
62
|
throw Error(`The specified group '${displayName}' does not exist.`);
|
|
38
63
|
}
|
|
@@ -20,22 +20,29 @@ m365 entra administrativeunit get [options]
|
|
|
20
20
|
|
|
21
21
|
`-n, --displayName [displayName]`
|
|
22
22
|
: The display name of the administrative unit. Specify either `id` or `displayName` but not both.
|
|
23
|
+
|
|
24
|
+
`-p, --properties [properties]`
|
|
25
|
+
: Comma-separated list of properties to retrieve.
|
|
23
26
|
```
|
|
24
27
|
|
|
25
28
|
<Global />
|
|
26
29
|
|
|
30
|
+
## Remarks
|
|
31
|
+
|
|
32
|
+
Using the `--properties` option, you can specify a comma-separated list of administrative unit properties to retrieve from the Microsoft Graph. If you don't specify any properties, the command will output the default properties returned by Graph.
|
|
33
|
+
|
|
27
34
|
## Examples
|
|
28
35
|
|
|
29
|
-
Get information about the administrative unit by its id
|
|
36
|
+
Get information about the administrative unit by its id.
|
|
30
37
|
|
|
31
38
|
```sh
|
|
32
39
|
m365 entra administrativeunit get --id 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7
|
|
33
40
|
```
|
|
34
41
|
|
|
35
|
-
Get information about the administrative unit by its display name
|
|
42
|
+
Get information about the administrative unit by its display name with specified properties.
|
|
36
43
|
|
|
37
44
|
```sh
|
|
38
|
-
m365 entra administrativeunit get --displayName
|
|
45
|
+
m365 entra administrativeunit get --displayName "Marketing Division" --properties "id,displayName"
|
|
39
46
|
```
|
|
40
47
|
|
|
41
48
|
## Response
|
|
@@ -14,16 +14,31 @@ m365 entra administrativeunit list [options]
|
|
|
14
14
|
|
|
15
15
|
## Options
|
|
16
16
|
|
|
17
|
+
```md definition-list
|
|
18
|
+
`-p, --properties [properties]`
|
|
19
|
+
: Comma-separated list of properties to retrieve.
|
|
20
|
+
```
|
|
21
|
+
|
|
17
22
|
<Global />
|
|
18
23
|
|
|
24
|
+
## Remarks
|
|
25
|
+
|
|
26
|
+
Using the `--properties` option, you can specify a comma-separated list of administrative unit properties to retrieve from the Microsoft Graph. If you don't specify any properties, the command will output the default properties returned by Graph.
|
|
27
|
+
|
|
19
28
|
## Examples
|
|
20
29
|
|
|
21
|
-
Retrieve a list of administrative units
|
|
30
|
+
Retrieve a list of administrative units.
|
|
22
31
|
|
|
23
32
|
```sh
|
|
24
33
|
m365 entra administrativeunit list
|
|
25
34
|
```
|
|
26
35
|
|
|
36
|
+
Retrieve a list of administrative units with specified properties.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
m365 entra administrativeunit list --properties "id,displayName"
|
|
40
|
+
```
|
|
41
|
+
|
|
27
42
|
## Response
|
|
28
43
|
|
|
29
44
|
<Tabs>
|
|
@@ -22,16 +22,19 @@ m365 entra appregistration get [options]
|
|
|
22
22
|
|
|
23
23
|
```md definition-list
|
|
24
24
|
`--appId [appId]`
|
|
25
|
-
: Application (client) ID of the Entra application registration to get. Specify either `appId`, `objectId` or `name
|
|
25
|
+
: Application (client) ID of the Entra application registration to get. Specify either `appId`, `objectId` or `name`.
|
|
26
26
|
|
|
27
27
|
`--objectId [objectId]`
|
|
28
|
-
: Object ID of the Entra application registration to get. Specify either `appId`, `objectId` or `name
|
|
28
|
+
: Object ID of the Entra application registration to get. Specify either `appId`, `objectId` or `name`.
|
|
29
29
|
|
|
30
30
|
`--name [name]`
|
|
31
|
-
: Name of the Entra application registration to get. Specify either `appId`, `objectId` or `name
|
|
31
|
+
: Name of the Entra application registration to get. Specify either `appId`, `objectId` or `name`.
|
|
32
32
|
|
|
33
33
|
`--save`
|
|
34
|
-
: Use to store the information about the created app in a local file
|
|
34
|
+
: Use to store the information about the created app in a local file.
|
|
35
|
+
|
|
36
|
+
`-p, --properties [properties]`
|
|
37
|
+
: Comma-separated list of properties to retrieve.
|
|
35
38
|
```
|
|
36
39
|
|
|
37
40
|
<Global />
|
|
@@ -44,24 +47,26 @@ If the command finds multiple Entra application registrations with the specified
|
|
|
44
47
|
|
|
45
48
|
If you want to store the information about the Entra app registration, use the `--save` option. This is useful when you build solutions connected to Microsoft 365 and want to easily manage app registrations used with your solution. When you use the `--save` option, after you get the app registration, the command will write its ID and name to the `.m365rc.json` file in the current directory. If the file already exists, it will add the information about the App registration to it if it's not already present, allowing you to track multiple apps. If the file doesn't exist, the command will create it.
|
|
46
49
|
|
|
50
|
+
Using the `--properties` option, you can specify a comma-separated list of app properties to retrieve from the Microsoft Graph. If you don't specify any properties, the command will output the default properties returned by Graph.
|
|
51
|
+
|
|
47
52
|
## Examples
|
|
48
53
|
|
|
49
|
-
Get the Entra application registration by its app (client) ID
|
|
54
|
+
Get the Entra application registration by its app (client) ID.
|
|
50
55
|
|
|
51
56
|
```sh
|
|
52
57
|
m365 entra app get --appId d75be2e1-0204-4f95-857d-51a37cf40be8
|
|
53
58
|
```
|
|
54
59
|
|
|
55
|
-
Get the Entra application registration by its object ID
|
|
60
|
+
Get the Entra application registration by its object ID.
|
|
56
61
|
|
|
57
62
|
```sh
|
|
58
63
|
m365 entra app get --objectId d75be2e1-0204-4f95-857d-51a37cf40be8
|
|
59
64
|
```
|
|
60
65
|
|
|
61
|
-
Get the Entra application registration by its name
|
|
66
|
+
Get the Entra application registration by its name with specified properties.
|
|
62
67
|
|
|
63
68
|
```sh
|
|
64
|
-
m365 entra app get --name "My app"
|
|
69
|
+
m365 entra app get --name "My app" --properties "appId,displayName"
|
|
65
70
|
```
|
|
66
71
|
|
|
67
72
|
Get the Entra application registration by its name. Store information about the retrieved app registration in the _.m365rc.json_ file in the current directory.
|
|
@@ -20,16 +20,31 @@ m365 entra appregistration list [options]
|
|
|
20
20
|
|
|
21
21
|
## Options
|
|
22
22
|
|
|
23
|
+
```md definition-list
|
|
24
|
+
`-p, --properties [properties]`
|
|
25
|
+
: Comma-separated list of properties to retrieve.
|
|
26
|
+
```
|
|
27
|
+
|
|
23
28
|
<Global />
|
|
24
29
|
|
|
30
|
+
## Remarks
|
|
31
|
+
|
|
32
|
+
Using the `--properties` option, you can specify a comma-separated list of app properties to retrieve from the Microsoft Graph. If you don't specify any properties, the command will output the default properties returned by Graph.
|
|
33
|
+
|
|
25
34
|
## Examples
|
|
26
35
|
|
|
27
|
-
Retrieve a list of Entra app registrations
|
|
36
|
+
Retrieve a list of Entra app registrations.
|
|
28
37
|
|
|
29
38
|
```sh
|
|
30
39
|
m365 entra app list
|
|
31
40
|
```
|
|
32
41
|
|
|
42
|
+
Retrieve a list of Entra app registrations with specified properties.
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
m365 entra app list --properties "appId,displayName"
|
|
46
|
+
```
|
|
47
|
+
|
|
33
48
|
## Response
|
|
34
49
|
|
|
35
50
|
<Tabs>
|
|
@@ -20,22 +20,29 @@ m365 entra group get [options]
|
|
|
20
20
|
|
|
21
21
|
`-n, --displayName [displayName]`
|
|
22
22
|
: The display name of the Entra group. Specify either `id` or `displayName` but not both.
|
|
23
|
+
|
|
24
|
+
`-p, --properties [properties]`
|
|
25
|
+
: Comma-separated list of properties to retrieve.
|
|
23
26
|
```
|
|
24
27
|
|
|
25
28
|
<Global />
|
|
26
29
|
|
|
30
|
+
## Remarks
|
|
31
|
+
|
|
32
|
+
Using the `--properties` option, you can specify a comma-separated list of group properties to retrieve from the Microsoft Graph. If you don't specify any properties, the command will output the default properties returned by Graph.
|
|
33
|
+
|
|
27
34
|
## Examples
|
|
28
35
|
|
|
29
|
-
Get information about an Entra Group by id
|
|
36
|
+
Get information about an Entra Group by id.
|
|
30
37
|
|
|
31
38
|
```sh
|
|
32
39
|
m365 entra group get --id 1caf7dcd-7e83-4c3a-94f7-932a1299c844
|
|
33
40
|
```
|
|
34
41
|
|
|
35
|
-
Get information about an Entra Group by its display name
|
|
42
|
+
Get information about an Entra Group by its display name with specified properties.
|
|
36
43
|
|
|
37
44
|
```sh
|
|
38
|
-
m365 entra group get --displayName Finance
|
|
45
|
+
m365 entra group get --displayName Finance --properties "mail,displayName"
|
|
39
46
|
```
|
|
40
47
|
|
|
41
48
|
## Response
|
|
@@ -17,10 +17,17 @@ m365 entra group list [options]
|
|
|
17
17
|
```md definition-list
|
|
18
18
|
`--type [type]`
|
|
19
19
|
: Filter the results to only groups of a given type. Allowed values: `microsoft365`, `security`, `distribution`, `mailEnabledSecurity`. By default, all groups are listed.
|
|
20
|
+
|
|
21
|
+
`-p, --properties [properties]`
|
|
22
|
+
: Comma-separated list of properties to retrieve.
|
|
20
23
|
```
|
|
21
24
|
|
|
22
25
|
<Global />
|
|
23
26
|
|
|
27
|
+
## Remarks
|
|
28
|
+
|
|
29
|
+
Using the `--properties` option, you can specify a comma-separated list of group properties to retrieve from the Microsoft Graph. If you don't specify any properties, the command will output the default properties returned by Graph.
|
|
30
|
+
|
|
24
31
|
## Examples
|
|
25
32
|
|
|
26
33
|
Lists all groups defined in Entra ID.
|
|
@@ -29,10 +36,10 @@ Lists all groups defined in Entra ID.
|
|
|
29
36
|
m365 entra group list
|
|
30
37
|
```
|
|
31
38
|
|
|
32
|
-
List all security groups defined in Entra ID.
|
|
39
|
+
List all security groups defined in Entra ID with specified properties.
|
|
33
40
|
|
|
34
41
|
```sh
|
|
35
|
-
m365 entra group list --type security
|
|
42
|
+
m365 entra group list --type security --properties "mail,displayName"
|
|
36
43
|
```
|
|
37
44
|
|
|
38
45
|
## Response
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnp/cli-microsoft365",
|
|
3
|
-
"version": "10.1.0
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/api.js",
|
|
@@ -312,4 +312,4 @@
|
|
|
312
312
|
"sinon": "^19.0.2",
|
|
313
313
|
"source-map-support": "^0.5.21"
|
|
314
314
|
}
|
|
315
|
-
}
|
|
315
|
+
}
|