@pnp/cli-microsoft365 10.10.0-beta.eb74779 → 10.11.0-beta.24af61c
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/.eslintrc.cjs +2 -0
- package/Dockerfile +2 -2
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/config.js +1 -0
- package/dist/m365/base/GraphApplicationCommand.js +17 -0
- package/dist/m365/base/{DelegatedGraphCommand.js → GraphDelegatedCommand.js} +4 -4
- package/dist/m365/base/PowerAppsCommand.js +1 -1
- package/dist/m365/base/PowerAutomateCommand.js +1 -1
- package/dist/m365/base/PowerBICommand.js +1 -1
- package/dist/m365/base/PowerPlatformCommand.js +1 -1
- package/dist/m365/base/VivaEngageCommand.js +1 -1
- package/dist/m365/cli/commands/app/app-add.js +95 -0
- package/dist/m365/cli/commands.js +1 -0
- package/dist/m365/entra/commands/app/app-get.js +11 -52
- package/dist/m365/entra/commands/app/app-permission-add.js +19 -30
- package/dist/m365/entra/commands/app/app-permission-list.js +2 -19
- package/dist/m365/entra/commands/app/app-permission-remove.js +22 -31
- package/dist/m365/entra/commands/app/app-remove.js +2 -18
- package/dist/m365/entra/commands/app/app-role-add.js +10 -43
- package/dist/m365/entra/commands/app/app-role-list.js +2 -20
- package/dist/m365/entra/commands/app/app-role-remove.js +9 -40
- package/dist/m365/entra/commands/app/app-set.js +2 -19
- package/dist/m365/entra/commands/group/group-member-add.js +55 -10
- package/dist/m365/entra/commands/group/group-member-set.js +18 -3
- package/dist/m365/entra/commands/organization/organization-set.js +104 -0
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/outlook/commands/message/message-move.js +1 -1
- package/dist/m365/pp/commands/managementapp/managementapp-add.js +7 -21
- package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +96 -0
- package/dist/m365/spe/commands.js +1 -0
- package/dist/m365/spfx/commands/project/base-project-command.js +1 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.21.0.js +2 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.21.1.js +2 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.22.0-beta.1.js +21 -0
- package/dist/m365/spfx/commands/project/project-doctor/rules/FN002022_DEVDEP_typescript.js +10 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-model/SassJson.js +2 -0
- package/dist/m365/spfx/commands/project/project-model/index.js +1 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002001_DEVDEP_microsoft_sp_build_web.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002004_DEVDEP_gulp.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002007_DEVDEP_ajv.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002029_DEVDEP_microsoft_rush_stack_compiler_5_3.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002030_DEVDEP_microsoft_spfx_web_build_rig.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002031_DEVDEP_rushstack_heft.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002032_DEVDEP_typescript_eslint_parser.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002033_DEVDEP_jest_junit.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010011_YORC_useGulp.js +40 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015010_FILE_gulpfile_js.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015011_FILE_tsconfig_json.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015012_FILE_config_heft_json.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015013_FILE_config_jest_config_json.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015014_FILE_config_rig_json.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015015_FILE_config_typescript_json.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021004_PKG_scripts_build.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021005_PKG_scripts_test.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021006_PKG_scripts_clean.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021007_PKG_scripts_deploy.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021008_PKG_scripts_start.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021009_PKG_scripts_build_watch.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021010_PKG_scripts_package_solution.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021011_PKG_scripts_deploy_azure_storage.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021012_PKG_scripts_eject_webpack.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021013_PKG_overrides_rushstack_heft.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023003_GITIGNORE_libdts.js +36 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023004_GITIGNORE_libcommonjs.js +36 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023005_GITIGNORE_libesm.js +36 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023006_GITIGNORE_jestoutput.js +36 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN026001_CFG_SASS_schema.js +40 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN026002_CFG_SASS_extends.js +40 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FileAddRemoveRule.js +7 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.22.0-beta.1.js +241 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
- package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
- package/dist/m365/spo/commands/file/file-version-get.js +1 -0
- package/dist/m365/spo/commands/file/file-version-list.js +2 -2
- package/dist/m365/spo/commands/homesite/homesite-remove.js +57 -37
- package/dist/m365/spo/commands/list/list-view-add.js +140 -87
- package/dist/m365/spo/commands/page/Page.js +10 -3
- package/dist/m365/spo/commands/page/clientsidepages.js +4 -0
- package/dist/m365/spo/commands/page/page-section-add.js +73 -13
- package/dist/m365/spo/commands/page/page-section-list.js +5 -1
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-list.js +13 -7
- package/dist/m365/spo/commands/site/site-appcatalog-list.js +38 -2
- package/dist/m365/spo/commands/tenant/tenant-site-unarchive.js +1 -1
- package/dist/m365/teams/commands/callrecord/callrecord-list.js +100 -0
- package/dist/m365/teams/commands/chat/chat-message-send.js +2 -2
- package/dist/m365/teams/commands/message/message-remove.js +2 -2
- package/dist/m365/teams/commands/message/message-restore.js +2 -2
- package/dist/m365/teams/commands.js +1 -0
- package/dist/m365/todo/commands/list/list-add.js +2 -2
- package/dist/m365/todo/commands/list/list-get.js +2 -2
- package/dist/m365/todo/commands/list/list-list.js +2 -2
- package/dist/m365/todo/commands/list/list-remove.js +2 -2
- package/dist/m365/todo/commands/list/list-set.js +2 -2
- package/dist/m365/todo/commands/task/task-add.js +2 -2
- package/dist/m365/todo/commands/task/task-get.js +2 -2
- package/dist/m365/todo/commands/task/task-list.js +2 -2
- package/dist/m365/todo/commands/task/task-remove.js +2 -2
- package/dist/m365/todo/commands/task/task-set.js +2 -2
- package/dist/m365/viva/commands/engage/EngageRole.js +2 -0
- package/dist/m365/viva/commands/engage/engage-role-list.js +28 -0
- package/dist/m365/viva/commands/engage/engage-role-member-list.js +57 -0
- package/dist/m365/viva/commands.js +2 -0
- package/dist/utils/accessToken.js +9 -5
- package/dist/utils/entraApp.js +15 -0
- package/dist/utils/entraGroup.js +43 -0
- package/dist/utils/vivaEngage.js +19 -0
- package/docs/docs/cmd/cli/app/app-add.mdx +50 -0
- package/docs/docs/cmd/entra/group/group-member-add.mdx +26 -5
- package/docs/docs/cmd/entra/group/group-member-set.mdx +7 -4
- package/docs/docs/cmd/entra/organization/organization-set.mdx +84 -0
- package/docs/docs/cmd/spe/container/container-recyclebinitem-restore.mdx +53 -0
- package/docs/docs/cmd/spo/file/file-version-get.mdx +5 -2
- package/docs/docs/cmd/spo/file/file-version-list.mdx +7 -5
- package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +6 -3
- package/docs/docs/cmd/spo/list/list-view-add.mdx +53 -10
- package/docs/docs/cmd/spo/page/page-section-add.mdx +22 -2
- package/docs/docs/cmd/spo/site/site-appcatalog-list.mdx +11 -0
- package/docs/docs/cmd/spo/tenant/tenant-site-unarchive.mdx +1 -1
- package/docs/docs/cmd/teams/callrecord/callrecord-list.mdx +173 -0
- package/docs/docs/cmd/viva/engage/engage-role-list.mdx +102 -0
- package/docs/docs/cmd/viva/engage/engage-role-member-list.mdx +118 -0
- package/npm-shrinkwrap.json +293 -765
- package/package.json +18 -17
|
@@ -6,10 +6,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _EntraAppRoleAddCommand_instances, _a, _EntraAppRoleAddCommand_initTelemetry, _EntraAppRoleAddCommand_initOptions, _EntraAppRoleAddCommand_initValidators, _EntraAppRoleAddCommand_initOptionSets;
|
|
7
7
|
import { v4 } from 'uuid';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
|
-
import { formatting } from '../../../../utils/formatting.js';
|
|
10
9
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
10
|
import commands from '../../commands.js';
|
|
12
|
-
import { cli } from '../../../../cli/cli.js';
|
|
13
11
|
import { entraApp } from '../../../../utils/entraApp.js';
|
|
14
12
|
class EntraAppRoleAddCommand extends GraphCommand {
|
|
15
13
|
get name() {
|
|
@@ -28,8 +26,7 @@ class EntraAppRoleAddCommand extends GraphCommand {
|
|
|
28
26
|
}
|
|
29
27
|
async commandAction(logger, args) {
|
|
30
28
|
try {
|
|
31
|
-
const
|
|
32
|
-
const appInfo = await this.getAppInfo(appId, logger);
|
|
29
|
+
const appInfo = await this.getAppInfo(args, logger);
|
|
33
30
|
if (this.verbose) {
|
|
34
31
|
await logger.logToStderr(`Adding role ${args.options.name} to Microsoft Entra app ${appInfo.id}...`);
|
|
35
32
|
}
|
|
@@ -55,19 +52,6 @@ class EntraAppRoleAddCommand extends GraphCommand {
|
|
|
55
52
|
this.handleRejectedODataJsonPromise(err);
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
|
-
async getAppInfo(appId, logger) {
|
|
59
|
-
if (this.verbose) {
|
|
60
|
-
await logger.logToStderr(`Retrieving information about roles for Microsoft Entra app ${appId}...`);
|
|
61
|
-
}
|
|
62
|
-
const requestOptions = {
|
|
63
|
-
url: `${this.resource}/v1.0/myorganization/applications/${appId}?$select=id,appRoles`,
|
|
64
|
-
headers: {
|
|
65
|
-
accept: 'application/json;odata.metadata=none'
|
|
66
|
-
},
|
|
67
|
-
responseType: 'json'
|
|
68
|
-
};
|
|
69
|
-
return request.get(requestOptions);
|
|
70
|
-
}
|
|
71
55
|
getAllowedMemberTypes(args) {
|
|
72
56
|
switch (args.options.allowedMembers) {
|
|
73
57
|
case 'usersGroups':
|
|
@@ -80,36 +64,19 @@ class EntraAppRoleAddCommand extends GraphCommand {
|
|
|
80
64
|
return [];
|
|
81
65
|
}
|
|
82
66
|
}
|
|
83
|
-
async
|
|
84
|
-
|
|
85
|
-
return args.options.appObjectId;
|
|
86
|
-
}
|
|
87
|
-
const { appId, appName } = args.options;
|
|
67
|
+
async getAppInfo(args, logger) {
|
|
68
|
+
const { appObjectId, appId, appName } = args.options;
|
|
88
69
|
if (this.verbose) {
|
|
89
|
-
await logger.logToStderr(`Retrieving information about Microsoft Entra app ${appId ? appId : appName}...`);
|
|
70
|
+
await logger.logToStderr(`Retrieving information about Microsoft Entra app ${appObjectId ? appObjectId : (appId ? appId : appName)}...`);
|
|
71
|
+
}
|
|
72
|
+
if (appObjectId) {
|
|
73
|
+
return await entraApp.getAppRegistrationByObjectId(appObjectId, ['id', 'appRoles']);
|
|
90
74
|
}
|
|
91
|
-
if (appId) {
|
|
92
|
-
|
|
93
|
-
return app.id;
|
|
75
|
+
else if (appId) {
|
|
76
|
+
return await entraApp.getAppRegistrationByAppId(appId, ['id', 'appRoles']);
|
|
94
77
|
}
|
|
95
78
|
else {
|
|
96
|
-
|
|
97
|
-
url: `${this.resource}/v1.0/myorganization/applications?$filter=displayName eq '${formatting.encodeQueryParameter(appName)}'&$select=id`,
|
|
98
|
-
headers: {
|
|
99
|
-
accept: 'application/json;odata.metadata=none'
|
|
100
|
-
},
|
|
101
|
-
responseType: 'json'
|
|
102
|
-
};
|
|
103
|
-
const res = await request.get(requestOptions);
|
|
104
|
-
if (res.value.length === 1) {
|
|
105
|
-
return res.value[0].id;
|
|
106
|
-
}
|
|
107
|
-
if (res.value.length === 0) {
|
|
108
|
-
throw `No Microsoft Entra application registration with name ${appName} found`;
|
|
109
|
-
}
|
|
110
|
-
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
111
|
-
const result = await cli.handleMultipleResultsFound(`Multiple Microsoft Entra application registrations with name '${appName}' found.`, resultAsKeyValuePair);
|
|
112
|
-
return result.id;
|
|
79
|
+
return await entraApp.getAppRegistrationByAppName(appName, ['id', 'appRoles']);
|
|
113
80
|
}
|
|
114
81
|
}
|
|
115
82
|
}
|
|
@@ -4,12 +4,9 @@ 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 _EntraAppRoleListCommand_instances, _EntraAppRoleListCommand_initTelemetry, _EntraAppRoleListCommand_initOptions, _EntraAppRoleListCommand_initOptionSets;
|
|
7
|
-
import request from '../../../../request.js';
|
|
8
|
-
import { formatting } from '../../../../utils/formatting.js';
|
|
9
7
|
import { odata } from '../../../../utils/odata.js';
|
|
10
8
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
9
|
import commands from '../../commands.js';
|
|
12
|
-
import { cli } from '../../../../cli/cli.js';
|
|
13
10
|
import { entraApp } from '../../../../utils/entraApp.js';
|
|
14
11
|
class EntraAppRoleListCommand extends GraphCommand {
|
|
15
12
|
get name() {
|
|
@@ -51,23 +48,8 @@ class EntraAppRoleListCommand extends GraphCommand {
|
|
|
51
48
|
return app.id;
|
|
52
49
|
}
|
|
53
50
|
else {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
headers: {
|
|
57
|
-
accept: 'application/json;odata.metadata=none'
|
|
58
|
-
},
|
|
59
|
-
responseType: 'json'
|
|
60
|
-
};
|
|
61
|
-
const res = await request.get(requestOptions);
|
|
62
|
-
if (res.value.length === 1) {
|
|
63
|
-
return res.value[0].id;
|
|
64
|
-
}
|
|
65
|
-
if (res.value.length === 0) {
|
|
66
|
-
throw `No Microsoft Entra application registration with name ${appName} found`;
|
|
67
|
-
}
|
|
68
|
-
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
69
|
-
const result = await cli.handleMultipleResultsFound(`Multiple Microsoft Entra application registrations with name '${appName}' found.`, resultAsKeyValuePair);
|
|
70
|
-
return result.id;
|
|
51
|
+
const app = await entraApp.getAppRegistrationByAppName(appName, ["id"]);
|
|
52
|
+
return app.id;
|
|
71
53
|
}
|
|
72
54
|
}
|
|
73
55
|
}
|
|
@@ -46,8 +46,7 @@ class EntraAppRoleRemoveCommand extends GraphCommand {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
async processAppRoleDelete(logger, args) {
|
|
49
|
-
const
|
|
50
|
-
const app = await this.getEntraApp(appObjectId, logger);
|
|
49
|
+
const app = await this.getEntraApp(args, logger);
|
|
51
50
|
const appRoleDeleteIdentifierNameValue = args.options.name ? `name '${args.options.name}'` : (args.options.claim ? `claim '${args.options.claim}'` : `id '${args.options.id}'`);
|
|
52
51
|
if (this.verbose) {
|
|
53
52
|
await logger.logToStderr(`Deleting role with ${appRoleDeleteIdentifierNameValue} from Microsoft Entra app ${app.id}...`);
|
|
@@ -109,49 +108,19 @@ class EntraAppRoleRemoveCommand extends GraphCommand {
|
|
|
109
108
|
};
|
|
110
109
|
return request.patch(requestOptions);
|
|
111
110
|
}
|
|
112
|
-
async getEntraApp(
|
|
111
|
+
async getEntraApp(args, logger) {
|
|
112
|
+
const { appObjectId, appId, appName } = args.options;
|
|
113
113
|
if (this.verbose) {
|
|
114
|
-
await logger.logToStderr(`Retrieving
|
|
114
|
+
await logger.logToStderr(`Retrieving information about Microsoft Entra app ${appObjectId ? appObjectId : (appId ? appId : appName)}...`);
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
headers: {
|
|
119
|
-
accept: 'application/json;odata.metadata=none'
|
|
120
|
-
},
|
|
121
|
-
responseType: 'json'
|
|
122
|
-
};
|
|
123
|
-
return request.get(requestOptions);
|
|
124
|
-
}
|
|
125
|
-
async getAppObjectId(args, logger) {
|
|
126
|
-
if (args.options.appObjectId) {
|
|
127
|
-
return args.options.appObjectId;
|
|
128
|
-
}
|
|
129
|
-
const { appId, appName } = args.options;
|
|
130
|
-
if (this.verbose) {
|
|
131
|
-
await logger.logToStderr(`Retrieving information about Microsoft Entra app ${appId ? appId : appName}...`);
|
|
116
|
+
if (appObjectId) {
|
|
117
|
+
return await entraApp.getAppRegistrationByObjectId(appObjectId, ['id', 'appRoles']);
|
|
132
118
|
}
|
|
133
|
-
if (appId) {
|
|
134
|
-
|
|
135
|
-
return app.id;
|
|
119
|
+
else if (appId) {
|
|
120
|
+
return await entraApp.getAppRegistrationByAppId(appId, ['id', 'appRoles']);
|
|
136
121
|
}
|
|
137
122
|
else {
|
|
138
|
-
|
|
139
|
-
url: `${this.resource}/v1.0/myorganization/applications?$filter=displayName eq '${formatting.encodeQueryParameter(appName)}'&$select=id`,
|
|
140
|
-
headers: {
|
|
141
|
-
accept: 'application/json;odata.metadata=none'
|
|
142
|
-
},
|
|
143
|
-
responseType: 'json'
|
|
144
|
-
};
|
|
145
|
-
const res = await request.get(requestOptions);
|
|
146
|
-
if (res.value.length === 1) {
|
|
147
|
-
return res.value[0].id;
|
|
148
|
-
}
|
|
149
|
-
if (res.value.length === 0) {
|
|
150
|
-
throw `No Microsoft Entra application registration with name ${appName} found`;
|
|
151
|
-
}
|
|
152
|
-
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
153
|
-
const result = (await cli.handleMultipleResultsFound(`Multiple Microsoft Entra application registrations with name '${appName}' found.`, resultAsKeyValuePair));
|
|
154
|
-
return result.id;
|
|
123
|
+
return await entraApp.getAppRegistrationByAppName(appName, ['id', 'appRoles']);
|
|
155
124
|
}
|
|
156
125
|
}
|
|
157
126
|
}
|
|
@@ -6,10 +6,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _EntraAppSetCommand_instances, _a, _EntraAppSetCommand_initTelemetry, _EntraAppSetCommand_initOptions, _EntraAppSetCommand_initValidators, _EntraAppSetCommand_initOptionSets, _EntraAppSetCommand_initTypes;
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
|
-
import { formatting } from '../../../../utils/formatting.js';
|
|
10
9
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
10
|
import commands from '../../commands.js';
|
|
12
|
-
import { cli } from '../../../../cli/cli.js';
|
|
13
11
|
import { optionsUtils } from '../../../../utils/optionsUtils.js';
|
|
14
12
|
import { entraApp } from '../../../../utils/entraApp.js';
|
|
15
13
|
class EntraAppSetCommand extends GraphCommand {
|
|
@@ -57,23 +55,8 @@ class EntraAppSetCommand extends GraphCommand {
|
|
|
57
55
|
return app.id;
|
|
58
56
|
}
|
|
59
57
|
else {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
headers: {
|
|
63
|
-
accept: 'application/json;odata.metadata=none'
|
|
64
|
-
},
|
|
65
|
-
responseType: 'json'
|
|
66
|
-
};
|
|
67
|
-
const res = await request.get(requestOptions);
|
|
68
|
-
if (res.value.length === 1) {
|
|
69
|
-
return res.value[0].id;
|
|
70
|
-
}
|
|
71
|
-
if (res.value.length === 0) {
|
|
72
|
-
throw `No Microsoft Entra application registration with name ${name} found`;
|
|
73
|
-
}
|
|
74
|
-
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
75
|
-
const result = await cli.handleMultipleResultsFound(`Multiple Microsoft Entra application registration with name '${name}' found.`, resultAsKeyValuePair);
|
|
76
|
-
return result.id;
|
|
58
|
+
const app = await entraApp.getAppRegistrationByAppName(name, ["id"]);
|
|
59
|
+
return app.id;
|
|
77
60
|
}
|
|
78
61
|
}
|
|
79
62
|
async updateUnknownOptions(args, objectId) {
|
|
@@ -32,13 +32,16 @@ class EntraGroupMemberAddCommand extends GraphCommand {
|
|
|
32
32
|
if (args.options.groupDisplayName) {
|
|
33
33
|
await this.warn(logger, `Option 'groupDisplayName' is deprecated and will be removed in the next major release.`);
|
|
34
34
|
}
|
|
35
|
+
if (args.options.ids) {
|
|
36
|
+
await this.warn(logger, `Option 'ids' is deprecated and will be removed in the next major release. Please use 'userIds' instead.`);
|
|
37
|
+
}
|
|
35
38
|
if (this.verbose) {
|
|
36
|
-
await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userNames} to group ${args.options.groupId || args.options.groupDisplayName || args.options.groupName}...`);
|
|
39
|
+
await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userIds || args.options.userNames || args.options.subgroupIds || args.options.subgroupNames} to group ${args.options.groupId || args.options.groupDisplayName || args.options.groupName}...`);
|
|
37
40
|
}
|
|
38
41
|
const groupId = await this.getGroupId(logger, args.options);
|
|
39
|
-
const
|
|
40
|
-
for (let i = 0; i <
|
|
41
|
-
const
|
|
42
|
+
const objectIds = await this.getObjectIds(logger, args.options);
|
|
43
|
+
for (let i = 0; i < objectIds.length; i += 400) {
|
|
44
|
+
const objectIdsBatch = objectIds.slice(i, i + 400);
|
|
42
45
|
const requestOptions = {
|
|
43
46
|
url: `${this.resource}/v1.0/$batch`,
|
|
44
47
|
headers: {
|
|
@@ -49,8 +52,8 @@ class EntraGroupMemberAddCommand extends GraphCommand {
|
|
|
49
52
|
requests: []
|
|
50
53
|
}
|
|
51
54
|
};
|
|
52
|
-
for (let j = 0; j <
|
|
53
|
-
const
|
|
55
|
+
for (let j = 0; j < objectIdsBatch.length; j += 20) {
|
|
56
|
+
const objectIdsChunk = objectIdsBatch.slice(j, j + 20);
|
|
54
57
|
requestOptions.data.requests.push({
|
|
55
58
|
id: j + 1,
|
|
56
59
|
method: 'PATCH',
|
|
@@ -59,7 +62,7 @@ class EntraGroupMemberAddCommand extends GraphCommand {
|
|
|
59
62
|
'content-type': 'application/json;odata.metadata=none'
|
|
60
63
|
},
|
|
61
64
|
body: {
|
|
62
|
-
[`${args.options.role === 'Member' ? 'members' : 'owners'}@odata.bind`]:
|
|
65
|
+
[`${args.options.role === 'Member' ? 'members' : 'owners'}@odata.bind`]: objectIdsChunk.map(u => `${this.resource}/v1.0/directoryObjects/${u}`)
|
|
63
66
|
}
|
|
64
67
|
});
|
|
65
68
|
}
|
|
@@ -84,15 +87,33 @@ class EntraGroupMemberAddCommand extends GraphCommand {
|
|
|
84
87
|
}
|
|
85
88
|
return entraGroup.getGroupIdByDisplayName(options.groupDisplayName || options.groupName);
|
|
86
89
|
}
|
|
90
|
+
async getObjectIds(logger, options) {
|
|
91
|
+
if (options.ids || options.userIds || options.userNames) {
|
|
92
|
+
return this.getUserIds(logger, options);
|
|
93
|
+
}
|
|
94
|
+
return this.getGroupIds(logger, options);
|
|
95
|
+
}
|
|
87
96
|
async getUserIds(logger, options) {
|
|
88
97
|
if (options.ids) {
|
|
89
98
|
return options.ids.split(',').map(i => i.trim());
|
|
90
99
|
}
|
|
100
|
+
if (options.userIds) {
|
|
101
|
+
return options.userIds.split(',').map(i => i.trim());
|
|
102
|
+
}
|
|
91
103
|
if (this.verbose) {
|
|
92
104
|
await logger.logToStderr('Retrieving ID(s) of user(s)...');
|
|
93
105
|
}
|
|
94
106
|
return entraUser.getUserIdsByUpns(options.userNames.split(',').map(u => u.trim()));
|
|
95
107
|
}
|
|
108
|
+
async getGroupIds(logger, options) {
|
|
109
|
+
if (options.subgroupIds) {
|
|
110
|
+
return options.subgroupIds.split(',').map(i => i.trim());
|
|
111
|
+
}
|
|
112
|
+
if (this.verbose) {
|
|
113
|
+
await logger.logToStderr('Retrieving ID(s) of group(s)...');
|
|
114
|
+
}
|
|
115
|
+
return entraGroup.getGroupIdsByDisplayNames(options.subgroupNames.split(',').map(u => u.trim()));
|
|
116
|
+
}
|
|
96
117
|
}
|
|
97
118
|
_EntraGroupMemberAddCommand_instances = new WeakSet(), _EntraGroupMemberAddCommand_initTelemetry = function _EntraGroupMemberAddCommand_initTelemetry() {
|
|
98
119
|
this.telemetry.push((args) => {
|
|
@@ -101,7 +122,10 @@ _EntraGroupMemberAddCommand_instances = new WeakSet(), _EntraGroupMemberAddComma
|
|
|
101
122
|
groupDisplayName: typeof args.options.groupDisplayName !== 'undefined',
|
|
102
123
|
groupName: typeof args.options.groupName !== 'undefined',
|
|
103
124
|
ids: typeof args.options.ids !== 'undefined',
|
|
104
|
-
|
|
125
|
+
userIds: typeof args.options.userIds !== 'undefined',
|
|
126
|
+
userNames: typeof args.options.userNames !== 'undefined',
|
|
127
|
+
subgroupIds: typeof args.options.subgroupIds !== 'undefined',
|
|
128
|
+
subgroupNames: typeof args.options.subgroupNames !== 'undefined'
|
|
105
129
|
});
|
|
106
130
|
});
|
|
107
131
|
}, _EntraGroupMemberAddCommand_initOptions = function _EntraGroupMemberAddCommand_initOptions() {
|
|
@@ -113,8 +137,14 @@ _EntraGroupMemberAddCommand_instances = new WeakSet(), _EntraGroupMemberAddComma
|
|
|
113
137
|
option: '-n, --groupName [groupName]'
|
|
114
138
|
}, {
|
|
115
139
|
option: '--ids [ids]'
|
|
140
|
+
}, {
|
|
141
|
+
option: '--userIds [userIds]'
|
|
116
142
|
}, {
|
|
117
143
|
option: '--userNames [userNames]'
|
|
144
|
+
}, {
|
|
145
|
+
option: '--subgroupIds [subgroupIds]'
|
|
146
|
+
}, {
|
|
147
|
+
option: '--subgroupNames [subgroupNames]'
|
|
118
148
|
}, {
|
|
119
149
|
option: '-r, --role <role>',
|
|
120
150
|
autocomplete: this.roleValues
|
|
@@ -130,21 +160,36 @@ _EntraGroupMemberAddCommand_instances = new WeakSet(), _EntraGroupMemberAddComma
|
|
|
130
160
|
return `The following GUIDs are invalid for the option 'ids': ${isValidGUIDArrayResult}.`;
|
|
131
161
|
}
|
|
132
162
|
}
|
|
163
|
+
if (args.options.userIds) {
|
|
164
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.userIds);
|
|
165
|
+
if (isValidGUIDArrayResult !== true) {
|
|
166
|
+
return `The following GUIDs are invalid for the option 'userIds': ${isValidGUIDArrayResult}.`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
133
169
|
if (args.options.userNames) {
|
|
134
170
|
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.userNames);
|
|
135
171
|
if (isValidUPNArrayResult !== true) {
|
|
136
172
|
return `The following user principal names are invalid for the option 'userNames': ${isValidUPNArrayResult}.`;
|
|
137
173
|
}
|
|
138
174
|
}
|
|
175
|
+
if (args.options.subgroupIds) {
|
|
176
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.subgroupIds);
|
|
177
|
+
if (isValidGUIDArrayResult !== true) {
|
|
178
|
+
return `The following GUIDs are invalid for the option 'subgroupIds': ${isValidGUIDArrayResult}.`;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if ((args.options.subgroupIds || args.options.subgroupNames) && args.options.role === 'Owner') {
|
|
182
|
+
return `Subgroups cannot be set as owners.`;
|
|
183
|
+
}
|
|
139
184
|
if (this.roleValues.indexOf(args.options.role) === -1) {
|
|
140
185
|
return `Option 'role' must be one of the following values: ${this.roleValues.join(', ')}.`;
|
|
141
186
|
}
|
|
142
187
|
return true;
|
|
143
188
|
});
|
|
144
189
|
}, _EntraGroupMemberAddCommand_initOptionSets = function _EntraGroupMemberAddCommand_initOptionSets() {
|
|
145
|
-
this.optionSets.push({ options: ['groupId', 'groupDisplayName', 'groupName'] }, { options: ['ids', 'userNames'] });
|
|
190
|
+
this.optionSets.push({ options: ['groupId', 'groupDisplayName', 'groupName'] }, { options: ['ids', 'userIds', 'userNames', 'subgroupIds', 'subgroupNames'] });
|
|
146
191
|
}, _EntraGroupMemberAddCommand_initTypes = function _EntraGroupMemberAddCommand_initTypes() {
|
|
147
|
-
this.types.string.push('groupId', 'groupDisplayName', 'groupName', 'ids', 'userNames', 'role');
|
|
192
|
+
this.types.string.push('groupId', 'groupDisplayName', 'groupName', 'ids', 'userIds', 'userNames', 'subgroupIds', 'subgroupNames', 'role');
|
|
148
193
|
};
|
|
149
194
|
export default new EntraGroupMemberAddCommand();
|
|
150
195
|
//# sourceMappingURL=group-member-add.js.map
|
|
@@ -32,8 +32,11 @@ class EntraGroupMemberSetCommand extends GraphCommand {
|
|
|
32
32
|
if (args.options.groupDisplayName) {
|
|
33
33
|
await this.warn(logger, `Option 'groupDisplayName' is deprecated and will be removed in the next major release.`);
|
|
34
34
|
}
|
|
35
|
+
if (args.options.ids) {
|
|
36
|
+
await this.warn(logger, `Option 'ids' is deprecated and will be removed in the next major release. Please use 'userIds' instead.`);
|
|
37
|
+
}
|
|
35
38
|
if (this.verbose) {
|
|
36
|
-
await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userNames} to role ${args.options.role} of group ${args.options.groupId || args.options.groupDisplayName || args.options.groupName}...`);
|
|
39
|
+
await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userIds || args.options.userNames} to role ${args.options.role} of group ${args.options.groupId || args.options.groupDisplayName || args.options.groupName}...`);
|
|
37
40
|
}
|
|
38
41
|
const groupId = await this.getGroupId(logger, args.options);
|
|
39
42
|
const userIds = await this.getUserIds(logger, args.options);
|
|
@@ -60,6 +63,9 @@ class EntraGroupMemberSetCommand extends GraphCommand {
|
|
|
60
63
|
if (options.ids) {
|
|
61
64
|
return options.ids.split(',').map(i => i.trim());
|
|
62
65
|
}
|
|
66
|
+
if (options.userIds) {
|
|
67
|
+
return options.userIds.split(',').map(i => i.trim());
|
|
68
|
+
}
|
|
63
69
|
if (this.verbose) {
|
|
64
70
|
await logger.logToStderr('Retrieving ID(s) of user(s)...');
|
|
65
71
|
}
|
|
@@ -163,6 +169,7 @@ _EntraGroupMemberSetCommand_instances = new WeakSet(), _EntraGroupMemberSetComma
|
|
|
163
169
|
groupDisplayName: typeof args.options.groupDisplayName !== 'undefined',
|
|
164
170
|
groupName: typeof args.options.groupName !== 'undefined',
|
|
165
171
|
ids: typeof args.options.ids !== 'undefined',
|
|
172
|
+
userIds: typeof args.options.userIds !== 'undefined',
|
|
166
173
|
userNames: typeof args.options.userNames !== 'undefined'
|
|
167
174
|
});
|
|
168
175
|
});
|
|
@@ -175,6 +182,8 @@ _EntraGroupMemberSetCommand_instances = new WeakSet(), _EntraGroupMemberSetComma
|
|
|
175
182
|
option: '-n, --groupName [groupName]'
|
|
176
183
|
}, {
|
|
177
184
|
option: '--ids [ids]'
|
|
185
|
+
}, {
|
|
186
|
+
option: '--userIds [userIds]'
|
|
178
187
|
}, {
|
|
179
188
|
option: '--userNames [userNames]'
|
|
180
189
|
}, {
|
|
@@ -192,6 +201,12 @@ _EntraGroupMemberSetCommand_instances = new WeakSet(), _EntraGroupMemberSetComma
|
|
|
192
201
|
return `'${isValidGUIDArrayResult}' is not a valid GUID for option 'ids'.`;
|
|
193
202
|
}
|
|
194
203
|
}
|
|
204
|
+
if (args.options.userIds) {
|
|
205
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.userIds);
|
|
206
|
+
if (isValidGUIDArrayResult !== true) {
|
|
207
|
+
return `The following GUIDs are invalid for the option 'userIds': ${isValidGUIDArrayResult}.`;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
195
210
|
if (args.options.userNames) {
|
|
196
211
|
const isValidUserPrincipalNameArray = validation.isValidUserPrincipalNameArray(args.options.userNames);
|
|
197
212
|
if (isValidUserPrincipalNameArray !== true) {
|
|
@@ -204,9 +219,9 @@ _EntraGroupMemberSetCommand_instances = new WeakSet(), _EntraGroupMemberSetComma
|
|
|
204
219
|
return true;
|
|
205
220
|
});
|
|
206
221
|
}, _EntraGroupMemberSetCommand_initOptionSets = function _EntraGroupMemberSetCommand_initOptionSets() {
|
|
207
|
-
this.optionSets.push({ options: ['groupId', 'groupDisplayName', 'groupName'] }, { options: ['ids', 'userNames'] });
|
|
222
|
+
this.optionSets.push({ options: ['groupId', 'groupDisplayName', 'groupName'] }, { options: ['ids', 'userIds', 'userNames'] });
|
|
208
223
|
}, _EntraGroupMemberSetCommand_initTypes = function _EntraGroupMemberSetCommand_initTypes() {
|
|
209
|
-
this.types.string.push('groupId', 'groupDisplayName', 'groupName', 'ids', 'userNames', 'role');
|
|
224
|
+
this.types.string.push('groupId', 'groupDisplayName', 'groupName', 'ids', 'userIds', 'userNames', 'role');
|
|
210
225
|
};
|
|
211
226
|
export default new EntraGroupMemberSetCommand();
|
|
212
227
|
//# sourceMappingURL=group-member-set.js.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import { zod } from '../../../../utils/zod.js';
|
|
4
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
|
+
import commands from '../../commands.js';
|
|
6
|
+
import { validation } from '../../../../utils/validation.js';
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { odata } from '../../../../utils/odata.js';
|
|
9
|
+
const options = globalOptionsZod
|
|
10
|
+
.extend({
|
|
11
|
+
id: zod.alias('i', z.string().refine(id => validation.isValidGuid(id), id => ({
|
|
12
|
+
message: `'${id}' is not a valid GUID.`
|
|
13
|
+
})).optional()),
|
|
14
|
+
displayName: zod.alias('d', z.string().optional()),
|
|
15
|
+
marketingNotificationEmails: z.string().refine(emails => validation.isValidUserPrincipalNameArray(emails) === true, invalidEmails => ({
|
|
16
|
+
message: `The following marketing notification emails are invalid: ${invalidEmails}.`
|
|
17
|
+
})).transform((value) => value.split(',')).optional(),
|
|
18
|
+
securityComplianceNotificationMails: z.string().refine(emails => validation.isValidUserPrincipalNameArray(emails) === true, invalidEmails => ({
|
|
19
|
+
message: `The following security compliance notification emails are invalid: ${invalidEmails}.`
|
|
20
|
+
})).transform((value) => value.split(',')).optional(),
|
|
21
|
+
securityComplianceNotificationPhones: z.string().transform((value) => value.split(',')).optional(),
|
|
22
|
+
technicalNotificationMails: z.string().refine(emails => validation.isValidUserPrincipalNameArray(emails) === true, invalidEmails => ({
|
|
23
|
+
message: `The following technical notification emails are invalid: ${invalidEmails}.`
|
|
24
|
+
})).transform((value) => value.split(',')).optional(),
|
|
25
|
+
contactEmail: z.string().refine(id => validation.isValidUserPrincipalName(id), id => ({
|
|
26
|
+
message: `'${id}' is not a valid email.`
|
|
27
|
+
})).optional(),
|
|
28
|
+
statementUrl: z.string().optional()
|
|
29
|
+
})
|
|
30
|
+
.strict();
|
|
31
|
+
class EntraOrganizationSetCommand extends GraphCommand {
|
|
32
|
+
get name() {
|
|
33
|
+
return commands.ORGANIZATION_SET;
|
|
34
|
+
}
|
|
35
|
+
get description() {
|
|
36
|
+
return 'Updates info about the organization';
|
|
37
|
+
}
|
|
38
|
+
get schema() {
|
|
39
|
+
return options;
|
|
40
|
+
}
|
|
41
|
+
getRefinedSchema(schema) {
|
|
42
|
+
return schema
|
|
43
|
+
.refine(options => !(options.id && options.displayName), {
|
|
44
|
+
message: 'Specify either id or displayName, but not both'
|
|
45
|
+
})
|
|
46
|
+
.refine(options => options.id || options.displayName, {
|
|
47
|
+
message: 'Specify either id or displayName'
|
|
48
|
+
})
|
|
49
|
+
.refine(options => [options.contactEmail, options.marketingNotificationEmails, options.securityComplianceNotificationMails, options.securityComplianceNotificationPhones,
|
|
50
|
+
options.statementUrl, options.technicalNotificationMails].filter(o => o !== undefined).length > 0, {
|
|
51
|
+
message: 'Specify at least one of the following options: contactEmail, marketingNotificationEmails, securityComplianceNotificationMails, securityComplianceNotificationPhones, statementUrl, or technicalNotificationMails'
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async commandAction(logger, args) {
|
|
55
|
+
try {
|
|
56
|
+
let organizationId = args.options.id;
|
|
57
|
+
if (args.options.displayName) {
|
|
58
|
+
organizationId = await this.getOrganizationIdByDisplayName(args.options.displayName);
|
|
59
|
+
}
|
|
60
|
+
if (args.options.verbose) {
|
|
61
|
+
await logger.logToStderr(`Updating organization with ID ${organizationId}...`);
|
|
62
|
+
}
|
|
63
|
+
const data = {
|
|
64
|
+
marketingNotificationEmails: args.options.marketingNotificationEmails,
|
|
65
|
+
securityComplianceNotificationMails: args.options.securityComplianceNotificationMails,
|
|
66
|
+
securityComplianceNotificationPhones: args.options.securityComplianceNotificationPhones,
|
|
67
|
+
technicalNotificationMails: args.options.technicalNotificationMails
|
|
68
|
+
};
|
|
69
|
+
if (args.options.contactEmail || args.options.statementUrl) {
|
|
70
|
+
data.privacyProfile = {};
|
|
71
|
+
}
|
|
72
|
+
if (args.options.contactEmail) {
|
|
73
|
+
data.privacyProfile.contactEmail = args.options.contactEmail;
|
|
74
|
+
}
|
|
75
|
+
if (args.options.statementUrl) {
|
|
76
|
+
data.privacyProfile.statementUrl = args.options.statementUrl;
|
|
77
|
+
}
|
|
78
|
+
const requestOptions = {
|
|
79
|
+
url: `${this.resource}/v1.0/organization/${organizationId}`,
|
|
80
|
+
headers: {
|
|
81
|
+
accept: 'application/json;odata.metadata=none',
|
|
82
|
+
'content-type': 'application/json'
|
|
83
|
+
},
|
|
84
|
+
data: data,
|
|
85
|
+
responseType: 'json'
|
|
86
|
+
};
|
|
87
|
+
await request.patch(requestOptions);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
this.handleRejectedODataJsonPromise(err);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async getOrganizationIdByDisplayName(displayName) {
|
|
94
|
+
const url = `${this.resource}/v1.0/organization?$select=id,displayName`;
|
|
95
|
+
// the endpoint always returns one item
|
|
96
|
+
const organizations = await odata.getAllItems(url);
|
|
97
|
+
if (organizations[0].displayName !== displayName) {
|
|
98
|
+
throw `The specified organization '${displayName}' does not exist.`;
|
|
99
|
+
}
|
|
100
|
+
return organizations[0].id;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export default new EntraOrganizationSetCommand();
|
|
104
|
+
//# sourceMappingURL=organization-set.js.map
|
|
@@ -84,6 +84,7 @@ export default {
|
|
|
84
84
|
OAUTH2GRANT_REMOVE: `${prefix} oauth2grant remove`,
|
|
85
85
|
OAUTH2GRANT_SET: `${prefix} oauth2grant set`,
|
|
86
86
|
ORGANIZATION_LIST: `${prefix} organization list`,
|
|
87
|
+
ORGANIZATION_SET: `${prefix} organization set`,
|
|
87
88
|
PIM_ROLE_ASSIGNMENT_ADD: `${prefix} pim role assignment add`,
|
|
88
89
|
PIM_ROLE_ASSIGNMENT_LIST: `${prefix} pim role assignment list`,
|
|
89
90
|
PIM_ROLE_ASSIGNMENT_REMOVE: `${prefix} pim role assignment remove`,
|
|
@@ -9,7 +9,7 @@ import { formatting } from '../../../../utils/formatting.js';
|
|
|
9
9
|
import commands from '../../commands.js';
|
|
10
10
|
import { Outlook } from '../../Outlook.js';
|
|
11
11
|
import { cli } from '../../../../cli/cli.js';
|
|
12
|
-
import DelegatedGraphCommand from '../../../base/
|
|
12
|
+
import DelegatedGraphCommand from '../../../base/GraphDelegatedCommand.js';
|
|
13
13
|
class OutlookMessageMoveCommand extends DelegatedGraphCommand {
|
|
14
14
|
get name() {
|
|
15
15
|
return commands.MESSAGE_MOVE;
|
|
@@ -5,11 +5,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _PpManagementAppAddCommand_instances, _PpManagementAppAddCommand_initTelemetry, _PpManagementAppAddCommand_initOptions, _PpManagementAppAddCommand_initValidators, _PpManagementAppAddCommand_initOptionSets;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
|
-
import { formatting } from '../../../../utils/formatting.js';
|
|
9
8
|
import { validation } from '../../../../utils/validation.js';
|
|
10
9
|
import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
|
|
11
10
|
import commands from '../../commands.js';
|
|
12
|
-
import {
|
|
11
|
+
import { entraApp } from '../../../../utils/entraApp.js';
|
|
13
12
|
class PpManagementAppAddCommand extends PowerPlatformCommand {
|
|
14
13
|
get name() {
|
|
15
14
|
return commands.MANAGEMENTAPP_ADD;
|
|
@@ -48,27 +47,14 @@ class PpManagementAppAddCommand extends PowerPlatformCommand {
|
|
|
48
47
|
return args.options.appId;
|
|
49
48
|
}
|
|
50
49
|
const { objectId, name } = args.options;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const requestOptions = {
|
|
55
|
-
url: `https://graph.microsoft.com/v1.0/myorganization/applications?$filter=${filter}&$select=appId`,
|
|
56
|
-
headers: {
|
|
57
|
-
accept: 'application/json;odata.metadata=none'
|
|
58
|
-
},
|
|
59
|
-
responseType: 'json'
|
|
60
|
-
};
|
|
61
|
-
const entraApps = await request.get((requestOptions));
|
|
62
|
-
if (entraApps.value.length === 0) {
|
|
63
|
-
const applicationIdentifier = objectId ? `ID ${objectId}` : `name ${name}`;
|
|
64
|
-
throw `No Microsoft Entra application registration with ${applicationIdentifier} found`;
|
|
50
|
+
if (objectId) {
|
|
51
|
+
const app = await entraApp.getAppRegistrationByObjectId(objectId, ['appId']);
|
|
52
|
+
return app.appId;
|
|
65
53
|
}
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
else {
|
|
55
|
+
const app = await entraApp.getAppRegistrationByAppName(name, ['appId']);
|
|
56
|
+
return app.appId;
|
|
68
57
|
}
|
|
69
|
-
const resultAsKeyValuePair = formatting.convertArrayToHashTable('appId', entraApps.value);
|
|
70
|
-
const result = await cli.handleMultipleResultsFound(`Multiple Microsoft Entra application registrations with name '${name}' found.`, resultAsKeyValuePair);
|
|
71
|
-
return result.appId;
|
|
72
58
|
}
|
|
73
59
|
}
|
|
74
60
|
_PpManagementAppAddCommand_instances = new WeakSet(), _PpManagementAppAddCommand_initTelemetry = function _PpManagementAppAddCommand_initTelemetry() {
|