How to create embeddings client from Azure AI Foundry project's connected embedding model via Python Azure SDK

Paris Perlegkas 80 Reputation points
2025-05-28T19:55:49.3033333+00:00

I am normally connecting to my Azure AI Foundry project in which I have deployed and connected an embedding model (pls check below python script attached image). When I am trying to create a vector embeddings client with project.inference.get_embeddings_client()via python Azure SDK, I get error "No connection of type ConnectionType.AZURE_AI_SERVICES found", and as a result no embedding is found, hence no document search can be performed later on - I am building a RAG application.

What am I missing? I don't see any ConnectionType.AZURE_AI_SERVICES in documentation https://learn.microsoft.com/en-us/python/api/azure-ai-projects/azure.ai.projects.models.connectiontype?view=azure-python-preview.

Any help would be highly appreciated. Thanks in advance.

self.project = AIProjectClient.from_connection_string(
conn_str=os.environ["AIPROJECT_CONNECTION_STRING"], 
credential=DefaultAzureCredential()
)

            # Create a project client using environment variables
            self.logger.info(f"Initializing AI Project client with connection string")
            self.project = AIProjectClient.from_connection_string(
                conn_str=os.environ["AIPROJECT_CONNECTION_STRING"], 
                credential=DefaultAzureCredential()
            )

            # Try to create vector embeddings client
            try:
                self.embeddings = self.project.inference.get_embeddings_client()
            except ResourceNotFoundError as e:
                self.logger.warning(f"ResourceNotFoundError: No embeddings service found in project: {str(e)}")

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.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ravada Shivaprasad 1,965 Reputation points Microsoft External Staff Moderator
    2025-05-28T21:09:40.1733333+00:00

    Hi Paris Perlegkas

    The error appears to stem from a missing or misconfigured connection to Azure AI Services within your Azure AI Foundry project. The system does not recognize ConnectionType.AZURE_AI_SERVICES, which suggests that this connection type may not be available in the Azure AI Projects SDK.

    To resolve this, first, review the available connection types in the Azure AI Projects SDK documentation to confirm whether an alternative type, such as ConnectionType.AI_SERVICES, should be used. Additionally, verify that your connection string stored in the environment variable AIPROJECT_CONNECTION_STRING is correctly set and pointing to the appropriate Azure AI Foundry project.

    If the issue still persists, ensure that your project has an active connection to Azure AI Services by navigating to Management Center → Connections → New Connection in the Azure AI Foundry Portal. Proper error handling is also crucial—your ResourceNotFoundError exception should provide more insights into why the embeddings service is not found.

    Lastly, check for any SDK updates or changes that might have impacted connection types or embedding client creation.

    I Hope this helps. Let me know if you need further clarification!


    If this answers your query, please do click Accept Answer and Yes for was this answer helpful.

    Thank you!


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.