How can I resolve the issue where the connection string is unable to find the model deployed on Azure AI Foundry in .NET 8 C# Quickstart: Create a new Agent?

Deepankar 120 Reputation points
2025-05-01T20:03:28.28+00:00

I am following the QuickStart guide (https://learn.microsoft.com/en-us/azure/ai-services/agents/quickstart?pivots=programming-language-csharp) for C# in .NET 8.0 to create a new agent on Azure AI Foundry. The model is successfully deployed, and the connection string is correct. While other codes run without issues, the provided code in the guide fails to connect to the model during debugging. Could someone help identify the problem with the code? If there are any necessary modifications to the packages, please advise.

Could someone please try running the C# guide on their end and confirm if they are able to execute the same code successfully? My teammates and I are encountering the same issue, and there are no firewall restrictions.User's image

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,396 questions
{count} votes

Accepted answer
  1. kothapally Snigdha 2,420 Reputation points Microsoft External Staff
    2025-05-02T09:58:33.8633333+00:00

    Hi @Deepankar

    To resolve the issue where the connection string is unable to locate the model deployed on Azure AI Foundry in .NET 8 C# Quick start, it's crucial to ensure that the code is correctly configured to connect to the deployed model. Begin by verifying that the connection string in your code matches the one provided in the Azure AI Foundry portal, ensuring it includes the correct server address, database name, username, and password. Next, review the code logic to confirm that the connection string is being utilized correctly, ensuring proper opening and closing of connections. Additionally, check that all required packages and dependencies are correctly installed in your project, particularly those specified in the C# Quick start guide for Azure AI Foundry. Debugging tools can be used to step through the code and identify the point of failure, reviewing any exceptions or error messages for further insights. Also, confirm that your testing environment is properly set up and that there are no network or firewall restrictions preventing the connection to the model. If issues persist after these checks, further code review and consultation of Azure AI Foundry documentation or community forums may be required. Comparing your implementation with the Quick start guide might help identify discrepancies, and running the code in a different environment can verify if the problem is environment.

    Refer the link https://learn.microsoft.com/en-us/dotnet/api/overview/azure/ai.projects-readme?view=azure-dotnet-preview

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    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.