Unable to Get-AzApiManagementUser

Yuki Kang 40 Reputation points
2023-06-12T08:52:57.31+00:00

When the email prefix contains a '+', no result will return:

$apimUser = Get-AzApiManagementUser -Context $apimContext -Email $emailAddress

When I try to get the same user with last name + first name, the result returns successfully:

$apimUser = Get-AzApiManagementUser -Context $apimContext -LastName -FirstName

Why I failed to Get-AzApiManagementUser with the email address contains '+'?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,434 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,975 questions
0 comments No comments
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,431 Reputation points Moderator
    2023-06-12T17:07:02.27+00:00

    Yuki Kang Thanks for posting your question in Microsoft Q&A. I tried this in my APIM instance and found that Get-AzApiManagementUser (with -Debug) makes User - List By Service Rest API call by passing the parameters in filter attribute such as $filter=email eq '******@contoso.com'. However, I suspect this is not encoded correctly in CLI whereas it works correctly when tested directly in User - List By Service Rest API call.

    So, I encoded the value like $encodedEmail=[System.Web.HttpUtility]::UrlEncode("******@contoso.com") and called Get-AzApiManagementUser -Context $apimContext -Email $encodedEmail and it provided the results.

    I opened an issue #22050 in GitHub for the product team to review further. I suggest you tracking the item on the issue. I hope this helps and let me know if you have any questions.


    If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.