Share via

Message: The provided subscription identifier 'subscription=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' is malformed or invalid.

Kwasi Kodie 40 Reputation points
2026-03-28T21:25:46.8+00:00

I am passing the subscription value through a connection string (endpoint, subscription, resourceGroup, projectName). However, despite using what appears to be the correct subscription ID (a valid GUID copied from the Azure Portal), the SDK continues to reject it as malformed.

I have ensured that:

  • The subscription value contains only the GUID (no prefixes like “subscriptionId=”)
  • There are no visible formatting issues in the connection string
  • The value is sourced directly from the Azure Portal

It seems the SDK may be incorrectly parsing the connection string or expecting a slightly different format for the subscription field.

Has anyone encountered a similar issue or can confirm the exact expected format for the connection string when using Azure AI Foundry SDK?

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

Answer accepted by question author
  1. Marcin Policht 85,255 Reputation points MVP Volunteer Moderator
    2026-03-28T21:43:27.66+00:00

    Try using the following instead:

    https://<resource-name>.services.ai.azure.com/api/projects/<project-name>
    

    You no longer pass subscription ID, resource group, or project name separately. The SDK infers all context from the endpoint URL itself. For more info, refer to https://dori-uw-1.kuma-moon.com/en-us/python/api/overview/azure/ai-projects-readme?view=azure-python


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    2 people found this answer helpful.

Answer accepted by question author
  1. Divyesh Govaerdhanan 10,850 Reputation points Volunteer Moderator
    2026-03-28T21:48:32.54+00:00

    Hello Kwasi Kodie,

    Welcome to Microsoft Q&A,

    The connection string format you are using (endpoint;subscription=...;resourceGroup=...;projectName=...) is the legacy format from the older AIProjectClient.from_connection_string() method. The from_connection_string factory method has been removed in the newer Azure AI Agents SDK, and the Azure AI Foundry Project endpoint is now required to construct the AIProjectClient. If you are passing the connection string as a semicolon-separated string and the SDK is trying to parse out the subscription field, it may be extracting subscription=<GUID> literally instead of just the <GUID> value, causing the malformed identifier error.

    The current AIProjectClient constructor takes a direct endpoint URL in the format https://<resource-name>.services.ai.azure.com/api/projects/<project-name> , not a connection string with individual components.

    Please Upvote and accept the answer if it helps!!


0 additional answers

Sort by: Most helpful

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.