0
votes

I'm using Microsoft Graph API Beta version to delete an access package. However, for deleting an access package, I need first to remove all its assignments. For doing this, I found on the official doc the accessPackageAssignment object (https://docs.microsoft.com/en-us/graph/api/resources/accesspackageassignment?view=graph-rest-beta). When I perform a get request on the assignment:

result = azureAdBeta.get('/identityGovernance/entitlementManagement/accessPackageAssignments/' + accessPackageAssignmentId)

the response is successful:

{'@odata.context': 'https://graph.microsoft.com/beta/$metadata#identityGovernance/entitlementManagement/accessPackageAssignments/$entity', 'accessPackageId': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'assignmentPolicyId': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'assignmentState': 'Delivered', 'assignmentStatus': 'Delivered', 'catalogId': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'expiredDateTime': None, 'id': '2ad2eb61-9baa-45b9-a700-bfef425d7aef', 'isExtended': False, 'schedule': {'expiration': {'duration': None, 'endDateTime': '2022-01-20T23:00:00Z', 'type': 'afterDateTime'}, 'recurrence': None, 'startDateTime': '2021-12-15T11:16:04.663Z'}, 'targetId': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}

However, when I perform a delete request:

result = azureAdBeta.delete('/identityGovernance/entitlementManagement/accessPackageAssignments/' + accessPackageAssignmentId)

I get the following error:

{'error': {'code': '', 'innerError': {'client-request-id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'date': '2021-12-15T11:32:37', 'request-id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}, 'message': 'No HTTP resource was found that matches the request URI ' "'https://igaelm-asev3-ecapi-neu.igaelm-asev3-environment-neu.p.azurewebsites.net/api/v1/accessPackageAssignments('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')'."}}

I suppose this error is due to fact that in doc no delete method is mentioned for the accessPackageAssignment object.

So how can I delete an access package assignment via Microsoft Graph?

Please refer this documentation link for reference as it aptly states the commands to delete an access package : - docs.microsoft.com/en-us/graph/api/…KartikBhiwapurkar-MT
Hi Kartik, The documentation about the Delete Access package API states that "You cannot delete an access package if it has any accessPackageAssignment." So hiw can I delete the accessPackageAssignment?Alessandro De Vitis