@pnp/cli-microsoft365 7.7.0-beta.72886a7 → 7.7.0-beta.7d3ef49
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 +1 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Command.js +1 -1
- package/dist/cli/cli.js +9 -4
- package/dist/m365/commands/setup.js +1 -7
- package/dist/m365/entra/commands/app/app-add.js +7 -1
- package/dist/m365/entra/commands/app/app-set.js +32 -3
- package/dist/m365/entra/commands/pim/pim-role-assignment-add.js +233 -0
- package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +122 -0
- package/dist/m365/entra/commands/user/user-list.js +20 -7
- package/dist/m365/entra/commands.js +2 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.3.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.10.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.11.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.12.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.12.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.13.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.13.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.14.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.15.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.15.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.16.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.16.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.3.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.4.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.19.0-beta.0.js +25 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.2.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.4.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.4.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.4.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.5.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.5.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.6.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.7.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.7.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.0.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.2.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.9.1.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/generic-rules.js +0 -2
- package/dist/m365/spfx/commands/project/project-doctor/rules/FN021001_PKG_spfx_deps_versions_match_project_version.js +3 -2
- package/dist/m365/spfx/commands/project/project-doctor/rules/FN021013_PKG_spfx_devdeps_match_version.js +58 -0
- package/dist/m365/spfx/commands/project/project-doctor/spfx-deps.js +2 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.19.0-beta.0.js +53 -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/contenttype/contenttype-sync.js +139 -0
- package/dist/m365/spo/commands/listitem/listitem-set.js +9 -156
- package/dist/m365/spo/commands/page/page-add.js +6 -24
- package/dist/m365/spo/commands/page/page-set.js +19 -43
- package/dist/m365/spo/commands/site/site-apppermission-remove.js +8 -9
- package/dist/m365/spo/commands/site/site-hubsite-connect.js +3 -3
- package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +2 -5
- package/dist/m365/spo/commands.js +1 -0
- package/dist/utils/prompt.js +2 -0
- package/dist/utils/spo.js +188 -0
- package/dist/utils/validation.js +4 -0
- package/docs/docs/cmd/entra/app/app-add.mdx +9 -0
- package/docs/docs/cmd/entra/app/app-set.mdx +9 -0
- package/docs/docs/cmd/entra/pim/pim-role-assignment-add.mdx +230 -0
- package/docs/docs/cmd/entra/pim/pim-role-assignment-list.mdx +224 -0
- package/docs/docs/cmd/entra/user/user-list.mdx +36 -15
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-sync.mdx +144 -0
- package/docs/docs/cmd/spo/page/page-set.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +1 -1
- package/npm-shrinkwrap.json +138 -214
- package/package.json +14 -14
package/dist/utils/spo.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os from 'os';
|
|
1
2
|
import url from 'url';
|
|
2
3
|
import { urlUtil } from "./urlUtil.js";
|
|
3
4
|
import { validation } from "./validation.js";
|
|
@@ -1231,6 +1232,113 @@ export const spo = {
|
|
|
1231
1232
|
};
|
|
1232
1233
|
await request.post(requestOptions);
|
|
1233
1234
|
},
|
|
1235
|
+
/**
|
|
1236
|
+
* Gets a file as list item by url
|
|
1237
|
+
* @param absoluteListUrl The absolute url to the list
|
|
1238
|
+
* @param url The url of the file
|
|
1239
|
+
* @param logger The logger object
|
|
1240
|
+
* @param verbose If in verbose mode
|
|
1241
|
+
* @returns The list item object
|
|
1242
|
+
*/
|
|
1243
|
+
async getFileAsListItemByUrl(absoluteListUrl, url, logger, verbose) {
|
|
1244
|
+
if (verbose && logger) {
|
|
1245
|
+
logger.logToStderr(`Getting the file properties with url ${url}`);
|
|
1246
|
+
}
|
|
1247
|
+
const serverRelativePath = urlUtil.getServerRelativePath(absoluteListUrl, url);
|
|
1248
|
+
const requestUrl = `${absoluteListUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl=@f)?$expand=ListItemAllFields&@f='${formatting.encodeQueryParameter(serverRelativePath)}'`;
|
|
1249
|
+
const requestOptions = {
|
|
1250
|
+
url: requestUrl,
|
|
1251
|
+
headers: {
|
|
1252
|
+
'accept': 'application/json;odata=nometadata'
|
|
1253
|
+
},
|
|
1254
|
+
responseType: 'json'
|
|
1255
|
+
};
|
|
1256
|
+
const file = await request.get(requestOptions);
|
|
1257
|
+
return file.ListItemAllFields;
|
|
1258
|
+
},
|
|
1259
|
+
/**
|
|
1260
|
+
* Updates a list item with system update
|
|
1261
|
+
* @param absoluteListUrl The absolute base URL without query parameters, pointing to the specific list where the item resides. This URL should represent the list.
|
|
1262
|
+
* @param itemId The id of the list item
|
|
1263
|
+
* @param properties An object of the properties that should be updated
|
|
1264
|
+
* @param contentTypeName The name of the content type to update
|
|
1265
|
+
* @param logger The logger object
|
|
1266
|
+
* @param verbose If in verbose mode
|
|
1267
|
+
* @returns The updated list item object
|
|
1268
|
+
*/
|
|
1269
|
+
async systemUpdateListItem(absoluteListUrl, itemId, logger, verbose, properties, contentTypeName) {
|
|
1270
|
+
if (!properties && !contentTypeName) {
|
|
1271
|
+
// Neither properties nor contentTypeName provided, no need to proceed
|
|
1272
|
+
throw 'Either properties or contentTypeName must be provided for systemUpdateListItem.';
|
|
1273
|
+
}
|
|
1274
|
+
const parsedUrl = new URL(absoluteListUrl);
|
|
1275
|
+
const serverRelativeSiteMatch = absoluteListUrl.match(new RegExp('/sites/[^/]+'));
|
|
1276
|
+
const webUrl = `${parsedUrl.protocol}//${parsedUrl.host}${serverRelativeSiteMatch ?? ''}`;
|
|
1277
|
+
if (verbose && logger) {
|
|
1278
|
+
logger.logToStderr(`Getting list id...`);
|
|
1279
|
+
}
|
|
1280
|
+
const listRequestOptions = {
|
|
1281
|
+
url: `${absoluteListUrl}?$select=Id`,
|
|
1282
|
+
headers: {
|
|
1283
|
+
'accept': 'application/json;odata=nometadata'
|
|
1284
|
+
},
|
|
1285
|
+
responseType: 'json'
|
|
1286
|
+
};
|
|
1287
|
+
const list = await request.get(listRequestOptions);
|
|
1288
|
+
const listId = list.Id;
|
|
1289
|
+
if (verbose && logger) {
|
|
1290
|
+
logger.logToStderr(`Getting request digest for systemUpdate request`);
|
|
1291
|
+
}
|
|
1292
|
+
const res = await spo.getRequestDigest(webUrl);
|
|
1293
|
+
const formDigestValue = res.FormDigestValue;
|
|
1294
|
+
const objectIdentity = await spo.requestObjectIdentity(webUrl, logger, verbose);
|
|
1295
|
+
let index = 0;
|
|
1296
|
+
const requestBodyOptions = properties ? Object.keys(properties).map(key => `
|
|
1297
|
+
<Method Name="ParseAndSetFieldValue" Id="${++index}" ObjectPathId="147">
|
|
1298
|
+
<Parameters>
|
|
1299
|
+
<Parameter Type="String">${key}</Parameter>
|
|
1300
|
+
<Parameter Type="String">${properties[key].toString()}</Parameter>
|
|
1301
|
+
</Parameters>
|
|
1302
|
+
</Method>`) : [];
|
|
1303
|
+
const additionalContentType = contentTypeName ? `
|
|
1304
|
+
<Method Name="ParseAndSetFieldValue" Id="${++index}" ObjectPathId="147">
|
|
1305
|
+
<Parameters>
|
|
1306
|
+
<Parameter Type="String">ContentType</Parameter>
|
|
1307
|
+
<Parameter Type="String">${contentTypeName}</Parameter>
|
|
1308
|
+
</Parameters>
|
|
1309
|
+
</Method>` : '';
|
|
1310
|
+
const requestBody = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
|
|
1311
|
+
<Actions>
|
|
1312
|
+
${requestBodyOptions.join('')}${additionalContentType}
|
|
1313
|
+
<Method Name="SystemUpdate" Id="${++index}" ObjectPathId="147" />
|
|
1314
|
+
</Actions>
|
|
1315
|
+
<ObjectPaths>
|
|
1316
|
+
<Identity Id="147" Name="${objectIdentity}:list:${listId}:item:${itemId},1" />
|
|
1317
|
+
</ObjectPaths>
|
|
1318
|
+
</Request>`;
|
|
1319
|
+
const requestOptions = {
|
|
1320
|
+
url: `${webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
1321
|
+
headers: {
|
|
1322
|
+
'Content-Type': 'text/xml',
|
|
1323
|
+
'X-RequestDigest': formDigestValue
|
|
1324
|
+
},
|
|
1325
|
+
data: requestBody
|
|
1326
|
+
};
|
|
1327
|
+
const response = await request.post(requestOptions);
|
|
1328
|
+
if (response.indexOf("ErrorMessage") > -1) {
|
|
1329
|
+
throw `Error occurred in systemUpdate operation - ${response}`;
|
|
1330
|
+
}
|
|
1331
|
+
const id = Number(itemId);
|
|
1332
|
+
const requestOptionsItems = {
|
|
1333
|
+
url: `${absoluteListUrl}/items(${id})`,
|
|
1334
|
+
headers: {
|
|
1335
|
+
'accept': 'application/json;odata=nometadata'
|
|
1336
|
+
},
|
|
1337
|
+
responseType: 'json'
|
|
1338
|
+
};
|
|
1339
|
+
const itemsResponse = await request.get(requestOptionsItems);
|
|
1340
|
+
return (itemsResponse);
|
|
1341
|
+
},
|
|
1234
1342
|
/**
|
|
1235
1343
|
* Removes the retention label from the items in the given list.
|
|
1236
1344
|
* @param webUrl The url of the web
|
|
@@ -1334,6 +1442,86 @@ export const spo = {
|
|
|
1334
1442
|
};
|
|
1335
1443
|
const site = await request.get(requestOptions);
|
|
1336
1444
|
return site.id;
|
|
1445
|
+
},
|
|
1446
|
+
/**
|
|
1447
|
+
* Retrieves the ObjectIdentity from a SharePoint site
|
|
1448
|
+
* @param webUrl web url
|
|
1449
|
+
* @param logger The logger object
|
|
1450
|
+
* @param verbose If in verbose mode
|
|
1451
|
+
* @return The ObjectIdentity as string
|
|
1452
|
+
*/
|
|
1453
|
+
async requestObjectIdentity(webUrl, logger, verbose) {
|
|
1454
|
+
const res = await spo.getRequestDigest(webUrl);
|
|
1455
|
+
const formDigestValue = res.FormDigestValue;
|
|
1456
|
+
const requestOptions = {
|
|
1457
|
+
url: `${webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
1458
|
+
headers: {
|
|
1459
|
+
'X-RequestDigest': formDigestValue
|
|
1460
|
+
},
|
|
1461
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Query Id="1" ObjectPathId="5"><Query SelectAllProperties="false"><Properties><Property Name="ServerRelativeUrl" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Property Id="5" ParentId="3" Name="Web" /><StaticProperty Id="3" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></ObjectPaths></Request>`
|
|
1462
|
+
};
|
|
1463
|
+
const response = await request.post(requestOptions);
|
|
1464
|
+
if (verbose) {
|
|
1465
|
+
logger.logToStderr('Attempt to get _ObjectIdentity_ key values');
|
|
1466
|
+
}
|
|
1467
|
+
const json = JSON.parse(response);
|
|
1468
|
+
const contents = json.find(x => { return x.ErrorInfo; });
|
|
1469
|
+
if (contents && contents.ErrorInfo) {
|
|
1470
|
+
throw contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error';
|
|
1471
|
+
}
|
|
1472
|
+
const identityObject = json.find(x => { return x._ObjectIdentity_; });
|
|
1473
|
+
if (identityObject) {
|
|
1474
|
+
return identityObject._ObjectIdentity_;
|
|
1475
|
+
}
|
|
1476
|
+
throw 'Cannot proceed. _ObjectIdentity_ not found'; // this is not supposed to happen
|
|
1477
|
+
},
|
|
1478
|
+
/**
|
|
1479
|
+
* Updates a list item without system update
|
|
1480
|
+
* @param absoluteListUrl The absolute base URL without query parameters, pointing to the specific list where the item resides. This URL should represent the list.
|
|
1481
|
+
* @param itemId The id of the list item
|
|
1482
|
+
* @param properties An object of the properties that should be updated
|
|
1483
|
+
* @param contentTypeName The name of the content type to update
|
|
1484
|
+
* @returns The updated listitem object
|
|
1485
|
+
*/
|
|
1486
|
+
async updateListItem(absoluteListUrl, itemId, properties, contentTypeName) {
|
|
1487
|
+
const requestBodyOptions = [
|
|
1488
|
+
...(properties
|
|
1489
|
+
? Object.keys(properties).map((key) => ({
|
|
1490
|
+
FieldName: key,
|
|
1491
|
+
FieldValue: properties[key].toString()
|
|
1492
|
+
}))
|
|
1493
|
+
: [])
|
|
1494
|
+
];
|
|
1495
|
+
const requestBody = {
|
|
1496
|
+
formValues: requestBodyOptions
|
|
1497
|
+
};
|
|
1498
|
+
contentTypeName && requestBody.formValues.push({
|
|
1499
|
+
FieldName: 'ContentType',
|
|
1500
|
+
FieldValue: contentTypeName
|
|
1501
|
+
});
|
|
1502
|
+
const requestOptions = {
|
|
1503
|
+
url: `${absoluteListUrl}/items(${itemId})/ValidateUpdateListItem()`,
|
|
1504
|
+
headers: {
|
|
1505
|
+
'accept': 'application/json;odata=nometadata'
|
|
1506
|
+
},
|
|
1507
|
+
data: requestBody,
|
|
1508
|
+
responseType: 'json'
|
|
1509
|
+
};
|
|
1510
|
+
const response = await request.post(requestOptions);
|
|
1511
|
+
// Response is from /ValidateUpdateListItem POST call, perform get on updated item to get all field values
|
|
1512
|
+
const fieldValues = response.value;
|
|
1513
|
+
if (fieldValues.some(f => f.HasException)) {
|
|
1514
|
+
throw `Updating the items has failed with the following errors: ${os.EOL}${fieldValues.filter(f => f.HasException).map(f => { return `- ${f.FieldName} - ${f.ErrorMessage}`; }).join(os.EOL)}`;
|
|
1515
|
+
}
|
|
1516
|
+
const requestOptionsItems = {
|
|
1517
|
+
url: `${absoluteListUrl}/items(${itemId})`,
|
|
1518
|
+
headers: {
|
|
1519
|
+
'accept': 'application/json;odata=nometadata'
|
|
1520
|
+
},
|
|
1521
|
+
responseType: 'json'
|
|
1522
|
+
};
|
|
1523
|
+
const itemsResponse = await request.get(requestOptionsItems);
|
|
1524
|
+
return (itemsResponse);
|
|
1337
1525
|
}
|
|
1338
1526
|
};
|
|
1339
1527
|
//# sourceMappingURL=spo.js.map
|
package/dist/utils/validation.js
CHANGED
|
@@ -325,6 +325,10 @@ export const validation = {
|
|
|
325
325
|
isValidMailNickname(mailNickname) {
|
|
326
326
|
const mailNicknameRegEx = new RegExp(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]*$/i);
|
|
327
327
|
return mailNicknameRegEx.test(mailNickname);
|
|
328
|
+
},
|
|
329
|
+
isValidISODuration(duration) {
|
|
330
|
+
const durationRegEx = new RegExp(/^P(?!$)((\d+Y)|(\d+\.\d+Y$))?((\d+M)|(\d+\.\d+M$))?((\d+W)|(\d+\.\d+W$))?((\d+D)|(\d+\.\d+D$))?(T(?=\d)((\d+H)|(\d+\.\d+H$))?((\d+M)|(\d+\.\d+M$))?(\d+(\.\d+)?S)?)??$/);
|
|
331
|
+
return durationRegEx.test(duration);
|
|
328
332
|
}
|
|
329
333
|
};
|
|
330
334
|
//# sourceMappingURL=validation.js.map
|
|
@@ -78,6 +78,9 @@ m365 entra appregistration add [options]
|
|
|
78
78
|
|
|
79
79
|
`--save`
|
|
80
80
|
: Use to store the information about the created app in a local file.
|
|
81
|
+
|
|
82
|
+
`--allowPublicClientFlows`
|
|
83
|
+
: Enable the allow public client flows feature on the app registration.
|
|
81
84
|
```
|
|
82
85
|
|
|
83
86
|
<Global />
|
|
@@ -192,6 +195,12 @@ Create new Entra app registration with a certificate
|
|
|
192
195
|
m365 entra app add --name 'My Entra app' --certificateDisplayName "Some certificate name" --certificateFile "c:\temp\some-certificate.cer"
|
|
193
196
|
```
|
|
194
197
|
|
|
198
|
+
Create a new Entra app registration with the allow public client flows feature enabled.
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
m365 entra app add --name 'My Entra app' --allowPublicClientFlows
|
|
202
|
+
```
|
|
203
|
+
|
|
195
204
|
## Response
|
|
196
205
|
|
|
197
206
|
### Standard response
|
|
@@ -49,6 +49,9 @@ m365 entra appregistration set [options]
|
|
|
49
49
|
|
|
50
50
|
`--certificateDisplayName [certificateDisplayName]`
|
|
51
51
|
: Display name for the certificate. If not given, the displayName will be set to the certificate subject. When specified, also specify either `certificateFile` or `certificateBase64Encoded`.
|
|
52
|
+
|
|
53
|
+
`--allowPublicClientFlows [allowPublicClientFlows]`
|
|
54
|
+
: Set to `true` or `false` to toggle the allow public client flows feature on the app registration.
|
|
52
55
|
```
|
|
53
56
|
|
|
54
57
|
<Global />
|
|
@@ -99,6 +102,12 @@ Add a certificate to the app
|
|
|
99
102
|
m365 entra app set --appId e75be2e1-0204-4f95-857d-51a37cf40be8 --certificateDisplayName "Some certificate name" --certificateFile "c:\temp\some-certificate.cer"
|
|
100
103
|
```
|
|
101
104
|
|
|
105
|
+
Enable the allow public client flows feature on the app registration
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
m365 entra app set --appId e75be2e1-0204-4f95-857d-51a37cf40be8 --allowPublicClientFlows true
|
|
109
|
+
```
|
|
110
|
+
|
|
102
111
|
## Response
|
|
103
112
|
|
|
104
113
|
The command won't return a response on success.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
import Tabs from '@theme/Tabs';
|
|
3
|
+
import TabItem from '@theme/TabItem';
|
|
4
|
+
|
|
5
|
+
# entra pim role assignment add
|
|
6
|
+
|
|
7
|
+
Request activation of an Entra role assignment for a user or group.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
m365 entra pim role assignment add [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
```md definition-list
|
|
18
|
+
`-n, --roleDefinitionName [roleDefinitionName]`
|
|
19
|
+
: Name of the role definition that should be assigned. Specify either `roleDefinitionName` or `roleDefinitionId` but not both.
|
|
20
|
+
|
|
21
|
+
`-i, --roleDefinitionId [roleDefinitionId]`
|
|
22
|
+
: Id of the role definition that is being assigned. Specify either `roleDefinitionName` or `roleDefinitionId` but not both.
|
|
23
|
+
|
|
24
|
+
`--userId [userId]`
|
|
25
|
+
: Id of the user that will be granted the assignment. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, the current user will be used.
|
|
26
|
+
|
|
27
|
+
`--userName [userName]`
|
|
28
|
+
: UPN of the user that will be granted the assignment. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, the current user will be used.
|
|
29
|
+
|
|
30
|
+
`--groupId [groupId]`
|
|
31
|
+
: Id of the group that will be granted the assignment. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, the current user will be used.
|
|
32
|
+
|
|
33
|
+
`--groupName [groupName]`
|
|
34
|
+
: Display name of the group that will be granted the assignment. Specify either `userId`, `userName`, `groupId` or `groupName`. If not specified, the current user will be used.
|
|
35
|
+
|
|
36
|
+
`--administrativeUnitId [administrativeUnitId]`
|
|
37
|
+
: Id of the administrative unit representing the scope of the assignment. Specify either `administrativeUnitId` or `applicationId`. If not specified, default scope will be tenant-wide.
|
|
38
|
+
|
|
39
|
+
`--applicationId [applicationId]`
|
|
40
|
+
: Object Id of the application representing the scope of the assignment. Specify either `administrativeUnitId` or `applicationId`. If not specified, default scope will be tenant-wide.
|
|
41
|
+
|
|
42
|
+
`-j, --justification [justification]`
|
|
43
|
+
: An optional justification message.
|
|
44
|
+
|
|
45
|
+
`-s, --startDateTime [startDateTime]`
|
|
46
|
+
: When the assignment should start. If left out, the assignment will start from the current time.
|
|
47
|
+
|
|
48
|
+
`-e, --endDateTime [endDateTime]`
|
|
49
|
+
: When the assignment should end. Specify either `duration`, `endDateTime` or `noExpiration`.
|
|
50
|
+
|
|
51
|
+
`-d, --duration [duration]`
|
|
52
|
+
: How long the assignment should last. Write in ISO 8601 format for durations: PT3H for 3 hours. Specify either `duration`, `endDateTime` or `noExpiration`.
|
|
53
|
+
|
|
54
|
+
`--noExpiration [noExpiration]`
|
|
55
|
+
: If specified, the role assignment will never expire. Specify either `duration`, `endDateTime` or `noExpiration`.
|
|
56
|
+
|
|
57
|
+
`--ticketNumber [ticketNumber]`
|
|
58
|
+
: Optional ticket number value to communicate with the request.
|
|
59
|
+
|
|
60
|
+
`--ticketSystem [ticketSystem]`
|
|
61
|
+
: Optional ticket system to communicate with the request.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
<Global />
|
|
65
|
+
|
|
66
|
+
## Remarks
|
|
67
|
+
|
|
68
|
+
:::info
|
|
69
|
+
|
|
70
|
+
When activating a role for other users, you must be **Privileged Role Administrator**.
|
|
71
|
+
|
|
72
|
+
:::
|
|
73
|
+
|
|
74
|
+
## Examples
|
|
75
|
+
|
|
76
|
+
Request activation of the SharePoint Administrator Entra role assignment for the current user.
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
m365 entra pim role assignment add --roleDefinitionName 'SharePoint Administrator'
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Request activation of an Entra role assignment for the current user.
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
m365 entra pim role assignment add --roleDefinitionId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Request activation of an Entra role assignment for the current user with a justification and max duration of 4 hours.
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
m365 entra pim role assignment add --roleDefinitionId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690' --justification 'Need Global Admin to release application xyz to production' --duration 'PT4H'
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Request activation of an Entra role assignment for a specified user with tenant scope.
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
m365 entra pim role assignment add --roleDefinitionId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690' --userId '3488d6b8-6b2e-41c3-9583-1991205323c2'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Request activation of the User Administrator Entra role assignment for a specified group with administrative unit scope.
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
m365 entra pim role assignment add --roleDefinitionName 'User Administrator' --groupId '3488d6b8-6b2e-41c3-9583-1991205323c2' --administrativeUnitId '03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7'
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Request activation of the Application Administrator Entra role assignment for a specified group with scope to a specific application.
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
m365 entra pim role assignment add --roleDefinitionName 'Application Administrator' --groupName 'Applications admins' --applicationId '03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7'
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Request activation of an Entra role assignment for a specific period of two days.
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
m365 entra pim role assignment add --roleDefinitionName 'Global Administrator' --userName 'admin-john@contoso.com' --startDateTime '2024-01-10T09:00:00Z' --endDateTime '2024-01-11T17:00:00Z'
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Request activation of an Entra role assignment with no expiration.
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
m365 entra pim role assignment add --roleDefinitionName 'Global Administrator' --userName 'admin-john@contoso.com' --noExpiration
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Response
|
|
125
|
+
|
|
126
|
+
<Tabs>
|
|
127
|
+
<TabItem value="JSON">
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"id": "3f7d1bd6-a9a5-45bc-b831-00cfa3e3c649",
|
|
132
|
+
"status": "Provisioned",
|
|
133
|
+
"createdDateTime": "2024-02-12T13:54:21.3110096Z",
|
|
134
|
+
"completedDateTime": "2024-02-12T13:54:21.9847061Z",
|
|
135
|
+
"approvalId": null,
|
|
136
|
+
"customData": null,
|
|
137
|
+
"action": "adminAssign",
|
|
138
|
+
"principalId": "61b0c52f-a902-4769-9a09-c6628335b00a",
|
|
139
|
+
"roleDefinitionId": "f28a1f50-f6e7-4571-818b-6a12f2af6b6c",
|
|
140
|
+
"directoryScopeId": "/",
|
|
141
|
+
"appScopeId": null,
|
|
142
|
+
"isValidationOnly": false,
|
|
143
|
+
"targetScheduleId": "3f7d1bd6-a9a5-45bc-b831-00cfa3e3c649",
|
|
144
|
+
"justification": "Need SharePoint Administrator role",
|
|
145
|
+
"createdBy": {
|
|
146
|
+
"application": null,
|
|
147
|
+
"device": null,
|
|
148
|
+
"user": {
|
|
149
|
+
"displayName": null,
|
|
150
|
+
"id": "893f9116-e024-4bc6-8e98-54c245129485"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"scheduleInfo": {
|
|
154
|
+
"startDateTime": "2024-02-12T13:54:21.9847061Z",
|
|
155
|
+
"recurrence": null,
|
|
156
|
+
"expiration": {
|
|
157
|
+
"type": "noExpiration",
|
|
158
|
+
"endDateTime": null,
|
|
159
|
+
"duration": null
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"ticketInfo": {
|
|
163
|
+
"ticketNumber": null,
|
|
164
|
+
"ticketSystem": null
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
</TabItem>
|
|
170
|
+
<TabItem value="Text">
|
|
171
|
+
|
|
172
|
+
```text
|
|
173
|
+
action : adminAssign
|
|
174
|
+
appScopeId : null
|
|
175
|
+
approvalId : null
|
|
176
|
+
completedDateTime: 2024-02-12T14:02:09.8938321Z
|
|
177
|
+
createdBy : {"application":null,"device":null,"user":{"displayName":null,"id":"893f9116-e024-4bc6-8e98-54c245129485"}}
|
|
178
|
+
createdDateTime : 2024-02-12T14:02:09.4658344Z
|
|
179
|
+
customData : null
|
|
180
|
+
directoryScopeId : /
|
|
181
|
+
id : c221e106-0711-470a-83cf-f8d7cbc51ecd
|
|
182
|
+
isValidationOnly : false
|
|
183
|
+
justification : Need SharePoint Administrator role
|
|
184
|
+
principalId : 61b0c52f-a902-4769-9a09-c6628335b00a
|
|
185
|
+
roleDefinitionId : f28a1f50-f6e7-4571-818b-6a12f2af6b6c
|
|
186
|
+
scheduleInfo : {"startDateTime":"2024-02-12T14:02:09.8938321Z","recurrence":null,"expiration":{"type":"noExpiration","endDateTime":null,"duration":null}}
|
|
187
|
+
status : Provisioned
|
|
188
|
+
targetScheduleId : c221e106-0711-470a-83cf-f8d7cbc51ecd
|
|
189
|
+
ticketInfo : {"ticketNumber":null,"ticketSystem":null}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
</TabItem>
|
|
193
|
+
<TabItem value="CSV">
|
|
194
|
+
|
|
195
|
+
```csv
|
|
196
|
+
id,status,createdDateTime,completedDateTime,approvalId,customData,action,principalId,roleDefinitionId,directoryScopeId,appScopeId,isValidationOnly,targetScheduleId,justification
|
|
197
|
+
7d727f44-c2dd-459e-8665-99ce003d12a9,Provisioned,2024-02-12T14:08:54.881749Z,2024-02-12T14:08:55.2507639Z,,,adminAssign,61b0c52f-a902-4769-9a09-c6628335b00a,f28a1f50-f6e7-4571-818b-6a12f2af6b6c,/,,,7d727f44-c2dd-459e-8665-99ce003d12a9,Need SharePoint Administrator role
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
</TabItem>
|
|
201
|
+
<TabItem value="Markdown">
|
|
202
|
+
|
|
203
|
+
```md
|
|
204
|
+
# entra pim roleassignment add --roleDefinitionId "f28a1f50-f6e7-4571-818b-6a12f2af6b6c" --userId "61b0c52f-a902-4769-9a09-c6628335b00a" --justification "Need SharePoint Administrator role"
|
|
205
|
+
|
|
206
|
+
Date: 2/13/2024
|
|
207
|
+
|
|
208
|
+
## 7622802f-648b-4dd9-820f-dccaf8bbbab5
|
|
209
|
+
|
|
210
|
+
Property | Value
|
|
211
|
+
---------|-------
|
|
212
|
+
id | 7622802f-648b-4dd9-820f-dccaf8bbbab5
|
|
213
|
+
status | Provisioned
|
|
214
|
+
createdDateTime | 2024-02-13T18:34:13.5365923Z
|
|
215
|
+
completedDateTime | 2024-02-13T18:34:14.269623Z
|
|
216
|
+
action | adminAssign
|
|
217
|
+
principalId | 61b0c52f-a902-4769-9a09-c6628335b00a
|
|
218
|
+
roleDefinitionId | f28a1f50-f6e7-4571-818b-6a12f2af6b6c
|
|
219
|
+
directoryScopeId | /
|
|
220
|
+
isValidationOnly | false
|
|
221
|
+
targetScheduleId | 7622802f-648b-4dd9-820f-dccaf8bbbab5
|
|
222
|
+
justification | Need SharePoint Administrator role
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
</TabItem>
|
|
226
|
+
</Tabs>
|
|
227
|
+
|
|
228
|
+
## More information
|
|
229
|
+
|
|
230
|
+
- Role assignment request: https://learn.microsoft.com/graph/api/rbacapplication-post-roleassignmentschedulerequests
|