Skip to content

Failed to retrieve JWT Bearer Token using the az command. #83

@Menghua1

Description

@Menghua1

Describe:
Following the "Get Your JWT Bearer Token" steps in the README and executing the following commands to obtain the JWT Bearer Token failed:

  • az account get-access-token --resource YOUR-ENTRA-APP-CLIENT-ID --query accessToken -o tsv
  • az account get-access-token --resource "api://YOUR-ENTRA-APP-CLIENT-ID" --query accessToken -o tsv
Image Image In the Azure Portal's App Registration → Expose an API page, only the Application ID URI was set, but the following crucial configurations were missing:
  1. Add a scope
  2. Authorized client applications: A client application (e.g., Microsoft Azure CLI) needs to be added and authorized with the corresponding scope.
Image

After completing "Add a scope" and "Authorized client applications," obtaining the token using az succeeded.

Repro Steps:

  1. Run git clone https://github.com/AzureCosmosDB/MCPToolKit.git and cd MCPToolKit.
  2. Deploy Infrastructure via Azure Developer CLI (azd up).
  3. Run .\scripts\Deploy-Cosmos-MCP-Toolkit.ps1 -ResourceGroup "YOUR-RESOURCE-GROUP" -EntraAppName "My Custom MCP App".
  4. Run az account get-access-token --resource YOUR-ENTRA-APP-CLIENT-ID --query accessToken -o tsv and az account get-access-token --resource "api://YOUR-ENTRA-APP-CLIENT-ID" --query accessToken -o tsv.

Environment:

  • OS: Windows

Expected behavior:
The JWT Bearer Token was successfully retrieved via the az command.

@sajeetharan and @hemarina for notification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions