Azure / Azure/azure-powershell

Get-AzApiManagementUser doesn't provide result if $filter parameter contains +

Open
#22,050 2 comments 0 reactions 0 assignees View on GitHub
act-observability-squad API Management question Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description

When the email prefix contains a '+', no result will return for the following command:
$apimUser = Get-AzApiManagementUser -Context $apimContext -Email $emailAddress

However, https://learn.microsoft.com/en-us/rest/api/apimanagement/current-ga/user/list-by-service works fine and found that it is related to encoding URL. Manually, encoding the parameter value such as $encodedEmail=[System.Web.HttpUtility]::UrlEncode("abc+@contoso.com") before passing works good.

Is this expected? If so, we may need to add this to docs.

Expected behavior:
Provide results for the user with that specific email address.

Example:
Body:
{
"value": [
{
"id": "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.ApiManagement/service/xxx/users/abc-contoso-com",
"type": "Microsoft.ApiManagement/service/users",
"name": "abc-contoso-com",
"properties": {
"firstName": "ABC",
"lastName": "XYZ",
"email": "abc+@contoso.com",
"state": "active",
"registrationDate": "2023-06-12T16:37:32.647Z",
"note": null,
"identities": [
{
"provider": "Basic",
"id": "abc+@contoso.com"
}
]
}
}
],
"count": 1
}

### Script or Debug output

```PowerShell
Actual output:

Body:
{
"value": [],
"count": 0
}
```

### Environment data

_No response_

### Module versions

_No response_

### Error output

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the Get-AzApiManagementUser cmdlet and reproduce the email filter behavior with an address containing '+'. Compare the request with the User - List By Service REST endpoint, then verify that the cmdlet returns the matching user without requiring callers to pre-encode the email.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, powershell
Domain
api, backend-api-design, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.