@pnp/cli-microsoft365 8.1.0-beta.bf59841 → 9.0.0-beta.1516729
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/Auth.js +11 -12
- package/dist/Command.js +1 -3
- package/dist/cli/cli.js +68 -14
- package/dist/config.js +60 -5
- package/dist/m365/base/SpoCommand.js +1 -1
- package/dist/m365/cli/commands/cli-consent.js +2 -2
- package/dist/m365/cli/commands/cli-doctor.js +2 -2
- package/dist/m365/cli/commands/cli-reconsent.js +2 -3
- package/dist/m365/cli/commands/config/config-set.js +12 -3
- package/dist/m365/commands/login.js +38 -14
- package/dist/m365/commands/setup.js +256 -33
- package/dist/m365/connection/commands/connection-list.js +4 -4
- package/dist/m365/entra/commands/app/app-add.js +52 -288
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-remove.js +123 -0
- package/dist/m365/entra/commands/group/group-set.js +256 -0
- package/dist/m365/entra/commands/m365group/m365group-user-add.js +109 -32
- package/dist/m365/entra/commands/m365group/m365group-user-set.js +159 -84
- package/dist/m365/entra/commands.js +3 -0
- package/dist/m365/flow/commands/flow-get.js +1 -1
- package/dist/m365/onenote/commands/notebook/notebook-add.js +132 -0
- package/dist/m365/onenote/commands.js +1 -0
- package/dist/m365/pa/commands/app/app-export.js +13 -7
- package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +86 -0
- package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +110 -0
- package/dist/m365/spo/commands/list/ListInstance.js +6 -1
- package/dist/m365/spo/commands/list/list-get.js +9 -3
- package/dist/m365/spo/commands/site/site-get.js +12 -16
- package/dist/m365/spo/commands.js +2 -0
- package/dist/m365/teams/commands/message/message-restore.js +106 -0
- package/dist/m365/teams/commands.js +1 -0
- package/dist/settingsNames.js +7 -1
- package/dist/utils/drive.js +61 -0
- package/dist/utils/entraApp.js +283 -0
- package/dist/utils/spo.js +32 -0
- package/docs/docs/_clisettings.mdx +6 -0
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-remove.mdx +65 -0
- package/docs/docs/cmd/entra/group/group-add.mdx +0 -4
- package/docs/docs/cmd/entra/group/group-set.mdx +89 -0
- package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +28 -10
- package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +35 -11
- package/docs/docs/cmd/flow/flow-get.mdx +149 -283
- package/docs/docs/cmd/onenote/notebook/notebook-add.mdx +169 -0
- package/docs/docs/cmd/pa/app/app-export.mdx +15 -9
- package/docs/docs/cmd/setup.mdx +16 -3
- package/docs/docs/cmd/spo/app/app-uninstall.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +110 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +114 -0
- package/docs/docs/cmd/spo/list/list-get.mdx +6 -0
- package/docs/docs/cmd/teams/message/message-remove.mdx +2 -1
- package/docs/docs/cmd/teams/message/message-restore.mdx +62 -0
- package/npm-shrinkwrap.json +574 -480
- package/package.json +22 -23
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import request from '../request.js';
|
|
3
|
+
import { odata } from './odata.js';
|
|
4
|
+
async function getCertificateBase64Encoded({ options, logger, debug }) {
|
|
5
|
+
if (options.certificateBase64Encoded) {
|
|
6
|
+
return options.certificateBase64Encoded;
|
|
7
|
+
}
|
|
8
|
+
if (debug) {
|
|
9
|
+
await logger.logToStderr(`Reading existing ${options.certificateFile}...`);
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
return fs.readFileSync(options.certificateFile, { encoding: 'base64' });
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
throw new Error(`Error reading certificate file: ${e}. Please add the certificate using base64 option '--certificateBase64Encoded'.`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async function createServicePrincipal(appId) {
|
|
19
|
+
const requestOptions = {
|
|
20
|
+
url: `https://graph.microsoft.com/v1.0/myorganization/servicePrincipals`,
|
|
21
|
+
headers: {
|
|
22
|
+
'content-type': 'application/json'
|
|
23
|
+
},
|
|
24
|
+
data: {
|
|
25
|
+
appId: appId
|
|
26
|
+
},
|
|
27
|
+
responseType: 'json'
|
|
28
|
+
};
|
|
29
|
+
return request.post(requestOptions);
|
|
30
|
+
}
|
|
31
|
+
async function grantOAuth2Permission({ appId, resourceId, scopeName }) {
|
|
32
|
+
const grantAdminConsentApplicationRequestOptions = {
|
|
33
|
+
url: `https://graph.microsoft.com/v1.0/myorganization/oauth2PermissionGrants`,
|
|
34
|
+
headers: {
|
|
35
|
+
accept: 'application/json;odata.metadata=none'
|
|
36
|
+
},
|
|
37
|
+
responseType: 'json',
|
|
38
|
+
data: {
|
|
39
|
+
clientId: appId,
|
|
40
|
+
consentType: "AllPrincipals",
|
|
41
|
+
principalId: null,
|
|
42
|
+
resourceId: resourceId,
|
|
43
|
+
scope: scopeName
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return request.post(grantAdminConsentApplicationRequestOptions);
|
|
47
|
+
}
|
|
48
|
+
async function addRoleToServicePrincipal({ objectId, resourceId, appRoleId }) {
|
|
49
|
+
const requestOptions = {
|
|
50
|
+
url: `https://graph.microsoft.com/v1.0/myorganization/servicePrincipals/${objectId}/appRoleAssignments`,
|
|
51
|
+
headers: {
|
|
52
|
+
'Content-Type': 'application/json'
|
|
53
|
+
},
|
|
54
|
+
responseType: 'json',
|
|
55
|
+
data: {
|
|
56
|
+
appRoleId: appRoleId,
|
|
57
|
+
principalId: objectId,
|
|
58
|
+
resourceId: resourceId
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return request.post(requestOptions);
|
|
62
|
+
}
|
|
63
|
+
async function getRequiredResourceAccessForApis({ servicePrincipals, apis, scopeType, logger, debug }) {
|
|
64
|
+
if (!apis) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
const resolvedApis = [];
|
|
68
|
+
const requestedApis = apis.split(',').map(a => a.trim());
|
|
69
|
+
for (const api of requestedApis) {
|
|
70
|
+
const pos = api.lastIndexOf('/');
|
|
71
|
+
const permissionName = api.substring(pos + 1);
|
|
72
|
+
const servicePrincipalName = api.substring(0, pos);
|
|
73
|
+
if (debug) {
|
|
74
|
+
await logger.logToStderr(`Resolving ${api}...`);
|
|
75
|
+
await logger.logToStderr(`Permission name: ${permissionName}`);
|
|
76
|
+
await logger.logToStderr(`Service principal name: ${servicePrincipalName}`);
|
|
77
|
+
}
|
|
78
|
+
const servicePrincipal = servicePrincipals.find(sp => (sp.servicePrincipalNames.indexOf(servicePrincipalName) > -1 ||
|
|
79
|
+
sp.servicePrincipalNames.indexOf(`${servicePrincipalName}/`) > -1));
|
|
80
|
+
if (!servicePrincipal) {
|
|
81
|
+
throw `Service principal ${servicePrincipalName} not found`;
|
|
82
|
+
}
|
|
83
|
+
const scopesOfType = scopeType === 'Scope' ? servicePrincipal.oauth2PermissionScopes : servicePrincipal.appRoles;
|
|
84
|
+
const permission = scopesOfType.find(scope => scope.value === permissionName);
|
|
85
|
+
if (!permission) {
|
|
86
|
+
throw `Permission ${permissionName} for service principal ${servicePrincipalName} not found`;
|
|
87
|
+
}
|
|
88
|
+
let resolvedApi = resolvedApis.find(a => a.resourceAppId === servicePrincipal.appId);
|
|
89
|
+
if (!resolvedApi) {
|
|
90
|
+
resolvedApi = {
|
|
91
|
+
resourceAppId: servicePrincipal.appId,
|
|
92
|
+
resourceAccess: []
|
|
93
|
+
};
|
|
94
|
+
resolvedApis.push(resolvedApi);
|
|
95
|
+
}
|
|
96
|
+
const resourceAccessPermission = {
|
|
97
|
+
id: permission.id,
|
|
98
|
+
type: scopeType
|
|
99
|
+
};
|
|
100
|
+
resolvedApi.resourceAccess.push(resourceAccessPermission);
|
|
101
|
+
updateAppPermissions({
|
|
102
|
+
spId: servicePrincipal.id,
|
|
103
|
+
resourceAccessPermission,
|
|
104
|
+
oAuth2PermissionValue: permission.value
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return resolvedApis;
|
|
108
|
+
}
|
|
109
|
+
function updateAppPermissions({ spId, resourceAccessPermission, oAuth2PermissionValue }) {
|
|
110
|
+
// During API resolution, we store globally both app role assignments and oauth2permissions
|
|
111
|
+
// So that we'll be able to parse them during the admin consent process
|
|
112
|
+
let existingPermission = entraApp.appPermissions.find(oauth => oauth.resourceId === spId);
|
|
113
|
+
if (!existingPermission) {
|
|
114
|
+
existingPermission = {
|
|
115
|
+
resourceId: spId,
|
|
116
|
+
resourceAccess: [],
|
|
117
|
+
scope: []
|
|
118
|
+
};
|
|
119
|
+
entraApp.appPermissions.push(existingPermission);
|
|
120
|
+
}
|
|
121
|
+
if (resourceAccessPermission.type === 'Scope' && oAuth2PermissionValue && !existingPermission.scope.find(scp => scp === oAuth2PermissionValue)) {
|
|
122
|
+
existingPermission.scope.push(oAuth2PermissionValue);
|
|
123
|
+
}
|
|
124
|
+
if (!existingPermission.resourceAccess.find(res => res.id === resourceAccessPermission.id)) {
|
|
125
|
+
existingPermission.resourceAccess.push(resourceAccessPermission);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export const entraApp = {
|
|
129
|
+
appPermissions: [],
|
|
130
|
+
createAppRegistration: async ({ options, apis, logger, verbose, debug }) => {
|
|
131
|
+
const applicationInfo = {
|
|
132
|
+
displayName: options.name,
|
|
133
|
+
signInAudience: options.multitenant ? 'AzureADMultipleOrgs' : 'AzureADMyOrg'
|
|
134
|
+
};
|
|
135
|
+
if (apis.length > 0) {
|
|
136
|
+
applicationInfo.requiredResourceAccess = apis;
|
|
137
|
+
}
|
|
138
|
+
if (options.redirectUris) {
|
|
139
|
+
applicationInfo[options.platform] = {
|
|
140
|
+
redirectUris: options.redirectUris.split(',').map(u => u.trim())
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (options.implicitFlow) {
|
|
144
|
+
if (!applicationInfo.web) {
|
|
145
|
+
applicationInfo.web = {};
|
|
146
|
+
}
|
|
147
|
+
applicationInfo.web.implicitGrantSettings = {
|
|
148
|
+
enableAccessTokenIssuance: true,
|
|
149
|
+
enableIdTokenIssuance: true
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (options.certificateFile || options.certificateBase64Encoded) {
|
|
153
|
+
const certificateBase64Encoded = await getCertificateBase64Encoded({ options, logger, debug });
|
|
154
|
+
const newKeyCredential = {
|
|
155
|
+
type: 'AsymmetricX509Cert',
|
|
156
|
+
usage: 'Verify',
|
|
157
|
+
displayName: options.certificateDisplayName,
|
|
158
|
+
key: certificateBase64Encoded
|
|
159
|
+
};
|
|
160
|
+
applicationInfo.keyCredentials = [newKeyCredential];
|
|
161
|
+
}
|
|
162
|
+
if (options.allowPublicClientFlows) {
|
|
163
|
+
applicationInfo.isFallbackPublicClient = true;
|
|
164
|
+
}
|
|
165
|
+
if (verbose) {
|
|
166
|
+
await logger.logToStderr(`Creating Microsoft Entra app registration...`);
|
|
167
|
+
}
|
|
168
|
+
const createApplicationRequestOptions = {
|
|
169
|
+
url: `https://graph.microsoft.com/v1.0/myorganization/applications`,
|
|
170
|
+
headers: {
|
|
171
|
+
accept: 'application/json;odata.metadata=none'
|
|
172
|
+
},
|
|
173
|
+
responseType: 'json',
|
|
174
|
+
data: applicationInfo
|
|
175
|
+
};
|
|
176
|
+
return request.post(createApplicationRequestOptions);
|
|
177
|
+
},
|
|
178
|
+
grantAdminConsent: async ({ appInfo, appPermissions, adminConsent, logger, debug }) => {
|
|
179
|
+
if (!adminConsent || appPermissions.length === 0) {
|
|
180
|
+
return appInfo;
|
|
181
|
+
}
|
|
182
|
+
const sp = await createServicePrincipal(appInfo.appId);
|
|
183
|
+
if (debug) {
|
|
184
|
+
await logger.logToStderr("Service principal created, returned object id: " + sp.id);
|
|
185
|
+
}
|
|
186
|
+
const tasks = [];
|
|
187
|
+
appPermissions.forEach(async (permission) => {
|
|
188
|
+
if (permission.scope.length > 0) {
|
|
189
|
+
tasks.push(grantOAuth2Permission({
|
|
190
|
+
appId: sp.id,
|
|
191
|
+
resourceId: permission.resourceId,
|
|
192
|
+
scopeName: permission.scope.join(' ')
|
|
193
|
+
}));
|
|
194
|
+
if (debug) {
|
|
195
|
+
await logger.logToStderr(`Admin consent granted for following resource ${permission.resourceId}, with delegated permissions: ${permission.scope.join(',')}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
permission.resourceAccess.filter(access => access.type === "Role").forEach(async (access) => {
|
|
199
|
+
tasks.push(addRoleToServicePrincipal({
|
|
200
|
+
objectId: sp.id,
|
|
201
|
+
resourceId: permission.resourceId,
|
|
202
|
+
appRoleId: access.id
|
|
203
|
+
}));
|
|
204
|
+
if (debug) {
|
|
205
|
+
await logger.logToStderr(`Admin consent granted for following resource ${permission.resourceId}, with application permission: ${access.id}`);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
await Promise.all(tasks);
|
|
210
|
+
return appInfo;
|
|
211
|
+
},
|
|
212
|
+
resolveApis: async ({ options, manifest, logger, verbose, debug }) => {
|
|
213
|
+
if (!options.apisDelegated && !options.apisApplication
|
|
214
|
+
&& (typeof manifest?.requiredResourceAccess === 'undefined' || manifest.requiredResourceAccess.length === 0)) {
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
if (verbose) {
|
|
218
|
+
await logger.logToStderr('Resolving requested APIs...');
|
|
219
|
+
}
|
|
220
|
+
const servicePrincipals = await odata.getAllItems(`https://graph.microsoft.com/v1.0/myorganization/servicePrincipals?$select=appId,appRoles,id,oauth2PermissionScopes,servicePrincipalNames`);
|
|
221
|
+
let resolvedApis = [];
|
|
222
|
+
if (options.apisDelegated || options.apisApplication) {
|
|
223
|
+
resolvedApis = await getRequiredResourceAccessForApis({
|
|
224
|
+
servicePrincipals,
|
|
225
|
+
apis: options.apisDelegated,
|
|
226
|
+
scopeType: 'Scope',
|
|
227
|
+
logger,
|
|
228
|
+
debug
|
|
229
|
+
});
|
|
230
|
+
if (verbose) {
|
|
231
|
+
await logger.logToStderr(`Resolved delegated permissions: ${JSON.stringify(resolvedApis, null, 2)}`);
|
|
232
|
+
}
|
|
233
|
+
const resolvedApplicationApis = await getRequiredResourceAccessForApis({
|
|
234
|
+
servicePrincipals,
|
|
235
|
+
apis: options.apisApplication,
|
|
236
|
+
scopeType: 'Role',
|
|
237
|
+
logger,
|
|
238
|
+
debug
|
|
239
|
+
});
|
|
240
|
+
if (verbose) {
|
|
241
|
+
await logger.logToStderr(`Resolved application permissions: ${JSON.stringify(resolvedApplicationApis, null, 2)}`);
|
|
242
|
+
}
|
|
243
|
+
// merge resolved application APIs onto resolved delegated APIs
|
|
244
|
+
resolvedApplicationApis.forEach(resolvedRequiredResource => {
|
|
245
|
+
const requiredResource = resolvedApis.find(api => api.resourceAppId === resolvedRequiredResource.resourceAppId);
|
|
246
|
+
if (requiredResource) {
|
|
247
|
+
requiredResource.resourceAccess.push(...resolvedRequiredResource.resourceAccess);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
resolvedApis.push(resolvedRequiredResource);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
const manifestApis = manifest.requiredResourceAccess;
|
|
256
|
+
manifestApis.forEach(manifestApi => {
|
|
257
|
+
resolvedApis.push(manifestApi);
|
|
258
|
+
const app = servicePrincipals.find(servicePrincipals => servicePrincipals.appId === manifestApi.resourceAppId);
|
|
259
|
+
if (app) {
|
|
260
|
+
manifestApi.resourceAccess.forEach((res => {
|
|
261
|
+
const resourceAccessPermission = {
|
|
262
|
+
id: res.id,
|
|
263
|
+
type: res.type
|
|
264
|
+
};
|
|
265
|
+
const oAuthValue = app.oauth2PermissionScopes.find(scp => scp.id === res.id)?.value;
|
|
266
|
+
updateAppPermissions({
|
|
267
|
+
spId: app.id,
|
|
268
|
+
resourceAccessPermission,
|
|
269
|
+
oAuth2PermissionValue: oAuthValue
|
|
270
|
+
});
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
if (verbose) {
|
|
276
|
+
await logger.logToStderr(`Merged delegated and application permissions: ${JSON.stringify(resolvedApis, null, 2)}`);
|
|
277
|
+
await logger.logToStderr(`App role assignments: ${JSON.stringify(entraApp.appPermissions.flatMap(permission => permission.resourceAccess.filter(access => access.type === "Role")), null, 2)}`);
|
|
278
|
+
await logger.logToStderr(`OAuth2 permissions: ${JSON.stringify(entraApp.appPermissions.flatMap(permission => permission.scope), null, 2)}`);
|
|
279
|
+
}
|
|
280
|
+
return resolvedApis;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
//# sourceMappingURL=entraApp.js.map
|
package/dist/utils/spo.js
CHANGED
|
@@ -1405,6 +1405,38 @@ export const spo = {
|
|
|
1405
1405
|
const site = await request.get(requestOptions);
|
|
1406
1406
|
return site.id;
|
|
1407
1407
|
},
|
|
1408
|
+
/**
|
|
1409
|
+
* Retrieves the server-relative URL of a folder.
|
|
1410
|
+
* @param webUrl Web URL
|
|
1411
|
+
* @param folderUrl Folder URL
|
|
1412
|
+
* @param folderId Folder ID
|
|
1413
|
+
* @param logger The logger object
|
|
1414
|
+
* @param verbose Set for verbose logging
|
|
1415
|
+
* @returns The server-relative URL of the folder
|
|
1416
|
+
*/
|
|
1417
|
+
async getFolderServerRelativeUrl(webUrl, folderUrl, folderId, logger, verbose) {
|
|
1418
|
+
if (verbose && logger) {
|
|
1419
|
+
await logger.logToStderr(`Retrieving server-relative URL for folder ${folderUrl ? `URL: ${folderUrl}` : `ID: ${folderId}`}`);
|
|
1420
|
+
}
|
|
1421
|
+
let requestUrl = `${webUrl}/_api/web/`;
|
|
1422
|
+
if (folderUrl) {
|
|
1423
|
+
const folderServerRelativeUrl = urlUtil.getServerRelativePath(webUrl, folderUrl);
|
|
1424
|
+
requestUrl += `GetFolderByServerRelativePath(decodedUrl='${formatting.encodeQueryParameter(folderServerRelativeUrl)}')`;
|
|
1425
|
+
}
|
|
1426
|
+
else {
|
|
1427
|
+
requestUrl += `GetFolderById('${folderId}')`;
|
|
1428
|
+
}
|
|
1429
|
+
requestUrl += '?$select=ServerRelativeUrl';
|
|
1430
|
+
const requestOptions = {
|
|
1431
|
+
url: requestUrl,
|
|
1432
|
+
headers: {
|
|
1433
|
+
accept: 'application/json;odata=nometadata'
|
|
1434
|
+
},
|
|
1435
|
+
responseType: 'json'
|
|
1436
|
+
};
|
|
1437
|
+
const res = await request.get(requestOptions);
|
|
1438
|
+
return res.ServerRelativeUrl;
|
|
1439
|
+
},
|
|
1408
1440
|
/**
|
|
1409
1441
|
* Retrieves the ObjectIdentity from a SharePoint site
|
|
1410
1442
|
* @param webUrl web url
|
|
@@ -2,6 +2,11 @@ Setting name|Definition|Default value
|
|
|
2
2
|
------------|----------|-------------
|
|
3
3
|
`authType`|Default login method to use when running `m365 login` without the `--authType` option.|`deviceCode`
|
|
4
4
|
`autoOpenLinksInBrowser`|Automatically open the browser for all commands which return a url and expect the user to copy paste this to the browser. For example when logging in, using `m365 login` in device code mode.|`false`
|
|
5
|
+
`clientId`|ID of the default Entra ID app use by the CLI to authenticate|``
|
|
6
|
+
`clientSecret`|Secret of the default Entra ID app use by the CLI to authenticate|``
|
|
7
|
+
`clientCertificateFile`|Path to the file containing the client certificate to use for authentication|``
|
|
8
|
+
`clientCertificateBase64Encoded`|Base64-encoded client certificate contents|``
|
|
9
|
+
`clientCertificatePassword`|Password to the client certificate file|``
|
|
5
10
|
`copyDeviceCodeToClipboard`|Automatically copy the device code to the clipboard when running `m365 login` command in device code mode|`false`
|
|
6
11
|
`csvEscape`|Single character used for escaping; only apply to characters matching the quote and the escape options|`"`
|
|
7
12
|
`csvHeader`|Display the column names on the first line|`true`
|
|
@@ -18,3 +23,4 @@ Setting name|Definition|Default value
|
|
|
18
23
|
`promptListPageSize`|By default, lists of choices longer than 7 will be paginated. Use this option to control how many choices will appear on the screen at once.|7
|
|
19
24
|
`showHelpOnFailure`|Automatically display help when executing a command failed|`true`
|
|
20
25
|
`showSpinner`|Display spinner when executing commands|`true`
|
|
26
|
+
`tenantId`|ID of the default tenant to use when authenticating with|``
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
import Tabs from '@theme/Tabs';
|
|
3
|
+
import TabItem from '@theme/TabItem';
|
|
4
|
+
|
|
5
|
+
# entra enterpriseapp remove
|
|
6
|
+
|
|
7
|
+
Deletes an enterprise application (or service principal)
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
m365 entra enterpriseapp remove [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Alias
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
m365 entra sp remove [options]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Options
|
|
22
|
+
|
|
23
|
+
```md definition-list
|
|
24
|
+
`-i, --id [id]`
|
|
25
|
+
: ID of the enterprise application.
|
|
26
|
+
|
|
27
|
+
`-n, --displayName [displayName]`
|
|
28
|
+
: Display name of the enterprise application.
|
|
29
|
+
|
|
30
|
+
`--objectId [objectId]`
|
|
31
|
+
: ObjectId of the enterprise application.
|
|
32
|
+
|
|
33
|
+
`-f, --force`
|
|
34
|
+
: Don't prompt for confirmation.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<Global />
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
Delete an enterprise application by application ID.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
m365 entra enterpriseapp remove --id b2307a39-e878-458b-bc90-03bc578531d6 --force
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Delete an enterprise application by display name.
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
m365 entra enterpriseapp remove --displayName "Contoso app"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Delete an enterprise application by object ID.
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
m365 entra enterpriseapp remove --objectId b2307a39-e878-458b-bc90-03bc578531dd
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Response
|
|
60
|
+
|
|
61
|
+
The command won't return a response on success.
|
|
62
|
+
|
|
63
|
+
## More information
|
|
64
|
+
|
|
65
|
+
- Application and service principal objects in Microsoft Entra ID: [https://learn.microsoft.com/azure/active-directory/develop/active-directory-application-objects](https://learn.microsoft.com/azure/active-directory/develop/active-directory-application-objects)
|
|
@@ -53,8 +53,6 @@ m365 aad group add [options]
|
|
|
53
53
|
|
|
54
54
|
## Remarks
|
|
55
55
|
|
|
56
|
-
:::info
|
|
57
|
-
|
|
58
56
|
The `visibility` option affects the behavior of the group.
|
|
59
57
|
|
|
60
58
|
With the `Public` visibility:
|
|
@@ -74,8 +72,6 @@ With the `HiddenMembership` visibility:
|
|
|
74
72
|
- Administrators (global, company, user, and helpdesk) can view the membership of the group.
|
|
75
73
|
- The group appears in the global address book (GAL).
|
|
76
74
|
|
|
77
|
-
:::
|
|
78
|
-
|
|
79
75
|
:::note
|
|
80
76
|
|
|
81
77
|
The `HiddenMembership` visibility can be set only for Microsoft 365 groups when the groups are created. It can't be updated later.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
|
|
3
|
+
# entra group set
|
|
4
|
+
|
|
5
|
+
Updates a Microsoft Entra group
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
m365 entra group set [options]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Options
|
|
14
|
+
|
|
15
|
+
```md definition-list
|
|
16
|
+
`-i, --id [id]`
|
|
17
|
+
: The ID of the Microsoft Entra group to update. Specify either `id` or `displayName` but not both.
|
|
18
|
+
|
|
19
|
+
`-n, --displayName [displayName]`
|
|
20
|
+
: The display name of the Microsoft Entra group to update. Specify either `id` or `displayName` but not both.
|
|
21
|
+
|
|
22
|
+
`--newDisplayName [newDisplayName]`
|
|
23
|
+
: The new display name of the Microsoft Entra group. The maximum length is 256 characters.
|
|
24
|
+
|
|
25
|
+
`--description [description]`
|
|
26
|
+
: The new description for the group.
|
|
27
|
+
|
|
28
|
+
`--mailNickname [mailNickname]`
|
|
29
|
+
: The new mail alias for the group (part before the @). Use only for mail-enabled groups. Maximum length is 64 characters.
|
|
30
|
+
|
|
31
|
+
`--ownerIds [ownerIds]`
|
|
32
|
+
: Comma-separated list of IDs of Microsoft Entra users that will be the group owners. Specify either `ownerIds` or `ownerUserNames`, but not both.
|
|
33
|
+
|
|
34
|
+
`--ownerUserNames [ownerUserNames]`
|
|
35
|
+
: Comma-separated list of UPNs of Microsoft Entra users that will be the group owners. Specify either `ownerIds` or `ownerUserNames`, but not both.
|
|
36
|
+
|
|
37
|
+
`--memberIds [memberIds]`
|
|
38
|
+
: Comma-separated list of IDs of Microsoft Entra users that will be the group members. Specify either `memberIds` or `memberUserNames`, but not both.
|
|
39
|
+
|
|
40
|
+
`--memberUserNames [memberUserNames]`
|
|
41
|
+
: Comma-separated list of UPNs of Microsoft Entra users that will be the group members. Specify either `memberIds` or `memberUserNames`, but not both.
|
|
42
|
+
|
|
43
|
+
`--visibility [visibility]`
|
|
44
|
+
: Specifies the group join policy and group content visibility for Microsoft 365 groups. Possible values are: `Private` or `Public`. Specify only when targeting a Microsoft 365 group.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
<Global />
|
|
48
|
+
|
|
49
|
+
## Remarks
|
|
50
|
+
|
|
51
|
+
The `visibility` option affects the behavior of the group.
|
|
52
|
+
|
|
53
|
+
With the `Public` visibility:
|
|
54
|
+
- Anyone can join the group without needing owner approval.
|
|
55
|
+
- Anyone can view the attributes of the group.
|
|
56
|
+
- Anyone can see the members of the group.
|
|
57
|
+
|
|
58
|
+
With the `Private` visibilty:
|
|
59
|
+
- Owner approval is needed to join the group.
|
|
60
|
+
- Anyone can view the attributes of the group.
|
|
61
|
+
- Anyone can see the members of the group.
|
|
62
|
+
|
|
63
|
+
If the specified option is not found, you will receive a `Resource 'xyz' does not exist or one of its queried reference-property objects are not present.` error.
|
|
64
|
+
|
|
65
|
+
Specifying `memberIds` or `memberUserNames` will make only those users members, removing all others. Similarly, specifying `ownerIds` or `ownerUserNames` will make only those users owners, removing all others.
|
|
66
|
+
|
|
67
|
+
## Examples
|
|
68
|
+
|
|
69
|
+
Update the display name of a group specified by the display name
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
m365 entra group set --displayName Devs --newDisplayName Developers
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Set the owners of a group to the specified people
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
m365 entra group set --id 57fd6b33-54eb-42b0-9ea0-8a9ac04eab7d --ownerUserNames "john.doe@contoso.com,adele.vance@contoso.com"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Update the description and mail nickname of a group
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
m365 entra group set --id 57fd6b33-54eb-42b0-9ea0-8a9ac04eab7d --description "All developers of the company" --mailNickname developers
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Response
|
|
88
|
+
|
|
89
|
+
The command won't return a response on success.
|
|
@@ -26,13 +26,25 @@ m365 teams user add
|
|
|
26
26
|
|
|
27
27
|
```md definition-list
|
|
28
28
|
`-i, --groupId [groupId]`
|
|
29
|
-
: The ID of the Microsoft 365
|
|
29
|
+
: The ID of the Microsoft 365 group. Specify only one of the following: `groupId`, `groupName`, `teamId`, or `teamName`.
|
|
30
|
+
|
|
31
|
+
`--groupName [groupName]`
|
|
32
|
+
: The display name of the Microsoft 365 group. Specify only one of the following: `groupId`, `groupName`, `teamId`, or `teamName`.
|
|
30
33
|
|
|
31
34
|
`--teamId [teamId]`
|
|
32
|
-
: The ID of the Teams team
|
|
35
|
+
: The ID of the Teams team. Specify only one of the following: `groupId`, `groupName`, `teamId`, or `teamName`.
|
|
36
|
+
|
|
37
|
+
`--teamName [teamName]`
|
|
38
|
+
: The display name of the Microsoft Teams team. Specify only one of the following: `groupId`, `groupName`, `teamId`, or `teamName`.
|
|
39
|
+
|
|
40
|
+
`-n, --userName [userName]`
|
|
41
|
+
: (deprecated) User's UPN (User Principal Name), e.g. johndoe@example.com.
|
|
42
|
+
|
|
43
|
+
`--ids [ids]`
|
|
44
|
+
: Microsoft Entra IDs of users. You can also pass a comma-separated list of IDs. Specify either `ids` or `userNames` but not both.
|
|
33
45
|
|
|
34
|
-
|
|
35
|
-
:
|
|
46
|
+
`--userNames [userNames]`
|
|
47
|
+
: The user principal names of users. You can also pass a comma-separated list of UPNs. Specify either `ids` or `userNames` but not both.
|
|
36
48
|
|
|
37
49
|
`-r, --role [role]`
|
|
38
50
|
: The role to be assigned to the new user: `Owner,Member`. Default `Member`
|
|
@@ -42,22 +54,28 @@ m365 teams user add
|
|
|
42
54
|
|
|
43
55
|
## Examples
|
|
44
56
|
|
|
45
|
-
Add a new member to the specified Microsoft 365 Group
|
|
57
|
+
Add a new member with the userNames parameter to the specified Microsoft 365 Group
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
m365 entra m365group user add --groupId '00000000-0000-0000-0000-000000000000' --userNames 'anne.matthews@contoso.onmicrosoft.com'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Add multiple new owners with the userNames parameter to the specified Microsoft 365 Group
|
|
46
64
|
|
|
47
65
|
```sh
|
|
48
|
-
m365 entra m365group user add --
|
|
66
|
+
m365 entra m365group user add --groupName 'Contoso' --userNames 'anne.matthews@contoso.onmicrosoft.com, john.doe@contoso.onmicrosoft.com' --role Owner
|
|
49
67
|
```
|
|
50
68
|
|
|
51
|
-
Add a new
|
|
69
|
+
Add a new member with the userNames parameter to the specified Microsoft Teams team
|
|
52
70
|
|
|
53
71
|
```sh
|
|
54
|
-
m365 entra m365group
|
|
72
|
+
m365 entra m365group member add --teamId '00000000-0000-0000-0000-000000000000' --userNames 'anne.matthews@contoso.onmicrosoft.com' --role Member
|
|
55
73
|
```
|
|
56
74
|
|
|
57
|
-
Add
|
|
75
|
+
Add multiple new members with the ids parameter to the specified Microsoft Teams team
|
|
58
76
|
|
|
59
77
|
```sh
|
|
60
|
-
m365
|
|
78
|
+
m365 entra m365group user add --teamName 'Engineering' --ids '74a3b772-3122-447b-b9da-10895e238219,dd3d21e4-a142-46b9-8482-bca8fe9596b3' --role Member
|
|
61
79
|
```
|
|
62
80
|
|
|
63
81
|
## Response
|
|
@@ -2,7 +2,7 @@ import Global from '/docs/cmd/_global.mdx';
|
|
|
2
2
|
|
|
3
3
|
# entra m365group user set
|
|
4
4
|
|
|
5
|
-
Updates role of the specified
|
|
5
|
+
Updates role of the specified users in the specified Microsoft 365 Group or Microsoft Teams team
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
@@ -24,13 +24,25 @@ m365 aad teams user set
|
|
|
24
24
|
|
|
25
25
|
```md definition-list
|
|
26
26
|
`-i, --groupId [groupId]`
|
|
27
|
-
: The ID of the Microsoft 365 group
|
|
27
|
+
: The ID of the Microsoft 365 group. Specify only one of the following: `groupId`, `groupName`, `teamId`, or `teamName`.
|
|
28
|
+
|
|
29
|
+
`--groupName [groupName]`
|
|
30
|
+
: The display name of the Microsoft 365 group. Specify only one of the following: `groupId`, `groupName`, `teamId`, or `teamName`.
|
|
28
31
|
|
|
29
32
|
`--teamId [teamId]`
|
|
30
|
-
: The ID of the
|
|
33
|
+
: The ID of the Teams team. Specify only one of the following: `groupId`, `groupName`, `teamId`, or `teamName`.
|
|
34
|
+
|
|
35
|
+
`--teamName [teamName]`
|
|
36
|
+
: The display name of the Microsoft Teams team. Specify only one of the following: `groupId`, `groupName`, `teamId`, or `teamName`.
|
|
37
|
+
|
|
38
|
+
`-n, --userName [userName]`
|
|
39
|
+
: (deprecated) User's UPN (User Principal Name), e.g. johndoe@example.com.
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
:
|
|
41
|
+
`--ids [ids]`
|
|
42
|
+
: Microsoft Entra IDs of users. You can also pass a comma-separated list of IDs. Specify only one of the following `userName`, `ids` or `userNames`.
|
|
43
|
+
|
|
44
|
+
`--userNames [userNames]`
|
|
45
|
+
: The user principal names of users. You can also pass a comma-separated list of UPNs. Specify only one of the following `userName`, `ids` or `userNames`.
|
|
34
46
|
|
|
35
47
|
`-r, --role <role>`
|
|
36
48
|
: Role to set for the given user in the specified Microsoft 365 Group or Microsoft Teams team. Allowed values: `Owner`, `Member`
|
|
@@ -44,28 +56,40 @@ The command will return an error if the user already has the specified role in t
|
|
|
44
56
|
|
|
45
57
|
## Examples
|
|
46
58
|
|
|
47
|
-
Promote
|
|
59
|
+
Promote a single user to Owner of the given Microsoft 365 Group
|
|
48
60
|
|
|
49
61
|
```sh
|
|
50
62
|
m365 entra m365group user set --groupId '00000000-0000-0000-0000-000000000000' --userName 'anne.matthews@contoso.onmicrosoft.com' --role Owner
|
|
51
63
|
```
|
|
52
64
|
|
|
53
|
-
|
|
65
|
+
Promote multiple users specified by the userNames parameter to Owner of the given Microsoft 365 Group
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
m365 entra m365group user set --groupName 'Contoso' --userNames 'anne.matthews@contoso.onmicrosoft.com,john.doe@contoso.onmicrosoft.com' --role Owner
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Promote multiple users specified by the ids parameter to Owner of the given Microsoft 365 Group
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
m365 entra m365group user set --groupId '00000000-0000-0000-0000-000000000000' --ids '74a3b772-3122-447b-b9da-10895e238219,dd3d21e4-a142-46b9-8482-bca8fe9596b3' --role Owner
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Demote a single user from Owner to Member in the given Microsoft 365 Group
|
|
54
78
|
|
|
55
79
|
```sh
|
|
56
80
|
m365 entra m365group user set --groupId '00000000-0000-0000-0000-000000000000' --userName 'anne.matthews@contoso.onmicrosoft.com' --role Member
|
|
57
81
|
```
|
|
58
82
|
|
|
59
|
-
|
|
83
|
+
Demote multiple users specified by the userNames parameter from Owner to Member of the given Microsoft Teams team
|
|
60
84
|
|
|
61
85
|
```sh
|
|
62
|
-
m365 entra teams user set --teamId '00000000-0000-0000-0000-000000000000' --
|
|
86
|
+
m365 entra teams user set --teamId '00000000-0000-0000-0000-000000000000' --userNames 'anne.matthews@contoso.onmicrosoft.com,john.doe@contoso.onmicrosoft.com' --role Member
|
|
63
87
|
```
|
|
64
88
|
|
|
65
|
-
Demote
|
|
89
|
+
Demote multiple users specified by the ids parameter from Owner to Member in the given Microsoft Teams team
|
|
66
90
|
|
|
67
91
|
```sh
|
|
68
|
-
m365 entra teams user set --
|
|
92
|
+
m365 entra teams user set --teamName 'Engineering' --ids '74a3b772-3122-447b-b9da-10895e238219,dd3d21e4-a142-46b9-8482-bca8fe9596b3' --role Member
|
|
69
93
|
```
|
|
70
94
|
|
|
71
95
|
## Response
|