Agent API access

Lisa MM 0 Reputation points
2025-05-25T12:57:22.9566667+00:00

“I’m using Azure AI Foundry and my agent works in Playground, but API access with the project key is returning 401 Unauthorized. Please confirm whether external access to the Foundry project API is enabled for my subscription.”

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform

0 comments No comments

3 answers

Sort by: Oldest
  1. Azar 31,280 Reputation points MVP Volunteer Moderator
    2025-05-28T19:58:17.39+00:00

    Hi there Lisa MM

    Thanks for using QandA platform

    If your agent works in Playground but API access via project key returns a 401 Unauthorized, it’s possible that external API access for your Foundry project is not enabled by default.

    We cant check it for you please check if your Azure subscription and Foundry project settings permit external API access. Also, verify that the project key is correct, the API endpoint is Correct

    If this helps kindly accept the answer thanks much.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Anonymous
    2025-05-28T21:21:55.84+00:00

    Hi Lisa MM

    If you're encountering a 401 Unauthorized error in Azure AI Foundry, follow these steps:

    • Check API Access Settings: Go to Azure Portal → AI Foundry Project → Networking and confirm external access settings.
    • Verify API Key & Headers: Ensure the request includes -H "api-key: " instead of Authorization.
    • Confirm Subscription & Permissions: Check that your subscription is active and has the correct RBAC roles.
    • Review API Documentation: Refer to Azure AI Foundry API Access Guide for authentication details.
    • Test & Debug: Try an API call in Playground, validate headers, and check endpoint correctness.

    I Hope this helps. Do let me know if you have any further queries. If this answers your query, please do click Accept Answer and Yes for was this answer helpful.

    Thank you!

    Was this answer helpful?

    1 person found this answer helpful.

  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

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