msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

New-MgEntitlementManagementAccessPackageAssignmentPolicy returns HTTP Code 404 response ("No HTTP resource was found that matches the request URI")

Open manuel-falcao-magalhaes opened this issue 1 year ago • 2 comments

Describe the bug

Executing "New-MgEntitlementManagementAccessPackageAssignmentPolicy -AccessPackageId [Object id here]" returns the following error:

"New-MgEntitlementManagementAccessPackageAssignmentPolicy_CreateExpanded: No HTTP resource was found that matches the request URI 'https://igaelm-asev3-ecapi-neu.igaelm-asev3-environment-neu.p.azurewebsites.net/api/v1/accessPackages('[Redacted]')/assignmentPolicies'.

Status: 404 (NotFound) ErrorCode: Date: 2023-12-28T10:26:10

Headers: Transfer-Encoding : chunked Location : https://igaelm-asev3-ecapi-neu.igaelm-asev3-environment-neu.p.azurewebsites.net/api/v1/accessPackages('[Redacted]')/assignmentPolicies Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : b8a1fcdc-dbae-4949-b01d-a36a2fa88b89 client-request-id : 48dbad16-3656-47bc-a26f-c7139ef7760c x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"003","RoleInstance":"PA1PEPF000A53BA"}} Date : Thu, 28 Dec 2023 10:26:09 GMT"

To Reproduce

  1. After authenticating with Connect-MgGraph, execute "New-MgEntitlementManagementAccessPackageAssignmentPolicy" and pass a value into the "-AccessPackageId" parameter.

  2. The error will appear after 1.

Expected behavior

In the example above, I was expecting to return a BadRequest, since no body was passed. However, it seems that the endpoint targeted doesn't exist in the first place, so the observed behavior would occur with or without a body.

Debug Output DEBUG: ============================ HTTP REQUEST ============================

HTTP Method: POST

Absolute Uri: https://graph.microsoft.com/v1.0/identityGovernance/entitlementManagement/accessPackages/[Redacted]/assignmentPolicies

Headers: FeatureFlag : 00000043 Cache-Control : no-store, no-cache User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; en-US),PowerShell/7.4.0 Accept-Encoding : gzip SdkVersion : graph-powershell/2.11.1 client-request-id : c3dede82-240d-422a-8e2b-b4bb132a9371

Body: {}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code: NotFound

Headers: Transfer-Encoding : chunked Location : https://igaelm-asev3-ecapi-neu.igaelm-asev3-environment-neu.p.azurewebsites.net/api/v1/accessPackages('[Redacted]')/assignmentPolicies Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : f63464f5-fd52-4532-9d50-a54bf7f18482 client-request-id : c3dede82-240d-422a-8e2b-b4bb132a9371 x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"002","RoleInstance":"PA3PEPF00000836"}} Date : Thu, 28 Dec 2023 10:38:03 GMT

Body: { "error": { "code": "", "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/accessPackages('[Redacted]')/assignmentPolicies'.", "innerError": { "date": "2023-12-28T10:38:04", "request-id": "f63464f5-fd52-4532-9d50-a54bf7f18482", "client-request-id": "c3dede82-240d-422a-8e2b-b4bb132a9371" } } }

New-MgEntitlementManagementAccessPackageAssignmentPolicy_CreateExpanded: No HTTP resource was found that matches the request URI 'https://igaelm-asev3-ecapi-neu.igaelm-asev3-environment-neu.p.azurewebsites.net/api/v1/accessPackages('[Redacted]')/assignmentPolicies'.

Status: 404 (NotFound) ErrorCode: Date: 2023-12-28T10:38:04

Headers: Transfer-Encoding : chunked Location : https://igaelm-asev3-ecapi-neu.igaelm-asev3-environment-neu.p.azurewebsites.net/api/v1/accessPackages('[Redacted]')/assignmentPolicies Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : f63464f5-fd52-4532-9d50-a54bf7f18482 client-request-id : c3dede82-240d-422a-8e2b-b4bb132a9371 x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"002","RoleInstance":"PA3PEPF00000836"}} Date : Thu, 28 Dec 2023 10:38:03 GMT

DEBUG: [CmdletEndProcessing]: - New-MgEntitlementManagementAccessPackageAssignmentPolicy end processing.

Module Version Name : Microsoft.Graph.Authentication Path : C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Authentication\2.11.1\Microsoft.Graph.Authentication.psm1 Description : Microsoft Graph PowerShell Authentication Module. ModuleType : Script Version : 2.11.1 NestedModules : {Microsoft.Graph.Authentication, Microsoft.Graph.Authentication.Core} ExportedFunctions : {Find-MgGraphCommand, Find-MgGraphPermission} ExportedCmdlets : {Add-MgEnvironment, Connect-MgGraph, Disconnect-MgGraph, Get-MgContext...} ExportedVariables : ExportedAliases : {Connect-Graph, Disconnect-Graph, Invoke-GraphRequest, Invoke-MgRestMethod}

Name : Microsoft.Graph.Identity.Governance Path : C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Identity.Governance\2.11.1\Microsoft.Graph.Identity.Governance.psm1 Description : Microsoft Graph PowerShell Cmdlets ModuleType : Script Version : 2.11.1 NestedModules : {Microsoft.Graph.Identity.Governance.private, Microsoft.Graph.Identity.Governance.custom} ExportedFunctions : {Add-MgIdentityGovernanceAccessReviewDefinitionInstanceDecision, Get-MgAgreement, Get-MgAgreementAcceptance, Get-MgAgreementAcceptanceCount...} ExportedCmdlets : ExportedVariables : ExportedAliases :

Environment Data Name Value


PSVersion 7.4.0 PSEdition Core GitCommitId 7.4.0 OS Microsoft Windows 10.0.22631 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

manuel-falcao-magalhaes avatar Dec 28 '23 10:12 manuel-falcao-magalhaes

Hi @manuel-falcao-magalhaes I wasn't able to reproduce the issue. I successfully ran the command by first ensuring that I had an entitlement management access package (run Get-MgEntitlementManagementAccessPackage), picked the Id from the response and ran the command as per the PowerShell code snippet example in the API reference here.

image

timayabi2020 avatar Jan 10 '24 12:01 timayabi2020

@timayabi2020 Thank you for your reply.

In your scenario "New-MgEntitlementManagementAssignmentPolicy" was used, which does work.

This issue was for "New-MgEntitlementManagementAccessPackageAssignmentPolicy", which is a documented cmdlet (https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.identity.governance/new-mgentitlementmanagementaccesspackageassignmentpolicy?view=graph-powershell-1.0).

Perhaps "New-MgEntitlementManagementAccessPackageAssignmentPolicy" could be removed, since "New-MgEntitlementManagementAssignmentPolicy" exists and it does what "New-MgEntitlementManagementAccessPackageAssignmentPolicy" would be expected to do from its name.

manuel-falcao-magalhaes avatar Jan 14 '24 16:01 manuel-falcao-magalhaes