@pnp/cli-microsoft365 5.3.0-beta.1ed1aa2 → 5.3.0-beta.95db8d3

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 (30) hide show
  1. package/.eslintrc.js +1 -0
  2. package/dist/m365/aad/commands/approleassignment/approleassignment-list.js +55 -22
  3. package/dist/m365/aad/commands.js +1 -1
  4. package/dist/m365/app/commands/app-open.js +64 -0
  5. package/dist/m365/app/commands.js +1 -0
  6. package/dist/m365/planner/commands/bucket/bucket-get.js +198 -0
  7. package/dist/m365/planner/commands/bucket/bucket-remove.js +214 -0
  8. package/dist/m365/planner/commands/task/task-get.js +150 -7
  9. package/dist/m365/planner/commands.js +2 -0
  10. package/dist/m365/spo/commands/field/field-list.js +84 -0
  11. package/dist/m365/spo/commands/list/list-roleinheritance-break.js +84 -0
  12. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +76 -0
  13. package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +49 -0
  14. package/dist/m365/spo/commands.js +4 -0
  15. package/dist/m365/tenant/commands/security/security-alerts-list.js +71 -0
  16. package/dist/m365/tenant/commands.js +1 -0
  17. package/docs/docs/cmd/app/app-open.md +45 -0
  18. package/docs/docs/cmd/planner/bucket/bucket-get.md +57 -0
  19. package/docs/docs/cmd/planner/bucket/bucket-remove.md +60 -0
  20. package/docs/docs/cmd/planner/task/task-get.md +30 -3
  21. package/docs/docs/cmd/spo/field/field-list.md +51 -0
  22. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +55 -0
  23. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +36 -0
  24. package/docs/docs/cmd/spo/roledefinition/roledefinition-list.md +24 -0
  25. package/docs/docs/cmd/teams/channel/channel-member-list.md +4 -4
  26. package/docs/docs/cmd/teams/channel/channel-member-remove.md +2 -2
  27. package/docs/docs/cmd/teams/channel/channel-member-set.md +2 -2
  28. package/docs/docs/cmd/tenant/security/security-alerts-list.md +30 -0
  29. package/npm-shrinkwrap.json +1515 -1282
  30. package/package.json +24 -24
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
4
5
  const GraphCommand_1 = require("../../../base/GraphCommand");
5
6
  const commands_1 = require("../../commands");
6
7
  class PlannerTaskGetCommand extends GraphCommand_1.default {
@@ -11,27 +12,169 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
11
12
  return 'Retrieve the the specified planner task';
12
13
  }
13
14
  commandAction(logger, args, cb) {
15
+ this
16
+ .getTaskId(args.options)
17
+ .then(taskId => {
18
+ const requestOptions = {
19
+ url: `${this.resource}/beta/planner/tasks/${encodeURIComponent(taskId)}`,
20
+ headers: {
21
+ accept: 'application/json;odata.metadata=none'
22
+ },
23
+ responseType: 'json'
24
+ };
25
+ return request_1.default.get(requestOptions);
26
+ })
27
+ .then((res) => {
28
+ logger.log(res);
29
+ cb();
30
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
31
+ }
32
+ getTaskId(options) {
33
+ if (options.id) {
34
+ return Promise.resolve(options.id);
35
+ }
36
+ return this
37
+ .getBucketId(options)
38
+ .then(bucketId => {
39
+ const requestOptions = {
40
+ url: `${this.resource}/v1.0/planner/buckets/${bucketId}/tasks?$select=id,title`,
41
+ headers: {
42
+ accept: 'application/json;odata.metadata=none'
43
+ },
44
+ responseType: 'json'
45
+ };
46
+ return request_1.default.get(requestOptions);
47
+ })
48
+ .then((response) => {
49
+ const title = options.title;
50
+ const tasks = response.value.filter(val => { var _a; return ((_a = val.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === title.toLocaleLowerCase(); });
51
+ if (!tasks.length) {
52
+ return Promise.reject(`The specified task ${options.title} does not exist`);
53
+ }
54
+ if (tasks.length > 1) {
55
+ return Promise.reject(`Multiple tasks with title ${options.title} found: ${tasks.map(x => x.id)}`);
56
+ }
57
+ return Promise.resolve(tasks[0].id);
58
+ });
59
+ }
60
+ getBucketId(options) {
61
+ if (options.bucketId) {
62
+ return Promise.resolve(options.bucketId);
63
+ }
64
+ return this
65
+ .getPlanId(options)
66
+ .then(planId => {
67
+ const requestOptions = {
68
+ url: `${this.resource}/v1.0/planner/plans/${planId}/buckets?$select=id,name`,
69
+ headers: {
70
+ accept: 'application/json;odata.metadata=none'
71
+ },
72
+ responseType: 'json'
73
+ };
74
+ return request_1.default.get(requestOptions);
75
+ })
76
+ .then((response) => {
77
+ const bucketName = options.bucketName;
78
+ const buckets = response.value.filter(val => { var _a; return ((_a = val.name) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === bucketName.toLocaleLowerCase(); });
79
+ if (!buckets.length) {
80
+ return Promise.reject(`The specified bucket ${options.bucketName} does not exist`);
81
+ }
82
+ if (buckets.length > 1) {
83
+ return Promise.reject(`Multiple buckets with name ${options.bucketName} found: ${buckets.map(x => x.id)}`);
84
+ }
85
+ return Promise.resolve(buckets[0].id);
86
+ });
87
+ }
88
+ getPlanId(options) {
89
+ if (options.planId) {
90
+ return Promise.resolve(options.planId);
91
+ }
92
+ return this
93
+ .getGroupId(options)
94
+ .then((groupId) => {
95
+ const requestOptions = {
96
+ url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'&$select=id,title`,
97
+ headers: {
98
+ accept: 'application/json;odata.metadata=none'
99
+ },
100
+ responseType: 'json'
101
+ };
102
+ return request_1.default.get(requestOptions);
103
+ })
104
+ .then((response) => {
105
+ const planName = options.planName;
106
+ const plans = response.value.filter(val => { var _a; return ((_a = val.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === planName.toLocaleLowerCase(); });
107
+ if (!plans.length) {
108
+ return Promise.reject(`The specified plan ${options.planName} does not exist`);
109
+ }
110
+ if (plans.length > 1) {
111
+ return Promise.reject(`Multiple plans with name ${options.planName} found: ${plans.map(x => x.id)}`);
112
+ }
113
+ return Promise.resolve(plans[0].id);
114
+ });
115
+ }
116
+ getGroupId(options) {
117
+ if (options.ownerGroupId) {
118
+ return Promise.resolve(options.ownerGroupId);
119
+ }
14
120
  const requestOptions = {
15
- url: `${this.resource}/beta/planner/tasks/${encodeURIComponent(args.options.id)}`,
121
+ url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(options.ownerGroupName)}'&$select=id`,
16
122
  headers: {
17
123
  accept: 'application/json;odata.metadata=none'
18
124
  },
19
125
  responseType: 'json'
20
126
  };
21
- request_1.default
127
+ return request_1.default
22
128
  .get(requestOptions)
23
- .then((res) => {
24
- logger.log(res);
25
- cb();
26
- }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
129
+ .then(response => {
130
+ const groups = response.value;
131
+ if (!groups.length) {
132
+ return Promise.reject(`The specified ownerGroup ${options.ownerGroupName} does not exist`);
133
+ }
134
+ if (groups.length > 1) {
135
+ return Promise.reject(`Multiple ownerGroups with name ${options.ownerGroupName} found: ${groups.map(x => x.id)}`);
136
+ }
137
+ return Promise.resolve(groups[0].id);
138
+ });
27
139
  }
28
140
  options() {
29
141
  const options = [
30
- { option: '-i, --id <id>' }
142
+ { option: '-i, --id [id]' },
143
+ { option: '-t, --title [title]' },
144
+ { option: '--bucketId [bucketId]' },
145
+ { option: '--bucketName [bucketName]' },
146
+ { option: '--planId [planId]' },
147
+ { option: '--planName [planName]' },
148
+ { option: '--ownerGroupId [ownerGroupId]' },
149
+ { option: '--ownerGroupName [ownerGroupName]' }
31
150
  ];
32
151
  const parentOptions = super.options();
33
152
  return options.concat(parentOptions);
34
153
  }
154
+ validate(args) {
155
+ if (args.options.title && !args.options.bucketId && !args.options.bucketName) {
156
+ return 'Specify either bucketId or bucketName when using title';
157
+ }
158
+ if (args.options.title && args.options.bucketId && args.options.bucketName) {
159
+ return 'Specify either bucketId or bucketName when using title but not both';
160
+ }
161
+ if (args.options.bucketName && !args.options.planId && !args.options.planName) {
162
+ return 'Specify either planId or planName when using bucketName';
163
+ }
164
+ if (args.options.bucketName && args.options.planId && args.options.planName) {
165
+ return 'Specify either planId or planName when using bucketName but not both';
166
+ }
167
+ if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
168
+ return 'Specify either ownerGroupId or ownerGroupName when using planName';
169
+ }
170
+ if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
171
+ return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
172
+ }
173
+ if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
174
+ return `${args.options.ownerGroupId} is not a valid GUID`;
175
+ }
176
+ return true;
177
+ }
35
178
  }
36
179
  module.exports = new PlannerTaskGetCommand();
37
180
  //# sourceMappingURL=task-get.js.map
@@ -5,6 +5,8 @@ exports.default = {
5
5
  BUCKET_ADD: `${prefix} bucket add`,
6
6
  BUCKET_LIST: `${prefix} bucket list`,
7
7
  BUCKET_SET: `${prefix} bucket set`,
8
+ BUCKET_REMOVE: `${prefix} bucket remove`,
9
+ BUCKET_GET: `${prefix} bucket get`,
8
10
  PLAN_ADD: `${prefix} plan add`,
9
11
  PLAN_GET: `${prefix} plan get`,
10
12
  PLAN_DETAILS_GET: `${prefix} plan details get`,
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoFieldListCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.FIELD_LIST;
10
+ }
11
+ get description() {
12
+ return 'Retrieves columns for the specified list or site';
13
+ }
14
+ getTelemetryProperties(args) {
15
+ const telemetryProps = super.getTelemetryProperties(args);
16
+ telemetryProps.listId = typeof args.options.listId !== 'undefined';
17
+ telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
18
+ telemetryProps.listUrl = typeof args.options.listUrl !== 'undefined';
19
+ return telemetryProps;
20
+ }
21
+ defaultProperties() {
22
+ return ['Id', 'Title', 'Group', 'Hidden'];
23
+ }
24
+ commandAction(logger, args, cb) {
25
+ let listUrl = '';
26
+ if (args.options.listId) {
27
+ listUrl = `lists(guid'${encodeURIComponent(args.options.listId)}')/`;
28
+ }
29
+ else if (args.options.listTitle) {
30
+ listUrl = `lists/getByTitle('${encodeURIComponent(args.options.listTitle)}')/`;
31
+ }
32
+ else if (args.options.listUrl) {
33
+ const listServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
34
+ listUrl = `GetList('${encodeURIComponent(listServerRelativeUrl)}')/`;
35
+ }
36
+ const requestOptions = {
37
+ url: `${args.options.webUrl}/_api/web/${listUrl}fields`,
38
+ headers: {
39
+ accept: 'application/json;odata=nometadata'
40
+ },
41
+ responseType: 'json'
42
+ };
43
+ request_1.default
44
+ .get(requestOptions)
45
+ .then((res) => {
46
+ logger.log(res.value);
47
+ cb();
48
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
49
+ }
50
+ options() {
51
+ const options = [
52
+ {
53
+ option: '-u, --webUrl <webUrl>'
54
+ },
55
+ {
56
+ option: '-t, --listTitle [listTitle]'
57
+ },
58
+ {
59
+ option: '-i, --listId [listId]'
60
+ },
61
+ {
62
+ option: '--listUrl [listUrl]'
63
+ }
64
+ ];
65
+ const parentOptions = super.options();
66
+ return options.concat(parentOptions);
67
+ }
68
+ validate(args) {
69
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
70
+ if (isValidSharePointUrl !== true) {
71
+ return isValidSharePointUrl;
72
+ }
73
+ if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
74
+ return `${args.options.listId} is not a valid GUID`;
75
+ }
76
+ const listOptions = [args.options.listId, args.options.listTitle, args.options.listUrl];
77
+ if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
78
+ return `Specify either list id or title or list url`;
79
+ }
80
+ return true;
81
+ }
82
+ }
83
+ module.exports = new SpoFieldListCommand();
84
+ //# sourceMappingURL=field-list.js.map
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoListRoleInheritanceBreakCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.LIST_ROLEINHERITANCE_BREAK;
10
+ }
11
+ get description() {
12
+ return 'Breaks role inheritance on list or library';
13
+ }
14
+ optionSets() {
15
+ return [
16
+ ['listId', 'listTitle']
17
+ ];
18
+ }
19
+ getTelemetryProperties(args) {
20
+ const telemetryProps = super.getTelemetryProperties(args);
21
+ telemetryProps.listId = typeof args.options.listId !== 'undefined';
22
+ telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
23
+ telemetryProps.clearExistingPermissions = args.options.clearExistingPermissions === true;
24
+ return telemetryProps;
25
+ }
26
+ commandAction(logger, args, cb) {
27
+ if (this.verbose) {
28
+ logger.logToStderr(`Breaking role inheritance of list in site at ${args.options.webUrl}...`);
29
+ }
30
+ let requestUrl = `${args.options.webUrl}/_api/web/lists`;
31
+ if (args.options.listId) {
32
+ requestUrl += `(guid'${encodeURIComponent(args.options.listId)}')`;
33
+ }
34
+ else {
35
+ requestUrl += `/getbytitle('${encodeURIComponent(args.options.listTitle)}')`;
36
+ }
37
+ let keepExistingPermissions = true;
38
+ if (args.options.clearExistingPermissions) {
39
+ keepExistingPermissions = !args.options.clearExistingPermissions;
40
+ }
41
+ const requestOptions = {
42
+ url: `${requestUrl}/breakroleinheritance(${keepExistingPermissions})`,
43
+ method: 'POST',
44
+ headers: {
45
+ 'accept': 'application/json;odata=nometadata',
46
+ 'content-type': 'application/json'
47
+ },
48
+ responseType: 'json'
49
+ };
50
+ request_1.default
51
+ .post(requestOptions)
52
+ .then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
53
+ }
54
+ options() {
55
+ const options = [
56
+ {
57
+ option: '-u, --webUrl <webUrl>'
58
+ },
59
+ {
60
+ option: '-i, --listId [listId]'
61
+ },
62
+ {
63
+ option: '-t, --listTitle [listTitle]'
64
+ },
65
+ {
66
+ option: '-c, --clearExistingPermissions'
67
+ }
68
+ ];
69
+ const parentOptions = super.options();
70
+ return options.concat(parentOptions);
71
+ }
72
+ validate(args) {
73
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
74
+ if (isValidSharePointUrl !== true) {
75
+ return isValidSharePointUrl;
76
+ }
77
+ if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
78
+ return `${args.options.listId} is not a valid GUID`;
79
+ }
80
+ return true;
81
+ }
82
+ }
83
+ module.exports = new SpoListRoleInheritanceBreakCommand();
84
+ //# sourceMappingURL=list-roleinheritance-break.js.map
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoListRoleInheritanceResetCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.LIST_ROLEINHERITANCE_RESET;
10
+ }
11
+ get description() {
12
+ return 'Restores role inheritance on list or library';
13
+ }
14
+ optionSets() {
15
+ return [
16
+ ['listId', 'listTitle']
17
+ ];
18
+ }
19
+ getTelemetryProperties(args) {
20
+ const telemetryProps = super.getTelemetryProperties(args);
21
+ telemetryProps.listId = typeof args.options.listId !== 'undefined';
22
+ telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
23
+ return telemetryProps;
24
+ }
25
+ commandAction(logger, args, cb) {
26
+ if (this.verbose) {
27
+ logger.logToStderr(`Restore role inheritance of list in site at ${args.options.webUrl}...`);
28
+ }
29
+ let requestUrl = `${args.options.webUrl}/_api/web/lists`;
30
+ if (args.options.listId) {
31
+ requestUrl += `(guid'${encodeURIComponent(args.options.listId)}')`;
32
+ }
33
+ else {
34
+ requestUrl += `/getbytitle('${encodeURIComponent(args.options.listTitle)}')`;
35
+ }
36
+ const requestOptions = {
37
+ url: `${requestUrl}/resetroleinheritance`,
38
+ method: 'POST',
39
+ headers: {
40
+ 'accept': 'application/json;odata=nometadata',
41
+ 'content-type': 'application/json'
42
+ },
43
+ responseType: 'json'
44
+ };
45
+ request_1.default
46
+ .post(requestOptions)
47
+ .then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
48
+ }
49
+ options() {
50
+ const options = [
51
+ {
52
+ option: '-u, --webUrl <webUrl>'
53
+ },
54
+ {
55
+ option: '-i, --listId [listId]'
56
+ },
57
+ {
58
+ option: '-t, --listTitle [listTitle]'
59
+ }
60
+ ];
61
+ const parentOptions = super.options();
62
+ return options.concat(parentOptions);
63
+ }
64
+ validate(args) {
65
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
66
+ if (isValidSharePointUrl !== true) {
67
+ return isValidSharePointUrl;
68
+ }
69
+ if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
70
+ return `${args.options.listId} is not a valid GUID`;
71
+ }
72
+ return true;
73
+ }
74
+ }
75
+ module.exports = new SpoListRoleInheritanceResetCommand();
76
+ //# sourceMappingURL=list-roleinheritance-reset.js.map
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoRoleDefinitionListCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.ROLEDEFINITION_LIST;
10
+ }
11
+ get description() {
12
+ return 'Gets list of role definitions for the specified site';
13
+ }
14
+ defaultProperties() {
15
+ return ['Id', 'Name'];
16
+ }
17
+ commandAction(logger, args, cb) {
18
+ if (this.verbose) {
19
+ logger.logToStderr(`Getting role definitions list from ${args.options.webUrl}...`);
20
+ }
21
+ const requestOptions = {
22
+ url: `${args.options.webUrl}/_api/web/roledefinitions`,
23
+ headers: {
24
+ 'accept': 'application/json;odata=nometadata'
25
+ },
26
+ responseType: 'json'
27
+ };
28
+ request_1.default
29
+ .get(requestOptions)
30
+ .then((response) => {
31
+ logger.log(response.value);
32
+ cb();
33
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
34
+ }
35
+ options() {
36
+ const options = [
37
+ {
38
+ option: '-u, --webUrl <webUrl>'
39
+ }
40
+ ];
41
+ const parentOptions = super.options();
42
+ return options.concat(parentOptions);
43
+ }
44
+ validate(args) {
45
+ return utils_1.validation.isValidSharePointUrl(args.options.webUrl);
46
+ }
47
+ }
48
+ module.exports = new SpoRoleDefinitionListCommand();
49
+ //# sourceMappingURL=roledefinition-list.js.map
@@ -41,6 +41,7 @@ exports.default = {
41
41
  FEATURE_LIST: `${prefix} feature list`,
42
42
  FIELD_ADD: `${prefix} field add`,
43
43
  FIELD_GET: `${prefix} field get`,
44
+ FIELD_LIST: `${prefix} field list`,
44
45
  FIELD_REMOVE: `${prefix} field remove`,
45
46
  FIELD_SET: `${prefix} field set`,
46
47
  FILE_ADD: `${prefix} file add`,
@@ -95,6 +96,8 @@ exports.default = {
95
96
  LIST_LABEL_SET: `${prefix} list label set`,
96
97
  LIST_LIST: `${prefix} list list`,
97
98
  LIST_REMOVE: `${prefix} list remove`,
99
+ LIST_ROLEINHERITANCE_BREAK: `${prefix} list roleinheritance break`,
100
+ LIST_ROLEINHERITANCE_RESET: `${prefix} list roleinheritance reset`,
98
101
  LIST_SET: `${prefix} list set`,
99
102
  LIST_SITESCRIPT_GET: `${prefix} list sitescript get`,
100
103
  LIST_VIEW_GET: `${prefix} list view get`,
@@ -159,6 +162,7 @@ exports.default = {
159
162
  REPORT_SITEUSAGEPAGES: `${prefix} report siteusagepages`,
160
163
  REPORT_SITEUSAGESITECOUNTS: `${prefix} report siteusagesitecounts`,
161
164
  REPORT_SITEUSAGESTORAGE: `${prefix} report siteusagestorage`,
165
+ ROLEDEFINITION_LIST: `${prefix} roledefinition list`,
162
166
  SEARCH: `${prefix} search`,
163
167
  SERVICEPRINCIPAL_GRANT_ADD: `${prefix} serviceprincipal grant add`,
164
168
  SERVICEPRINCIPAL_GRANT_LIST: `${prefix} serviceprincipal grant list`,
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const GraphCommand_1 = require("../../../base/GraphCommand");
4
+ const request_1 = require("../../../../request");
5
+ const commands_1 = require("../../commands");
6
+ class TenantSecurityAlertsListCommand extends GraphCommand_1.default {
7
+ get name() {
8
+ return commands_1.default.SECURITY_ALERTS_LIST;
9
+ }
10
+ get description() {
11
+ return 'Gets the security alerts for a tenant';
12
+ }
13
+ getTelemetryProperties(args) {
14
+ const telemetryProps = super.getTelemetryProperties(args);
15
+ telemetryProps.vendor = typeof args.options.vendor !== 'undefined';
16
+ return telemetryProps;
17
+ }
18
+ defaultProperties() {
19
+ return ['id', 'title', 'severity'];
20
+ }
21
+ commandAction(logger, args, cb) {
22
+ this
23
+ .listAlert(args.options)
24
+ .then((res) => {
25
+ logger.log(res);
26
+ cb();
27
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
28
+ }
29
+ listAlert(options) {
30
+ let queryFilter = '';
31
+ if (options.vendor) {
32
+ let vendorName = options.vendor;
33
+ switch (options.vendor.toLowerCase()) {
34
+ case 'azure security center':
35
+ vendorName = 'ASC';
36
+ break;
37
+ case 'microsoft cloud app security':
38
+ vendorName = 'MCAS';
39
+ break;
40
+ case 'azure active directory identity protection':
41
+ vendorName = 'IPC';
42
+ }
43
+ queryFilter = `?$filter=vendorInformation/provider eq '${encodeURIComponent(vendorName)}'`;
44
+ }
45
+ const requestOptions = {
46
+ url: `${this.resource}/v1.0/security/alerts${queryFilter}`,
47
+ headers: {
48
+ accept: 'application/json;odata.metadata=none'
49
+ },
50
+ responseType: 'json'
51
+ };
52
+ return request_1.default
53
+ .get(requestOptions)
54
+ .then(response => {
55
+ const alertList = response.value;
56
+ if (!alertList) {
57
+ return Promise.reject(`Error fetching security alerts`);
58
+ }
59
+ return Promise.resolve(alertList);
60
+ });
61
+ }
62
+ options() {
63
+ const options = [
64
+ { option: '--vendor [vendor]' }
65
+ ];
66
+ const parentOptions = super.options();
67
+ return options.concat(parentOptions);
68
+ }
69
+ }
70
+ module.exports = new TenantSecurityAlertsListCommand();
71
+ //# sourceMappingURL=security-alerts-list.js.map
@@ -9,6 +9,7 @@ exports.default = {
9
9
  REPORT_OFFICE365ACTIVATIONSUSERDETAIL: `${prefix} report office365activationsuserdetail`,
10
10
  REPORT_OFFICE365ACTIVATIONSUSERCOUNTS: `${prefix} report office365activationsusercounts`,
11
11
  REPORT_SERVICESUSERCOUNTS: `${prefix} report servicesusercounts`,
12
+ SECURITY_ALERTS_LIST: `${prefix} security alerts list`,
12
13
  SERVICEANNOUNCEMENT_HEALTHISSUE_GET: `${prefix} serviceannouncement healthissue get`,
13
14
  SERVICEANNOUNCEMENT_HEALTH_GET: `${prefix} serviceannouncement health get`,
14
15
  SERVICEANNOUNCEMENT_HEALTH_LIST: `${prefix} serviceannouncement health list`,
@@ -0,0 +1,45 @@
1
+ # aad app open
2
+
3
+ Returns deep link of the current AD app to open the Azure portal on the Azure AD app registration management page.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 app open [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `--appId [appId]`
14
+ : Optional Application (client) ID of the Azure AD application registration to open. Uses the app from the `.m365rc.json` file corresponding to the `appId`. If multiple apps are available, this will evade the prompt to choose an app. If the `appId` is not available in the list of apps, an error is thrown.
15
+
16
+ `--preview`
17
+ : Use to open the url of the Azure AD preview portal.
18
+
19
+ --8<-- "docs/cmd/_global.md"
20
+
21
+ ## Remarks
22
+
23
+ If config setting `autoOpenLinksInBrowser` is configured to true, the command will automatically open the link to the Azure Portal in the browser.
24
+
25
+ Gets the app from the `.m365rc.json` file in the current directory. If the `--appId` option is not used and multiple apps are available, it will prompt the user to choose one.
26
+
27
+ ## Examples
28
+
29
+ Prints the URL to the Azure AD application registration management page on the Azure Portal.
30
+
31
+ ```sh
32
+ m365 app open
33
+ ```
34
+
35
+ Prints the url of the Azure AD application registration management page on the preview Azure Portal.
36
+
37
+ ```sh
38
+ m365 app open --preview
39
+ ```
40
+
41
+ Prints the URL to the Azure AD application registration management page on the Azure Portal, evading a possible choice prompt in the case of multiple saved apps in the `.m365rc.json` file.
42
+
43
+ ```sh
44
+ m365 app open --appId d75be2e1-0204-4f95-857d-51a37cf40be8
45
+ ```