Connecting to Azure OpenAI Model Deployment in Python
DRAG DROP
You have a Microsoft Foundry project named project1 that contains an Azure OpenAI resource named Resource1.
To Resource1, you deploy a gpt-4.1-mini model by using a model deployment named my-mini-gpt.
You need to connect to my-mini-gpt from an application.
How should you complete the Python code? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all.
NOTE: Each correct selection is worth one point.

Community Insight
The key distinction is between the underlying model name (gpt-4.1-mini) and the specific deployment alias (my-mini-gpt), which must be used in the code.
Learn how to correctly configure the Azure OpenAI client in Python by mapping the deployment name and endpoint URL to connect to a specific model instance.
Learners often confuse the model family name with the deployment name, using 'gpt-4.1-mini' instead of 'my-mini-gpt' in the deployment parameter.
Community Discussion (2 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
To connect to an Azure OpenAI resource via Python, you must use theAzureOpenAI client class. The critical parameters are the endpoint URL and the deployment name. The endpoint URL points to the specific Azure resource (Resource1) hosting the models. The deployment name refers to the unique identifier assigned to the specific model instance within that resource (my-mini-gpt). Using the correct deployment name ensures the API routes requests to the exact model version and configuration you deployed.Why Other Candidate Answers Are Wrong
Using the raw model name 'gpt-4.1-mini' as the deployment parameter is incorrect because Azure OpenAI requires the specific deployment alias defined during provisioning. Similarly, pointing the endpoint to a generic region or another resource would fail authentication or routing. Confusing the project name (project1) with the endpoint is also a common error; the endpoint is a URL derived from the resource name, not the Foundry project container.Community Comment Notes
As user acloudnerd noted, the project organizes resources but the connection relies on the resource's endpoint. Another commenter emphasized that 'you do not use model name directly,' reinforcing that the deployment alias 'my-mini-gpt' is the required value for the client initialization.Exam Strategy
Always distinguish between the 'Model ID' (the base model type) and the 'Deployment Name' (the unique alias). In exam questions involving SDKs, look for the deployment name when initializing the client or making inference calls.
Frequently Asked Questions
What is the difference between model name and deployment name?
The model name (e.g., gpt-4.1-mini) is the base architecture. The deployment name (e.g., my-mini-gpt) is the unique alias you assign to that model instance in your specific Azure resource.
How do I find the endpoint URL for Azure OpenAI?
The endpoint URL is found in the Azure Portal under the Azure OpenAI resource properties. It typically follows the format https://<resource-name>.openai.azure.com/
Related Analysis
Practice All AI-901 Questions
Access 105 questions with complete answers and detailed explanations.
View Full AI-901 Practice Test →