Skip to content

Azure CLI command parsing bugs (MacOS) #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dosentmatter opened this issue Apr 27, 2025 · 1 comment · May be fixed by #122
Open

Azure CLI command parsing bugs (MacOS) #54

dosentmatter opened this issue Apr 27, 2025 · 1 comment · May be fixed by #122
Assignees
Labels
area-AzCLI Azure CLI related bug Something isn't working
Milestone

Comments

@dosentmatter
Copy link

dosentmatter commented Apr 27, 2025

macOS 15.4

zsh 5.9

@azure/mcp@0.0.10

https://github.com/Azure/azure-mcp/blob/main/docs/azmcp-commands.md#azure-cli-extension-operations

CLI issues:


fails:

% azmcp extension az --command 'group list'
Unrecognized command or argument 'list'.

works:
Seems to require manual escaping

% azmcp extension az --command 'group\ list'
{
  "status": 200,
  "message": "Success",
  ... 
}

fails:

% azmcp extension az --command 'ad user list --filter "startswith(displayName,'"'John'"')"'
Unrecognized command or argument 'user'.
Unrecognized command or argument 'list'.
Unrecognized command or argument '--filter'.
Unrecognized command or argument 'startswith(displayName,'John')'.

works:
Again, manual escaping

% azmcp extension az --command 'ad\ user\ list\ --filter\ "startswith(displayName,'"'John'"')"'
{
  "status": 200,
  "message": "Success",
  ...
}

fails:

% azmcp extension az --command 'ad\ user\ list\ --filter\ "startswith(displayName,'"'John Doe'"')"'
{
  "status": 500,
  "message": "ERROR: unrecognized arguments: Doe')\n\nExamples from AI knowledge base:\naz ad user list\nList Azure Active Directory users. (autogenerated)\n\naz ad user list --upn {upn}\nList Azure Active Directory users. (autogenerated)\n\nhttps://docs.microsoft.com/en-US/cli/azure/ad/user#az_ad_user_list\nRead more about the command in reference docs",
  ...
}

fails:
Haven't figured out the way the escape this command for azmcp to not fail yet.

% azmcp extension az --command 'ad\ user\ list\ --filter\ "startswith(displayName,'"'John\ Doe'"')"'
{
  "status": 500,
  "message": "ERROR: unrecognized arguments: Doe')\n\nExamples from AI knowledge base:\naz ad user list\nList Azure Active Directory users. (autogenerated)\n\naz ad user list --upn {upn}\nList Azure Active Directory users. (autogenerated)\n\nhttps://docs.microsoft.com/en-US/cli/azure/ad/user#az_ad_user_list\nRead more about the command in reference docs",
  ...
}

VS Code Copilot

works:
Image

{
  "command": "group list",
  "auth-method": "credential"
}

[{...},{...},{...}]

fails:
Image

Doesn't get the argument passed to --filter. Retry continues to fail.

{
  "command": "ad user list --filter \"startswith(displayName,'John Doe')\"",
  "auth-method": "credential"
}

{
  "ExitCode": 2,
  "Error": "ERROR: argument --filter: expected one argument\n\nExamples from AI knowledge base:\naz ad user list\nList Azure Active Directory users. (autogenerated)\n\naz ad user list --upn {upn}\nList Azure Active Directory users. (autogenerated)\n\nhttps://docs.microsoft.com/en-US/cli/azure/ad/user#az_ad_user_list\nRead more about the command in reference docs",
  "Command": "/opt/homebrew/bin/az ad user list --filter "
}

Formatted error:

ERROR: argument --filter: expected one argument

Examples from AI knowledge base:
az ad user list
List Azure Active Directory users. (autogenerated)

az ad user list --upn {upn}
List Azure Active Directory users. (autogenerated)

https://docs.microsoft.com/en-US/cli/azure/ad/user#az_ad_user_list
Read more about the command in reference docs
@joshfree joshfree added the bug Something isn't working label Apr 28, 2025
@joshfree joshfree moved this from Untriaged to Not Started in Azure MCP Server Apr 28, 2025
@joshfree joshfree added this to the 2025-05 milestone Apr 28, 2025
@joshfree
Copy link
Member

Thanks for reporting this, @dosentmatter. @xiangyan99 can you look at this as part of your refactoring of azcli mcp tooling?

@joshfree joshfree changed the title Azure CLI command parsing Azure CLI command parsing bugs Apr 28, 2025
@joshfree joshfree added the area-AzCLI Azure CLI related label Apr 28, 2025
@joshfree joshfree assigned conniey and unassigned xiangyan99 Apr 30, 2025
@joshfree joshfree changed the title Azure CLI command parsing bugs Azure CLI command parsing bugs (MacOS) May 6, 2025
@hallipr hallipr linked a pull request May 6, 2025 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-AzCLI Azure CLI related bug Something isn't working
Projects
Status: Not Started
Development

Successfully merging a pull request may close this issue.

5 participants