Namespace: microsoft.graph
Create a new accessPackageResourceRequest object to request the addition of a resource to an access package catalog, update of a resource, or the removal of a resource from a catalog. A resource must be included in an access package catalog before a role of that resource can be added to an access package.
- To add a Microsoft Entra group as a resource to a catalog, set the requestType to be
adminAdd
, and a resource
representing the resource. The value of the originSystem property within the resource
should be AadGroup
and the value of the originId is the identifier of the group.
- To add a Microsoft Entra application as a resource to a catalog, set the requestType to be
adminAdd
, and a resource
representing the resource. The value of the originSystem property within the resource
should be AadApplication
and the value of the originId is the identifier of the servicePrincipal.
- To add a SharePoint Online site as a resource to a catalog, set the requestType to be
adminAdd
, and a resource
representing the resource. The value of the originSystem property within the resource
should be SharePointOnline
and the value of the originId is the URI of the site.
- To remove a resource from a catalog, set the requestType to be
adminRemove
, and the resource
to contain the id
of the resource object to be removed. The resource object can be retrieved using list resources.
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. |
Tip
In delegated scenarios with work or school accounts, the signed-in user must also be assigned an administrator role with supported role permissions through one of the following options:
In app-only scenarios, the calling app can be assigned one of the preceding supported roles instead of the EntitlementManagement.ReadWrite.All
application permission. The Catalog owner role is less privileged than the EntitlementManagement.ReadWrite.All
application permission.
Additionally you must also have the following permissions on the resource being added:
- To add a Microsoft Entra group as a resource to a catalog:
- If using delegated permissions, the user requesting to add a group should be an owner of the group or in a directory role that allows them to modify groups.
- If using application permissions, the application requesting to add the group should also be assigned the
Group.ReadWrite.All
permission.
- To add a Microsoft Entra application as a resource to a catalog:
- If using delegated permissions, the user requesting to add an application should be an owner of the application or in a directory role that allows them to modify application role assignments.
- If using application permissions, the application requesting to add the servicePrincipal should also be assigned the Application.ReadWrite.All permission.
- To add a SharePoint Online site as a resource to a catalog:
HTTP request
POST /identityGovernance/entitlementManagement/resourceRequests
Request body
In the request body, supply a JSON representation of an accessPackageResourceRequest object. Include the resource
relationship with an accessPackageResource object as part of the request, and a catalog
object containing its id
.
If successful, this method returns a 201 Created
response code and a new accessPackageResourceRequest object in the response body.
Examples
Example 1: Create an accessPackageResourceRequest for adding a group as a resource
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/resourceRequests
Content-type: application/json
{
"requestType": "adminAdd",
"resource": {
"displayName": "Test group",
"originId": "8ab659d0-3839-427d-8c54-5ae92f0b3e2e",
"originSystem": "AadGroup"
},
"catalog": {
"id": "beedadfe-01d5-4025-910b-84abb9369997"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new AccessPackageResourceRequest
{
RequestType = AccessPackageRequestType.AdminAdd,
Resource = new AccessPackageResource
{
DisplayName = "Test group",
OriginId = "8ab659d0-3839-427d-8c54-5ae92f0b3e2e",
OriginSystem = "AadGroup",
},
Catalog = new AccessPackageCatalog
{
Id = "beedadfe-01d5-4025-910b-84abb9369997",
},
};
// 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.ResourceRequests.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 resource-requests create --body '{\
"requestType": "adminAdd",\
"resource": {\
"displayName": "Test group",\
"originId": "8ab659d0-3839-427d-8c54-5ae92f0b3e2e",\
"originSystem": "AadGroup"\
},\
"catalog": {\
"id": "beedadfe-01d5-4025-910b-84abb9369997"\
}\
}\
'
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.NewAccessPackageResourceRequest()
requestType := graphmodels.ADMINADD_ACCESSPACKAGEREQUESTTYPE
requestBody.SetRequestType(&requestType)
resource := graphmodels.NewAccessPackageResource()
displayName := "Test group"
resource.SetDisplayName(&displayName)
originId := "8ab659d0-3839-427d-8c54-5ae92f0b3e2e"
resource.SetOriginId(&originId)
originSystem := "AadGroup"
resource.SetOriginSystem(&originSystem)
requestBody.SetResource(resource)
catalog := graphmodels.NewAccessPackageCatalog()
id := "beedadfe-01d5-4025-910b-84abb9369997"
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
resourceRequests, err := graphClient.IdentityGovernance().EntitlementManagement().ResourceRequests().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);
AccessPackageResourceRequest accessPackageResourceRequest = new AccessPackageResourceRequest();
accessPackageResourceRequest.setRequestType(AccessPackageRequestType.AdminAdd);
AccessPackageResource resource = new AccessPackageResource();
resource.setDisplayName("Test group");
resource.setOriginId("8ab659d0-3839-427d-8c54-5ae92f0b3e2e");
resource.setOriginSystem("AadGroup");
accessPackageResourceRequest.setResource(resource);
AccessPackageCatalog catalog = new AccessPackageCatalog();
catalog.setId("beedadfe-01d5-4025-910b-84abb9369997");
accessPackageResourceRequest.setCatalog(catalog);
AccessPackageResourceRequest result = graphClient.identityGovernance().entitlementManagement().resourceRequests().post(accessPackageResourceRequest);
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 accessPackageResourceRequest = {
requestType: 'adminAdd',
resource: {
displayName: 'Test group',
originId: '8ab659d0-3839-427d-8c54-5ae92f0b3e2e',
originSystem: 'AadGroup'
},
catalog: {
id: 'beedadfe-01d5-4025-910b-84abb9369997'
}
};
await client.api('/identityGovernance/entitlementManagement/resourceRequests')
.post(accessPackageResourceRequest);
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\AccessPackageResourceRequest;
use Microsoft\Graph\Generated\Models\AccessPackageRequestType;
use Microsoft\Graph\Generated\Models\AccessPackageResource;
use Microsoft\Graph\Generated\Models\AccessPackageCatalog;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AccessPackageResourceRequest();
$requestBody->setRequestType(new AccessPackageRequestType('adminAdd'));
$resource = new AccessPackageResource();
$resource->setDisplayName('Test group');
$resource->setOriginId('8ab659d0-3839-427d-8c54-5ae92f0b3e2e');
$resource->setOriginSystem('AadGroup');
$requestBody->setResource($resource);
$catalog = new AccessPackageCatalog();
$catalog->setId('beedadfe-01d5-4025-910b-84abb9369997');
$requestBody->setCatalog($catalog);
$result = $graphServiceClient->identityGovernance()->entitlementManagement()->resourceRequests()->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 = @{
requestType = "adminAdd"
resource = @{
displayName = "Test group"
originId = "8ab659d0-3839-427d-8c54-5ae92f0b3e2e"
originSystem = "AadGroup"
}
catalog = @{
id = "beedadfe-01d5-4025-910b-84abb9369997"
}
}
New-MgEntitlementManagementResourceRequest -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_resource_request import AccessPackageResourceRequest
from msgraph.generated.models.access_package_request_type import AccessPackageRequestType
from msgraph.generated.models.access_package_resource import AccessPackageResource
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 = AccessPackageResourceRequest(
request_type = AccessPackageRequestType.AdminAdd,
resource = AccessPackageResource(
display_name = "Test group",
origin_id = "8ab659d0-3839-427d-8c54-5ae92f0b3e2e",
origin_system = "AadGroup",
),
catalog = AccessPackageCatalog(
id = "beedadfe-01d5-4025-910b-84abb9369997",
),
)
result = await graph_client.identity_governance.entitlement_management.resource_requests.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "acc2294e-f37f-42d3-981d-4e83847ed0ce",
"requestType": "adminAdd",
"state": "delivered"
}
Example 2: Create an accessPackageResourceRequest for adding an application as a resource
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/resourceRequests
Content-type: application/json
{
"requestType": "adminAdd",
"resource": {
"originId": "e81d7f57-0840-45e1-894b-f505c1bdcc1f",
"originSystem": "AadApplication"
},
"catalog": {
"id": "beedadfe-01d5-4025-910b-84abb9369997"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new AccessPackageResourceRequest
{
RequestType = AccessPackageRequestType.AdminAdd,
Resource = new AccessPackageResource
{
OriginId = "e81d7f57-0840-45e1-894b-f505c1bdcc1f",
OriginSystem = "AadApplication",
},
Catalog = new AccessPackageCatalog
{
Id = "beedadfe-01d5-4025-910b-84abb9369997",
},
};
// 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.ResourceRequests.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 resource-requests create --body '{\
"requestType": "adminAdd",\
"resource": {\
"originId": "e81d7f57-0840-45e1-894b-f505c1bdcc1f",\
"originSystem": "AadApplication"\
},\
"catalog": {\
"id": "beedadfe-01d5-4025-910b-84abb9369997"\
}\
}\
'
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.NewAccessPackageResourceRequest()
requestType := graphmodels.ADMINADD_ACCESSPACKAGEREQUESTTYPE
requestBody.SetRequestType(&requestType)
resource := graphmodels.NewAccessPackageResource()
originId := "e81d7f57-0840-45e1-894b-f505c1bdcc1f"
resource.SetOriginId(&originId)
originSystem := "AadApplication"
resource.SetOriginSystem(&originSystem)
requestBody.SetResource(resource)
catalog := graphmodels.NewAccessPackageCatalog()
id := "beedadfe-01d5-4025-910b-84abb9369997"
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
resourceRequests, err := graphClient.IdentityGovernance().EntitlementManagement().ResourceRequests().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);
AccessPackageResourceRequest accessPackageResourceRequest = new AccessPackageResourceRequest();
accessPackageResourceRequest.setRequestType(AccessPackageRequestType.AdminAdd);
AccessPackageResource resource = new AccessPackageResource();
resource.setOriginId("e81d7f57-0840-45e1-894b-f505c1bdcc1f");
resource.setOriginSystem("AadApplication");
accessPackageResourceRequest.setResource(resource);
AccessPackageCatalog catalog = new AccessPackageCatalog();
catalog.setId("beedadfe-01d5-4025-910b-84abb9369997");
accessPackageResourceRequest.setCatalog(catalog);
AccessPackageResourceRequest result = graphClient.identityGovernance().entitlementManagement().resourceRequests().post(accessPackageResourceRequest);
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 accessPackageResourceRequest = {
requestType: 'adminAdd',
resource: {
originId: 'e81d7f57-0840-45e1-894b-f505c1bdcc1f',
originSystem: 'AadApplication'
},
catalog: {
id: 'beedadfe-01d5-4025-910b-84abb9369997'
}
};
await client.api('/identityGovernance/entitlementManagement/resourceRequests')
.post(accessPackageResourceRequest);
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\AccessPackageResourceRequest;
use Microsoft\Graph\Generated\Models\AccessPackageRequestType;
use Microsoft\Graph\Generated\Models\AccessPackageResource;
use Microsoft\Graph\Generated\Models\AccessPackageCatalog;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AccessPackageResourceRequest();
$requestBody->setRequestType(new AccessPackageRequestType('adminAdd'));
$resource = new AccessPackageResource();
$resource->setOriginId('e81d7f57-0840-45e1-894b-f505c1bdcc1f');
$resource->setOriginSystem('AadApplication');
$requestBody->setResource($resource);
$catalog = new AccessPackageCatalog();
$catalog->setId('beedadfe-01d5-4025-910b-84abb9369997');
$requestBody->setCatalog($catalog);
$result = $graphServiceClient->identityGovernance()->entitlementManagement()->resourceRequests()->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 = @{
requestType = "adminAdd"
resource = @{
originId = "e81d7f57-0840-45e1-894b-f505c1bdcc1f"
originSystem = "AadApplication"
}
catalog = @{
id = "beedadfe-01d5-4025-910b-84abb9369997"
}
}
New-MgEntitlementManagementResourceRequest -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_resource_request import AccessPackageResourceRequest
from msgraph.generated.models.access_package_request_type import AccessPackageRequestType
from msgraph.generated.models.access_package_resource import AccessPackageResource
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 = AccessPackageResourceRequest(
request_type = AccessPackageRequestType.AdminAdd,
resource = AccessPackageResource(
origin_id = "e81d7f57-0840-45e1-894b-f505c1bdcc1f",
origin_system = "AadApplication",
),
catalog = AccessPackageCatalog(
id = "beedadfe-01d5-4025-910b-84abb9369997",
),
)
result = await graph_client.identity_governance.entitlement_management.resource_requests.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "acc2294e-f37f-42d3-981d-4e83847ed0ce",
"requestType": "adminAdd",
"state": "delivered"
}
Example 3: Create an accessPackageResourceRequest for adding a SharePoint Online site as a resource
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/resourceRequests
Content-type: application/json
{
"requestType": "adminAdd",
"resource": {
"originId": "https://microsoft.sharepoint.com/sites/Example",
"originSystem": "SharePointOnline"
},
"catalog": {
"id": "beedadfe-01d5-4025-910b-84abb9369997"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new AccessPackageResourceRequest
{
RequestType = AccessPackageRequestType.AdminAdd,
Resource = new AccessPackageResource
{
OriginId = "https://microsoft.sharepoint.com/sites/Example",
OriginSystem = "SharePointOnline",
},
Catalog = new AccessPackageCatalog
{
Id = "beedadfe-01d5-4025-910b-84abb9369997",
},
};
// 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.ResourceRequests.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 resource-requests create --body '{\
"requestType": "adminAdd",\
"resource": {\
"originId": "https://microsoft.sharepoint.com/sites/Example",\
"originSystem": "SharePointOnline"\
},\
"catalog": {\
"id": "beedadfe-01d5-4025-910b-84abb9369997"\
}\
}\
'
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.NewAccessPackageResourceRequest()
requestType := graphmodels.ADMINADD_ACCESSPACKAGEREQUESTTYPE
requestBody.SetRequestType(&requestType)
resource := graphmodels.NewAccessPackageResource()
originId := "https://microsoft.sharepoint.com/sites/Example"
resource.SetOriginId(&originId)
originSystem := "SharePointOnline"
resource.SetOriginSystem(&originSystem)
requestBody.SetResource(resource)
catalog := graphmodels.NewAccessPackageCatalog()
id := "beedadfe-01d5-4025-910b-84abb9369997"
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
resourceRequests, err := graphClient.IdentityGovernance().EntitlementManagement().ResourceRequests().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);
AccessPackageResourceRequest accessPackageResourceRequest = new AccessPackageResourceRequest();
accessPackageResourceRequest.setRequestType(AccessPackageRequestType.AdminAdd);
AccessPackageResource resource = new AccessPackageResource();
resource.setOriginId("https://microsoft.sharepoint.com/sites/Example");
resource.setOriginSystem("SharePointOnline");
accessPackageResourceRequest.setResource(resource);
AccessPackageCatalog catalog = new AccessPackageCatalog();
catalog.setId("beedadfe-01d5-4025-910b-84abb9369997");
accessPackageResourceRequest.setCatalog(catalog);
AccessPackageResourceRequest result = graphClient.identityGovernance().entitlementManagement().resourceRequests().post(accessPackageResourceRequest);
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 accessPackageResourceRequest = {
requestType: 'adminAdd',
resource: {
originId: 'https://microsoft.sharepoint.com/sites/Example',
originSystem: 'SharePointOnline'
},
catalog: {
id: 'beedadfe-01d5-4025-910b-84abb9369997'
}
};
await client.api('/identityGovernance/entitlementManagement/resourceRequests')
.post(accessPackageResourceRequest);
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\AccessPackageResourceRequest;
use Microsoft\Graph\Generated\Models\AccessPackageRequestType;
use Microsoft\Graph\Generated\Models\AccessPackageResource;
use Microsoft\Graph\Generated\Models\AccessPackageCatalog;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AccessPackageResourceRequest();
$requestBody->setRequestType(new AccessPackageRequestType('adminAdd'));
$resource = new AccessPackageResource();
$resource->setOriginId('https://microsoft.sharepoint.com/sites/Example');
$resource->setOriginSystem('SharePointOnline');
$requestBody->setResource($resource);
$catalog = new AccessPackageCatalog();
$catalog->setId('beedadfe-01d5-4025-910b-84abb9369997');
$requestBody->setCatalog($catalog);
$result = $graphServiceClient->identityGovernance()->entitlementManagement()->resourceRequests()->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 = @{
requestType = "adminAdd"
resource = @{
originId = "https://microsoft.sharepoint.com/sites/Example"
originSystem = "SharePointOnline"
}
catalog = @{
id = "beedadfe-01d5-4025-910b-84abb9369997"
}
}
New-MgEntitlementManagementResourceRequest -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_resource_request import AccessPackageResourceRequest
from msgraph.generated.models.access_package_request_type import AccessPackageRequestType
from msgraph.generated.models.access_package_resource import AccessPackageResource
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 = AccessPackageResourceRequest(
request_type = AccessPackageRequestType.AdminAdd,
resource = AccessPackageResource(
origin_id = "https://microsoft.sharepoint.com/sites/Example",
origin_system = "SharePointOnline",
),
catalog = AccessPackageCatalog(
id = "beedadfe-01d5-4025-910b-84abb9369997",
),
)
result = await graph_client.identity_governance.entitlement_management.resource_requests.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "acc2294e-f37f-42d3-981d-4e83847ed0ce",
"requestType": "adminAdd",
"state": "delivered"
}
Example 4: Create an accessPackageResourceRequest for removing a resource
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/resourceRequests
Content-type: application/json
{
"requestType": "adminRemove",
"resource": {
"id": "1d0bb962-5bb0-4b16-a488-fda7a788b9ec"
},
"catalog": {
"id": "beedadfe-01d5-4025-910b-84abb9369997"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new AccessPackageResourceRequest
{
RequestType = AccessPackageRequestType.AdminRemove,
Resource = new AccessPackageResource
{
Id = "1d0bb962-5bb0-4b16-a488-fda7a788b9ec",
},
Catalog = new AccessPackageCatalog
{
Id = "beedadfe-01d5-4025-910b-84abb9369997",
},
};
// 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.ResourceRequests.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 resource-requests create --body '{\
"requestType": "adminRemove",\
"resource": {\
"id": "1d0bb962-5bb0-4b16-a488-fda7a788b9ec"\
},\
"catalog": {\
"id": "beedadfe-01d5-4025-910b-84abb9369997"\
}\
}\
'
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.NewAccessPackageResourceRequest()
requestType := graphmodels.ADMINREMOVE_ACCESSPACKAGEREQUESTTYPE
requestBody.SetRequestType(&requestType)
resource := graphmodels.NewAccessPackageResource()
id := "1d0bb962-5bb0-4b16-a488-fda7a788b9ec"
resource.SetId(&id)
requestBody.SetResource(resource)
catalog := graphmodels.NewAccessPackageCatalog()
id := "beedadfe-01d5-4025-910b-84abb9369997"
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
resourceRequests, err := graphClient.IdentityGovernance().EntitlementManagement().ResourceRequests().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);
AccessPackageResourceRequest accessPackageResourceRequest = new AccessPackageResourceRequest();
accessPackageResourceRequest.setRequestType(AccessPackageRequestType.AdminRemove);
AccessPackageResource resource = new AccessPackageResource();
resource.setId("1d0bb962-5bb0-4b16-a488-fda7a788b9ec");
accessPackageResourceRequest.setResource(resource);
AccessPackageCatalog catalog = new AccessPackageCatalog();
catalog.setId("beedadfe-01d5-4025-910b-84abb9369997");
accessPackageResourceRequest.setCatalog(catalog);
AccessPackageResourceRequest result = graphClient.identityGovernance().entitlementManagement().resourceRequests().post(accessPackageResourceRequest);
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 accessPackageResourceRequest = {
requestType: 'adminRemove',
resource: {
id: '1d0bb962-5bb0-4b16-a488-fda7a788b9ec'
},
catalog: {
id: 'beedadfe-01d5-4025-910b-84abb9369997'
}
};
await client.api('/identityGovernance/entitlementManagement/resourceRequests')
.post(accessPackageResourceRequest);
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\AccessPackageResourceRequest;
use Microsoft\Graph\Generated\Models\AccessPackageRequestType;
use Microsoft\Graph\Generated\Models\AccessPackageResource;
use Microsoft\Graph\Generated\Models\AccessPackageCatalog;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AccessPackageResourceRequest();
$requestBody->setRequestType(new AccessPackageRequestType('adminRemove'));
$resource = new AccessPackageResource();
$resource->setId('1d0bb962-5bb0-4b16-a488-fda7a788b9ec');
$requestBody->setResource($resource);
$catalog = new AccessPackageCatalog();
$catalog->setId('beedadfe-01d5-4025-910b-84abb9369997');
$requestBody->setCatalog($catalog);
$result = $graphServiceClient->identityGovernance()->entitlementManagement()->resourceRequests()->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 = @{
requestType = "adminRemove"
resource = @{
id = "1d0bb962-5bb0-4b16-a488-fda7a788b9ec"
}
catalog = @{
id = "beedadfe-01d5-4025-910b-84abb9369997"
}
}
New-MgEntitlementManagementResourceRequest -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_resource_request import AccessPackageResourceRequest
from msgraph.generated.models.access_package_request_type import AccessPackageRequestType
from msgraph.generated.models.access_package_resource import AccessPackageResource
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 = AccessPackageResourceRequest(
request_type = AccessPackageRequestType.AdminRemove,
resource = AccessPackageResource(
id = "1d0bb962-5bb0-4b16-a488-fda7a788b9ec",
),
catalog = AccessPackageCatalog(
id = "beedadfe-01d5-4025-910b-84abb9369997",
),
)
result = await graph_client.identity_governance.entitlement_management.resource_requests.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "acc2294e-f37f-42d3-981d-4e83847ed0ce",
"requestType": "adminRemove",
"state": "delivered"
}
Example 5: Create an accessPackageResourceRequest for updating an application as a resource with attributes
The following example shows a request to update a resource in a catalog, for an application that was already added as a resource, with two attributes.
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/resourceRequests
Content-type: application/json
{
"requestType": "adminUpdate",
"resource": {
"originId": "e81d7f57-0840-45e1-894b-f505c1bdcc1f",
"originSystem": "AadApplication",
"attributes": [
{
"destination": {
"@odata.type": "microsoft.graph.accessPackageUserDirectoryAttributeStore"
},
"name": "officeLocation",
"source": {
"@odata.type": "#microsoft.graph.accessPackageResourceAttributeQuestion",
"question": {
"@odata.type": "#microsoft.graph.accessPackageTextInputQuestion",
"sequence": 1,
"isRequired": true,
"isAnswerEditable": true,
"text": "What office do you work at?",
"isSingleLineQuestion": true,
"regexPattern": "[a-zA-Z]+[a-zA-Z\\s]*"
}
}
},
{
"destination": {
"@odata.type": "microsoft.graph.accessPackageUserDirectoryAttributeStore"
},
"name": "extension_e409fedc08ab4807a9eb53ebc0d6cc9f_Expense_CostCenter",
"source": {
"@odata.type": "#microsoft.graph.accessPackageResourceAttributeQuestion",
"question": {
"@odata.type": "#microsoft.graph.accessPackageTextInputQuestion",
"isRequired": false,
"text": "What is your cost center number?",
"sequence": 0,
"isSingleLineQuestion": true,
"regexPattern": "[0-9]*"
}
}
}
]
},
"catalog": {
"id": "beedadfe-01d5-4025-910b-84abb9369997"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new AccessPackageResourceRequest
{
RequestType = AccessPackageRequestType.AdminUpdate,
Resource = new AccessPackageResource
{
OriginId = "e81d7f57-0840-45e1-894b-f505c1bdcc1f",
OriginSystem = "AadApplication",
Attributes = new List<AccessPackageResourceAttribute>
{
new AccessPackageResourceAttribute
{
Destination = new AccessPackageUserDirectoryAttributeStore
{
OdataType = "microsoft.graph.accessPackageUserDirectoryAttributeStore",
},
Name = "officeLocation",
Source = new AccessPackageResourceAttributeQuestion
{
OdataType = "#microsoft.graph.accessPackageResourceAttributeQuestion",
Question = new AccessPackageTextInputQuestion
{
OdataType = "#microsoft.graph.accessPackageTextInputQuestion",
Sequence = 1,
IsRequired = true,
IsAnswerEditable = true,
Text = "What office do you work at?",
IsSingleLineQuestion = true,
RegexPattern = "[a-zA-Z]+[a-zA-Z\s]*",
},
},
},
new AccessPackageResourceAttribute
{
Destination = new AccessPackageUserDirectoryAttributeStore
{
OdataType = "microsoft.graph.accessPackageUserDirectoryAttributeStore",
},
Name = "extension_e409fedc08ab4807a9eb53ebc0d6cc9f_Expense_CostCenter",
Source = new AccessPackageResourceAttributeQuestion
{
OdataType = "#microsoft.graph.accessPackageResourceAttributeQuestion",
Question = new AccessPackageTextInputQuestion
{
OdataType = "#microsoft.graph.accessPackageTextInputQuestion",
IsRequired = false,
Text = "What is your cost center number?",
Sequence = 0,
IsSingleLineQuestion = true,
RegexPattern = "[0-9]*",
},
},
},
},
},
Catalog = new AccessPackageCatalog
{
Id = "beedadfe-01d5-4025-910b-84abb9369997",
},
};
// 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.ResourceRequests.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 resource-requests create --body '{\
"requestType": "adminUpdate",\
"resource": {\
"originId": "e81d7f57-0840-45e1-894b-f505c1bdcc1f",\
"originSystem": "AadApplication",\
"attributes": [\
{\
"destination": {\
"@odata.type": "microsoft.graph.accessPackageUserDirectoryAttributeStore"\
},\
"name": "officeLocation",\
"source": {\
"@odata.type": "#microsoft.graph.accessPackageResourceAttributeQuestion",\
"question": {\
"@odata.type": "#microsoft.graph.accessPackageTextInputQuestion",\
"sequence": 1,\
"isRequired": true,\
"isAnswerEditable": true,\
"text": "What office do you work at?",\
"isSingleLineQuestion": true,\
"regexPattern": "[a-zA-Z]+[a-zA-Z\\s]*"\
}\
}\
},\
{\
"destination": {\
"@odata.type": "microsoft.graph.accessPackageUserDirectoryAttributeStore"\
},\
"name": "extension_e409fedc08ab4807a9eb53ebc0d6cc9f_Expense_CostCenter",\
"source": {\
"@odata.type": "#microsoft.graph.accessPackageResourceAttributeQuestion",\
"question": {\
"@odata.type": "#microsoft.graph.accessPackageTextInputQuestion",\
"isRequired": false,\
"text": "What is your cost center number?",\
"sequence": 0,\
"isSingleLineQuestion": true,\
"regexPattern": "[0-9]*"\
}\
}\
}\
]\
},\
"catalog": {\
"id": "beedadfe-01d5-4025-910b-84abb9369997"\
}\
}\
'
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.NewAccessPackageResourceRequest()
requestType := graphmodels.ADMINUPDATE_ACCESSPACKAGEREQUESTTYPE
requestBody.SetRequestType(&requestType)
resource := graphmodels.NewAccessPackageResource()
originId := "e81d7f57-0840-45e1-894b-f505c1bdcc1f"
resource.SetOriginId(&originId)
originSystem := "AadApplication"
resource.SetOriginSystem(&originSystem)
accessPackageResourceAttribute := graphmodels.NewAccessPackageResourceAttribute()
destination := graphmodels.NewAccessPackageUserDirectoryAttributeStore()
accessPackageResourceAttribute.SetDestination(destination)
name := "officeLocation"
accessPackageResourceAttribute.SetName(&name)
source := graphmodels.NewAccessPackageResourceAttributeQuestion()
question := graphmodels.NewAccessPackageTextInputQuestion()
sequence := int32(1)
question.SetSequence(&sequence)
isRequired := true
question.SetIsRequired(&isRequired)
isAnswerEditable := true
question.SetIsAnswerEditable(&isAnswerEditable)
text := "What office do you work at?"
question.SetText(&text)
isSingleLineQuestion := true
question.SetIsSingleLineQuestion(&isSingleLineQuestion)
regexPattern := "[a-zA-Z]+[a-zA-Z\s]*"
question.SetRegexPattern(®exPattern)
source.SetQuestion(question)
accessPackageResourceAttribute.SetSource(source)
accessPackageResourceAttribute1 := graphmodels.NewAccessPackageResourceAttribute()
destination := graphmodels.NewAccessPackageUserDirectoryAttributeStore()
accessPackageResourceAttribute1.SetDestination(destination)
name := "extension_e409fedc08ab4807a9eb53ebc0d6cc9f_Expense_CostCenter"
accessPackageResourceAttribute1.SetName(&name)
source := graphmodels.NewAccessPackageResourceAttributeQuestion()
question := graphmodels.NewAccessPackageTextInputQuestion()
isRequired := false
question.SetIsRequired(&isRequired)
text := "What is your cost center number?"
question.SetText(&text)
sequence := int32(0)
question.SetSequence(&sequence)
isSingleLineQuestion := true
question.SetIsSingleLineQuestion(&isSingleLineQuestion)
regexPattern := "[0-9]*"
question.SetRegexPattern(®exPattern)
source.SetQuestion(question)
accessPackageResourceAttribute1.SetSource(source)
attributes := []graphmodels.AccessPackageResourceAttributeable {
accessPackageResourceAttribute,
accessPackageResourceAttribute1,
}
resource.SetAttributes(attributes)
requestBody.SetResource(resource)
catalog := graphmodels.NewAccessPackageCatalog()
id := "beedadfe-01d5-4025-910b-84abb9369997"
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
resourceRequests, err := graphClient.IdentityGovernance().EntitlementManagement().ResourceRequests().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);
AccessPackageResourceRequest accessPackageResourceRequest = new AccessPackageResourceRequest();
accessPackageResourceRequest.setRequestType(AccessPackageRequestType.AdminUpdate);
AccessPackageResource resource = new AccessPackageResource();
resource.setOriginId("e81d7f57-0840-45e1-894b-f505c1bdcc1f");
resource.setOriginSystem("AadApplication");
LinkedList<AccessPackageResourceAttribute> attributes = new LinkedList<AccessPackageResourceAttribute>();
AccessPackageResourceAttribute accessPackageResourceAttribute = new AccessPackageResourceAttribute();
AccessPackageUserDirectoryAttributeStore destination = new AccessPackageUserDirectoryAttributeStore();
destination.setOdataType("microsoft.graph.accessPackageUserDirectoryAttributeStore");
accessPackageResourceAttribute.setDestination(destination);
accessPackageResourceAttribute.setName("officeLocation");
AccessPackageResourceAttributeQuestion source = new AccessPackageResourceAttributeQuestion();
source.setOdataType("#microsoft.graph.accessPackageResourceAttributeQuestion");
AccessPackageTextInputQuestion question = new AccessPackageTextInputQuestion();
question.setOdataType("#microsoft.graph.accessPackageTextInputQuestion");
question.setSequence(1);
question.setIsRequired(true);
question.setIsAnswerEditable(true);
question.setText("What office do you work at?");
question.setIsSingleLineQuestion(true);
question.setRegexPattern("[a-zA-Z]+[a-zA-Z\s]*");
source.setQuestion(question);
accessPackageResourceAttribute.setSource(source);
attributes.add(accessPackageResourceAttribute);
AccessPackageResourceAttribute accessPackageResourceAttribute1 = new AccessPackageResourceAttribute();
AccessPackageUserDirectoryAttributeStore destination1 = new AccessPackageUserDirectoryAttributeStore();
destination1.setOdataType("microsoft.graph.accessPackageUserDirectoryAttributeStore");
accessPackageResourceAttribute1.setDestination(destination1);
accessPackageResourceAttribute1.setName("extension_e409fedc08ab4807a9eb53ebc0d6cc9f_Expense_CostCenter");
AccessPackageResourceAttributeQuestion source1 = new AccessPackageResourceAttributeQuestion();
source1.setOdataType("#microsoft.graph.accessPackageResourceAttributeQuestion");
AccessPackageTextInputQuestion question1 = new AccessPackageTextInputQuestion();
question1.setOdataType("#microsoft.graph.accessPackageTextInputQuestion");
question1.setIsRequired(false);
question1.setText("What is your cost center number?");
question1.setSequence(0);
question1.setIsSingleLineQuestion(true);
question1.setRegexPattern("[0-9]*");
source1.setQuestion(question1);
accessPackageResourceAttribute1.setSource(source1);
attributes.add(accessPackageResourceAttribute1);
resource.setAttributes(attributes);
accessPackageResourceRequest.setResource(resource);
AccessPackageCatalog catalog = new AccessPackageCatalog();
catalog.setId("beedadfe-01d5-4025-910b-84abb9369997");
accessPackageResourceRequest.setCatalog(catalog);
AccessPackageResourceRequest result = graphClient.identityGovernance().entitlementManagement().resourceRequests().post(accessPackageResourceRequest);
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 accessPackageResourceRequest = {
requestType: 'adminUpdate',
resource: {
originId: 'e81d7f57-0840-45e1-894b-f505c1bdcc1f',
originSystem: 'AadApplication',
attributes: [
{
destination: {
'@odata.type': 'microsoft.graph.accessPackageUserDirectoryAttributeStore'
},
name: 'officeLocation',
source: {
'@odata.type': '#microsoft.graph.accessPackageResourceAttributeQuestion',
question: {
'@odata.type': '#microsoft.graph.accessPackageTextInputQuestion',
sequence: 1,
isRequired: true,
isAnswerEditable: true,
text: 'What office do you work at?',
isSingleLineQuestion: true,
regexPattern: '[a-zA-Z]+[a-zA-Z\\s]*'
}
}
},
{
destination: {
'@odata.type': 'microsoft.graph.accessPackageUserDirectoryAttributeStore'
},
name: 'extension_e409fedc08ab4807a9eb53ebc0d6cc9f_Expense_CostCenter',
source: {
'@odata.type': '#microsoft.graph.accessPackageResourceAttributeQuestion',
question: {
'@odata.type': '#microsoft.graph.accessPackageTextInputQuestion',
isRequired: false,
text: 'What is your cost center number?',
sequence: 0,
isSingleLineQuestion: true,
regexPattern: '[0-9]*'
}
}
}
]
},
catalog: {
id: 'beedadfe-01d5-4025-910b-84abb9369997'
}
};
await client.api('/identityGovernance/entitlementManagement/resourceRequests')
.post(accessPackageResourceRequest);
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\AccessPackageResourceRequest;
use Microsoft\Graph\Generated\Models\AccessPackageRequestType;
use Microsoft\Graph\Generated\Models\AccessPackageResource;
use Microsoft\Graph\Generated\Models\AccessPackageResourceAttribute;
use Microsoft\Graph\Generated\Models\AccessPackageUserDirectoryAttributeStore;
use Microsoft\Graph\Generated\Models\AccessPackageResourceAttributeQuestion;
use Microsoft\Graph\Generated\Models\AccessPackageTextInputQuestion;
use Microsoft\Graph\Generated\Models\AccessPackageCatalog;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AccessPackageResourceRequest();
$requestBody->setRequestType(new AccessPackageRequestType('adminUpdate'));
$resource = new AccessPackageResource();
$resource->setOriginId('e81d7f57-0840-45e1-894b-f505c1bdcc1f');
$resource->setOriginSystem('AadApplication');
$attributesAccessPackageResourceAttribute1 = new AccessPackageResourceAttribute();
$attributesAccessPackageResourceAttribute1Destination = new AccessPackageUserDirectoryAttributeStore();
$attributesAccessPackageResourceAttribute1Destination->setOdataType('microsoft.graph.accessPackageUserDirectoryAttributeStore');
$attributesAccessPackageResourceAttribute1->setDestination($attributesAccessPackageResourceAttribute1Destination);
$attributesAccessPackageResourceAttribute1->setName('officeLocation');
$attributesAccessPackageResourceAttribute1Source = new AccessPackageResourceAttributeQuestion();
$attributesAccessPackageResourceAttribute1Source->setOdataType('#microsoft.graph.accessPackageResourceAttributeQuestion');
$attributesAccessPackageResourceAttribute1SourceQuestion = new AccessPackageTextInputQuestion();
$attributesAccessPackageResourceAttribute1SourceQuestion->setOdataType('#microsoft.graph.accessPackageTextInputQuestion');
$attributesAccessPackageResourceAttribute1SourceQuestion->setSequence(1);
$attributesAccessPackageResourceAttribute1SourceQuestion->setIsRequired(true);
$attributesAccessPackageResourceAttribute1SourceQuestion->setIsAnswerEditable(true);
$attributesAccessPackageResourceAttribute1SourceQuestion->setText('What office do you work at?');
$attributesAccessPackageResourceAttribute1SourceQuestion->setIsSingleLineQuestion(true);
$attributesAccessPackageResourceAttribute1SourceQuestion->setRegexPattern('[a-zA-Z]+[a-zA-Z\s]*');
$attributesAccessPackageResourceAttribute1Source->setQuestion($attributesAccessPackageResourceAttribute1SourceQuestion);
$attributesAccessPackageResourceAttribute1->setSource($attributesAccessPackageResourceAttribute1Source);
$attributesArray []= $attributesAccessPackageResourceAttribute1;
$attributesAccessPackageResourceAttribute2 = new AccessPackageResourceAttribute();
$attributesAccessPackageResourceAttribute2Destination = new AccessPackageUserDirectoryAttributeStore();
$attributesAccessPackageResourceAttribute2Destination->setOdataType('microsoft.graph.accessPackageUserDirectoryAttributeStore');
$attributesAccessPackageResourceAttribute2->setDestination($attributesAccessPackageResourceAttribute2Destination);
$attributesAccessPackageResourceAttribute2->setName('extension_e409fedc08ab4807a9eb53ebc0d6cc9f_Expense_CostCenter');
$attributesAccessPackageResourceAttribute2Source = new AccessPackageResourceAttributeQuestion();
$attributesAccessPackageResourceAttribute2Source->setOdataType('#microsoft.graph.accessPackageResourceAttributeQuestion');
$attributesAccessPackageResourceAttribute2SourceQuestion = new AccessPackageTextInputQuestion();
$attributesAccessPackageResourceAttribute2SourceQuestion->setOdataType('#microsoft.graph.accessPackageTextInputQuestion');
$attributesAccessPackageResourceAttribute2SourceQuestion->setIsRequired(false);
$attributesAccessPackageResourceAttribute2SourceQuestion->setText('What is your cost center number?');
$attributesAccessPackageResourceAttribute2SourceQuestion->setSequence(0);
$attributesAccessPackageResourceAttribute2SourceQuestion->setIsSingleLineQuestion(true);
$attributesAccessPackageResourceAttribute2SourceQuestion->setRegexPattern('[0-9]*');
$attributesAccessPackageResourceAttribute2Source->setQuestion($attributesAccessPackageResourceAttribute2SourceQuestion);
$attributesAccessPackageResourceAttribute2->setSource($attributesAccessPackageResourceAttribute2Source);
$attributesArray []= $attributesAccessPackageResourceAttribute2;
$resource->setAttributes($attributesArray);
$requestBody->setResource($resource);
$catalog = new AccessPackageCatalog();
$catalog->setId('beedadfe-01d5-4025-910b-84abb9369997');
$requestBody->setCatalog($catalog);
$result = $graphServiceClient->identityGovernance()->entitlementManagement()->resourceRequests()->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 = @{
requestType = "adminUpdate"
resource = @{
originId = "e81d7f57-0840-45e1-894b-f505c1bdcc1f"
originSystem = "AadApplication"
attributes = @(
@{
destination = @{
"@odata.type" = "microsoft.graph.accessPackageUserDirectoryAttributeStore"
}
name = "officeLocation"
source = @{
"@odata.type" = "#microsoft.graph.accessPackageResourceAttributeQuestion"
question = @{
"@odata.type" = "#microsoft.graph.accessPackageTextInputQuestion"
sequence =
isRequired = $true
isAnswerEditable = $true
text = "What office do you work at?"
isSingleLineQuestion = $true
regexPattern = "[a-zA-Z]+[a-zA-Z\s]*"
}
}
}
@{
destination = @{
"@odata.type" = "microsoft.graph.accessPackageUserDirectoryAttributeStore"
}
name = "extension_e409fedc08ab4807a9eb53ebc0d6cc9f_Expense_CostCenter"
source = @{
"@odata.type" = "#microsoft.graph.accessPackageResourceAttributeQuestion"
question = @{
"@odata.type" = "#microsoft.graph.accessPackageTextInputQuestion"
isRequired = $false
text = "What is your cost center number?"
sequence =
isSingleLineQuestion = $true
regexPattern = "[0-9]*"
}
}
}
)
}
catalog = @{
id = "beedadfe-01d5-4025-910b-84abb9369997"
}
}
New-MgEntitlementManagementResourceRequest -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_resource_request import AccessPackageResourceRequest
from msgraph.generated.models.access_package_request_type import AccessPackageRequestType
from msgraph.generated.models.access_package_resource import AccessPackageResource
from msgraph.generated.models.access_package_resource_attribute import AccessPackageResourceAttribute
from msgraph.generated.models.access_package_user_directory_attribute_store import AccessPackageUserDirectoryAttributeStore
from msgraph.generated.models.access_package_resource_attribute_question import AccessPackageResourceAttributeQuestion
from msgraph.generated.models.access_package_text_input_question import AccessPackageTextInputQuestion
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 = AccessPackageResourceRequest(
request_type = AccessPackageRequestType.AdminUpdate,
resource = AccessPackageResource(
origin_id = "e81d7f57-0840-45e1-894b-f505c1bdcc1f",
origin_system = "AadApplication",
attributes = [
AccessPackageResourceAttribute(
destination = AccessPackageUserDirectoryAttributeStore(
odata_type = "microsoft.graph.accessPackageUserDirectoryAttributeStore",
),
name = "officeLocation",
source = AccessPackageResourceAttributeQuestion(
odata_type = "#microsoft.graph.accessPackageResourceAttributeQuestion",
question = AccessPackageTextInputQuestion(
odata_type = "#microsoft.graph.accessPackageTextInputQuestion",
sequence = 1,
is_required = True,
is_answer_editable = True,
text = "What office do you work at?",
is_single_line_question = True,
regex_pattern = "[a-zA-Z]+[a-zA-Z\s]*",
),
),
),
AccessPackageResourceAttribute(
destination = AccessPackageUserDirectoryAttributeStore(
odata_type = "microsoft.graph.accessPackageUserDirectoryAttributeStore",
),
name = "extension_e409fedc08ab4807a9eb53ebc0d6cc9f_Expense_CostCenter",
source = AccessPackageResourceAttributeQuestion(
odata_type = "#microsoft.graph.accessPackageResourceAttributeQuestion",
question = AccessPackageTextInputQuestion(
odata_type = "#microsoft.graph.accessPackageTextInputQuestion",
is_required = False,
text = "What is your cost center number?",
sequence = 0,
is_single_line_question = True,
regex_pattern = "[0-9]*",
),
),
),
],
),
catalog = AccessPackageCatalog(
id = "beedadfe-01d5-4025-910b-84abb9369997",
),
)
result = await graph_client.identity_governance.entitlement_management.resource_requests.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "acc2294e-f37f-42d3-981d-4e83847ed0ce",
"requestType": "adminAdd",
"state": "delivered"
}