Closed
Description
Describe the bug
When attempting to use a + symbol in a filter string the resulting query is not correctly encoded
Expected behavior
- symbol is encoded as %2B in the request made against graph
How to reproduce
- run
Get-MgUser -Filter "onPremisesImmutableId in ('AegKW3DO+Uin3xHz7t0pIw==', 'YQuy6DbntUCGREZeTT5YwA==')" -Debug
- See that the request made contains a space in the value supplied as the $filter query parameter.
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/v1.0/users?$filter=onPremisesImmutableId in %28%27AegKW3DO Uin3xHz7t0pIw%3D%3D%27%2C %27YQuy6DbntUCGREZeTT5YwA%3D%3D%27%29
SDK Version
2.23.0
Latest version known to work for scenario above?
No response
Known Workarounds
Invoke-MgRestMethod -Uri 'https://graph.microsoft.com/v1.0/users?$filter=onPremisesImmutableId%20in%20%28%27AegKW3DO%2BUin3xHz7t0pIw%3D%3D%27%2C%20%27YQuy6DbntUCGREZeTT5YwA%3D%3D%27%29' -Debug
results in the correct encoding of the URL parameters:
DEBUG: GET /v1.0/users?$filter=onPremisesImmutableId%20in%20%28%27AegKW3DO%2BUin3xHz7t0pIw%3D%3D%27%2C%20%27YQuy6DbntUCGREZeTT5YwA%3D%3D%27%29 HTTP/1.1
HTTP: graph.microsoft.com
Debug output
Click to expand log
DEBUG: [CmdletBeginProcessing]: - Get-MgUser begin processing with parameterSet 'List'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'DeviceCode', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, Calendars.ReadWrite, openid, profile, User.Read, User.Read.All, User.ReadWrite, email].
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/v1.0/users?$filter=onPremisesImmutableId in %28%27AegKW3DO Uin3xHz7t0pIw%3D%3D%27%2C %27YQuy6DbntUCGREZeTT5YwA%3D%3D%27%29
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-US),PowerShell/7.4.5
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.23.0
client-request-id : cab71d36-315b-4ddc-ac84-e62dd819d10b
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : ff1f401e-48c6-4226-bdf3-06508749b56e
client-request-id : cab71d36-315b-4ddc-ac84-e62dd819d10b
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West US 2","Slice":"E","Ring":"4","ScaleUnit":"003","RoleInstance":"CO1PEPF00004BE8"}}
x-ms-resource-unit : 2
OData-Version : 4.0
Date : Fri, 27 Sep 2024 20:48:23 GMT
Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"value": []
}
DEBUG: [CmdletEndProcessing]: - Get-MgUser end processing.
Configuration
PS C:\Users\gavinbarron> $PSVersionTable
Name Value
PSVersion 7.4.5
PSEdition Core
GitCommitId 7.4.5
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Other information
This issue is being tracked as an IcM id=544584306