Microsoft Azure AI Engineer Associate AI-102 Practice Question

You are developing an Azure Function written in Python that must send chat completion requests to a GPT-4 deployment named "chat-gpt4" in the Azure OpenAI resource "lit-openai". The security team prohibits storing service access keys in your source code, configuration files, or environment variables. You decide to use the system-assigned managed identity of the function for authentication. Which approach should you implement to meet the requirements?

  • Retrieve the Azure OpenAI resource key from Azure Key Vault at startup and expose it as the OPENAI_API_KEY environment variable.

  • Instantiate azure.ai.openai.OpenAIClient with DefaultAzureCredential, and assign the function's managed identity the Cognitive Services OpenAI User role on "lit-openai".

  • Use the openai Python package and set openai.api_key to the managed identity's client ID while pointing openai.api_base to the Azure endpoint.

  • Add the managed identity to the Reader role on the resource group and create OpenAIClient with AzureKeyCredential initialized to an empty string.

Microsoft Azure AI Engineer Associate AI-102
Implement generative AI solutions
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot