Forum Discussion
GraphAPI Access Packages PowerShell Error
Hi,
Keep getting the below error, script has not changed and used to work fine, the script I have still created the packages but not sure if this would affect them.
Invoke-MgGraphRequest : POST https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackageResourceRequests
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
request-id: 7945fee3-7f36-408d-9ff1-c0d0671faf6e
client-request-id: 7945fee3-7f36-408d-9ff1-c0d0671faf6e
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"UK South","Slice":"E","Ring":"3","ScaleUnit":"000","RoleInstance":"LN2PEPF000066A2"}}
Date: Wed, 22 Jun 2022 14:45:59 GMT
Location: https://igaelm-asev3-ecapi-cus.igaelm-asev3-environment-cus.p.azurewebsites.net/api/v1/accessPackageResourceRequests
Content-Encoding: gzip
Content-Type: application/json
{"error":{"code":"ResourceAlreadyOnboarded","message":"The specified resource is already onboarded to
ELM.","innerError":{"date":"2022-06-22T14:46:00","request-id":"7945fee3-7f36-408d-9ff1-c0d0671faf6e","client-request-id":"7945fee3-7f36-408d-9ff1-c0d0671faf6e"}}}
At line:94 char:19
+ ... NewResourceID = Invoke-MgGraphRequest -Uri $uriADD -Method Post (@{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Method: POST, R...ication/json
}:HttpRequestMessage) [Invoke-MgGraphRequest], HttpResponseException
+ FullyQualifiedErrorId : InvokeGraphHttpResponseException,Microsoft.Graph.PowerShell.Authentication.Cmdlets.InvokeMgGraphRequest
Many thanks,
Brad
- farismalaebSteel ContributorIt seems that the resources is already onboarded.
The specified resource is already onboarded to ELM- BradThomas1495Copper Contributor
farismalaeb would this affect the access packages in any way. I can't see anything different about them
- LainRobertsonSilver Contributor
No, it won't affect them in any way.
When an exception is thrown, nothing has changed.
You'd have more reason to worry (in this specific scenario) if an exception wasn't thrown.
Behind the scenes, REST calls use GET, POST, PUT, PATCH, DELETE and so on for explicitly different purposes.
Check it out for yourself from the link below, where you can see the HTTP methods discretely aligned to different actions, such as POST = create, PATCH = update, etc. Makes it pretty hard to make a mistake.
accessPackage resource type - Microsoft Graph v1.0 | Microsoft Docs
Cheers,
Lain