You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Depending on the parameters order of my query the command will succeed or failed:
Non-working URI: $uri="https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?`$filter=scopeId eq '/' and scopeType eq 'DirectoryRole' and roleDefinitionId eq 'c2314e04-b23a-4dd5-915f-b0ab7487c9d9'"
Working URI: $uri="https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?`$filter=scopeType eq 'DirectoryRole' and roleDefinitionId eq 'c2314e04-b23a-4dd5-915f-b0ab7487c9d9' and scopeId eq '/'"
command: Invoke-MgGraphRequest $uri -Method get -Verbose
URI is half encoded in V5 but OK in V7:
Microsoft.Graph.Authentication version 2.23.0
this is working fine with PowerShell V7
Expected behavior
the result should be the same whatever the parameters order
How to reproduce
Invoke-MgGraphRequest $uri -Method get -Verbose
with above URIs
{"error":{"code":"BadRequest","message":"Invalid filter clause: Syntax error: character '%' is not valid at position 14 in 'scopeId eq
'/'%20%20and%20scopeType%20eq%20'DirectoryRole'%20and%20roleDefinitionId%20eq%20'c2314e04-b23a-4dd5-915f-b0ab7487c9d9''.","innerError":{"date":"2024-09
-05T17:31:39","request-id":"e5794459-7150-4d4a-80dd-cb155fde8657","client-request-id":"c9f4ef07-3e2a-4df4-9737-8de15ff536f2"}}}
</details>
### Configuration
Win11 64b
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.22621.4155
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.4155
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
### Other information
_No response_
The text was updated successfully, but these errors were encountered:
@kayasax is the order change scenario in PowerShell 5 or 7? Do you mean that this experience is only in PowerShell 5? Is the experience the same when using the alternative cmdlet Get-MgPolicyRoleManagementPolicyAssignment -Filter "scopeId eq '/' and scopeType eq 'DirectoryRole' and roleDefinitionId eq 'c2314e04-b23a-4dd5-915f-b0ab7487c9d9'" -Debug ?
Hi @timayabi2020 , yes the error is surfacing only in PowerShell 5.
Both URIs working fine in PS7.
I just tried the alternative cmdlet and its working fine from V 5 and 7.
But my goal was to rely on invoke-mggraphrequest only to avoid the need to install other modules.
Describe the bug
Depending on the parameters order of my query the command will succeed or failed:
Non-working URI:
$uri="https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?`$filter=scopeId eq '/' and scopeType eq 'DirectoryRole' and roleDefinitionId eq 'c2314e04-b23a-4dd5-915f-b0ab7487c9d9'"
Working URI:
$uri="https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?`$filter=scopeType eq 'DirectoryRole' and roleDefinitionId eq 'c2314e04-b23a-4dd5-915f-b0ab7487c9d9' and scopeId eq '/'"
command:
Invoke-MgGraphRequest $uri -Method get -Verbose
URI is half encoded in V5 but OK in V7:
Microsoft.Graph.Authentication version 2.23.0
this is working fine with PowerShell V7
Expected behavior
the result should be the same whatever the parameters order
How to reproduce
Invoke-MgGraphRequest $uri -Method get -Verbose
with above URIs
SDK Version
2.23.0
Latest version known to work for scenario above?
No response
Known Workarounds
change parameters order
Debug output
Click to expand log
```DÉBOGUER : GET
https://graph.microsoft.com/v1.0/policies/roleManagementPolicyAssignments?$filter=scopeId%20eq%20'/'%2520%2520and%2520scopeType%2520eq%2520'DirectoryRo
le'%2520and%2520roleDefinitionId%2520eq%2520'c2314e04-b23a-4dd5-915f-b0ab7487c9d9'
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
request-id: e5794459-7150-4d4a-80dd-cb155fde8657
client-request-id: c9f4ef07-3e2a-4df4-9737-8de15ff536f2
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"PA2PEPF00012B8E"}}
Date: Thu, 05 Sep 2024 17:31:38 GMT
Content-Encoding: gzip
Content-Type: application/json
{"error":{"code":"BadRequest","message":"Invalid filter clause: Syntax error: character '%' is not valid at position 14 in 'scopeId eq
'/'%20%20and%20scopeType%20eq%20'DirectoryRole'%20and%20roleDefinitionId%20eq%20'c2314e04-b23a-4dd5-915f-b0ab7487c9d9''.","innerError":{"date":"2024-09
-05T17:31:39","request-id":"e5794459-7150-4d4a-80dd-cb155fde8657","client-request-id":"c9f4ef07-3e2a-4df4-9737-8de15ff536f2"}}}
The text was updated successfully, but these errors were encountered: