Namespace: microsoft.graph
Create a new accessPackage object.
The access package will be added to an existing accessPackageCatalog.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
EntitlementManagement.ReadWrite.All |
Not available. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
EntitlementManagement.ReadWrite.All |
Not available. |
HTTP request
POST /identityGovernance/entitlementManagement/accessPackages
Request body
In the request body, supply a JSON representation of the accessPackage object.
You can specify the following properties when creating an accessPackage.
Property |
Type |
Description |
catalog |
accessPackageCatalog |
Required. The catalog that's linked to this access package. Only the id property is required. |
displayName |
String |
Required. The display name of the access package. |
description |
String |
Optional. The description of the access package. |
isHidden |
Boolean |
Optional. Whether the access package is hidden from the requestor. |
Response
If successful, this method returns a 201 Created
response code and a new accessPackage object in the response body.
Examples
Request
POST https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/accessPackages
Content-Type: application/json
{
"displayName": "sales reps",
"description": "outside sales representatives",
"isHidden": false,
"catalog": {
"id": "66584aae-98bb-48cc-9458-7bee5d2a6577"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new AccessPackage
{
DisplayName = "sales reps",
Description = "outside sales representatives",
IsHidden = false,
Catalog = new AccessPackageCatalog
{
Id = "66584aae-98bb-48cc-9458-7bee5d2a6577",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.EntitlementManagement.AccessPackages.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc identity-governance entitlement-management access-packages create --body '{\
"displayName": "sales reps",\
"description": "outside sales representatives",\
"isHidden": false,\
"catalog": {\
"id": "66584aae-98bb-48cc-9458-7bee5d2a6577"\
}\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAccessPackage()
displayName := "sales reps"
requestBody.SetDisplayName(&displayName)
description := "outside sales representatives"
requestBody.SetDescription(&description)
isHidden := false
requestBody.SetIsHidden(&isHidden)
catalog := graphmodels.NewAccessPackageCatalog()
id := "66584aae-98bb-48cc-9458-7bee5d2a6577"
catalog.SetId(&id)
requestBody.SetCatalog(catalog)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
accessPackages, err := graphClient.IdentityGovernance().EntitlementManagement().AccessPackages().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AccessPackage accessPackage = new AccessPackage();
accessPackage.setDisplayName("sales reps");
accessPackage.setDescription("outside sales representatives");
accessPackage.setIsHidden(false);
AccessPackageCatalog catalog = new AccessPackageCatalog();
catalog.setId("66584aae-98bb-48cc-9458-7bee5d2a6577");
accessPackage.setCatalog(catalog);
AccessPackage result = graphClient.identityGovernance().entitlementManagement().accessPackages().post(accessPackage);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const accessPackage = {
displayName: 'sales reps',
description: 'outside sales representatives',
isHidden: false,
catalog: {
id: '66584aae-98bb-48cc-9458-7bee5d2a6577'
}
};
await client.api('/identityGovernance/entitlementManagement/accessPackages')
.post(accessPackage);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\AccessPackage;
use Microsoft\Graph\Generated\Models\AccessPackageCatalog;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AccessPackage();
$requestBody->setDisplayName('sales reps');
$requestBody->setDescription('outside sales representatives');
$requestBody->setIsHidden(false);
$catalog = new AccessPackageCatalog();
$catalog->setId('66584aae-98bb-48cc-9458-7bee5d2a6577');
$requestBody->setCatalog($catalog);
$result = $graphServiceClient->identityGovernance()->entitlementManagement()->accessPackages()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Identity.Governance
$params = @{
displayName = "sales reps"
description = "outside sales representatives"
isHidden = $false
catalog = @{
id = "66584aae-98bb-48cc-9458-7bee5d2a6577"
}
}
New-MgEntitlementManagementAccessPackage -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.access_package import AccessPackage
from msgraph.generated.models.access_package_catalog import AccessPackageCatalog
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AccessPackage(
display_name = "sales reps",
description = "outside sales representatives",
is_hidden = False,
catalog = AccessPackageCatalog(
id = "66584aae-98bb-48cc-9458-7bee5d2a6577",
),
)
result = await graph_client.identity_governance.entitlement_management.access_packages.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "642181f0-bc17-4fc6-9ebb-ff53dbf18c2f",
"displayName": "sales reps",
"description": "outside sales representatives",
"isHidden": false,
"createdDateTime": "2021-11-10T01:10:09.5220119Z",
"modifiedDateTime": "2021-11-10T01:10:09.5220119Z"
}