CLI & PowerShell Commands
AI-103 tasks with the Azure CLI and PowerShell side by side for each domain, copied from the topic pages.
Every command here comes from a CLI or PowerShell table on one of the AI-103 topic pages. A - means the topic page gives no command for that tool. Placeholders such as <rg> are yours to fill in.
Plan and manage an Azure AI solution (25–30%)
Foundry Setup & Deployments
| Task | Azure CLI | PowerShell |
|---|
| Create the Foundry resource | az cognitiveservices account create --name my-foundry-resource --resource-group my-foundry-rg --kind AIServices --sku S0 --location eastus --custom-domain my-foundry-resource --assign-identity --allow-project-management true | - |
| Create a project | az cognitiveservices account project create --name my-foundry-resource --resource-group my-foundry-rg --project-name my-foundry-project --location eastus | - |
| List models and SKUs available to the resource | az cognitiveservices account list-models -n $accountName -g $resourceGroupName | - |
| Create a model deployment | az cognitiveservices account deployment create -n $accountName -g $resourceGroupName --deployment-name Phi-4-mini-instruct --model-name Phi-4-mini-instruct --model-version 1 --model-format Microsoft --sku-capacity 1 --sku-name GlobalStandard | - |
| Check a deployment's state | az cognitiveservices account deployment show --deployment-name Phi-4-mini-instruct -n $accountName -g $resourceGroupName | - |
Quotas, Monitoring & Security
| Task | Azure CLI | PowerShell |
|---|
| Retry 429s with the Python client (SDK exponential backoff) | client = AzureOpenAI(
azure_endpoint="https://<your-resource>.openai.azure.com/",
api_key="<your-api-key>",
api_version="2024-10-21",
max_retries=5 # up to 5 retries with automatic exponential backoff
) | - |
| Disable local (key) authentication on a Foundry Tools resource | - | Set-AzCognitiveServicesAccount -ResourceGroupName "my-resource-group" -Name "my-resource-name" -DisableLocalAuth $true |
| Check whether local authentication is disabled (DisableLocalAuth property) | - | Get-AzCognitiveServicesAccount |
Responsible AI & Agent Governance
| Task | Azure CLI | PowerShell |
|---|
| Enable the dedicated table for sensitive trace content | az feature register --namespace Microsoft.Insights --name protectGenAISensitiveData | - |
| Install client-side tracing packages (Python) | pip install azure-ai-projects opentelemetry-sdk azure-core-tracing-opentelemetry | - |
Topic pages: Foundry Setup & Deployments, Quotas, Monitoring & Security, Responsible AI & Agent Governance.
Implement generative AI and agentic solutions (30–35%)
Generative Apps & RAG
| Task | Azure CLI | PowerShell |
|---|
| Install the Foundry SDK (Python) | pip install "azure-ai-projects>=2.3.0" "openai>=3.0.0" | - |
| Create the project client and the OpenAI-compatible client (Python) | project = AIProjectClient(
endpoint=project_endpoint,
credential=DefaultAzureCredential(),
)
openai = project.get_openai_client() | - |
| Call a model with the Responses API (Python) | response = openai.responses.create(
model="gpt-5-mini",
input="What is the size of France in square miles?",
) | - |
| Resolve a project connection (Python) | azs_connection = project.connections.get(SEARCH_CONNECTION_NAME) | - |
| Create a model deployment | az cognitiveservices account deployment create -n $accountName -g $resourceGroupName --deployment-name Phi-4-mini-instruct --model-name Phi-4-mini-instruct --model-version 1 --model-format Microsoft --sku-capacity 1 --sku-name GlobalStandard | - |
| Check a deployment is ready | az cognitiveservices account deployment show --name <resource-name> --resource-group <resource-group> --deployment-name gpt-5-mini --query properties.provisioningState --output tsv | - |
| Get a temporary token for the Foundry REST API | az account get-access-token --scope https://ai.azure.com/.default | - |
Building Agents
| Task | Azure CLI | PowerShell |
|---|
| Create a conversation for multi-turn use (Python) | conversation = openai.conversations.create() | - |
| Respond inside a conversation (Python) | response = openai.responses.create(
conversation=conversation.id,
input="What is the size of France in square miles?",
) | - |
| Follow up on a stored response (Python) | follow_up = openai.responses.create(
previous_response_id=response.id,
input="What is the population of that city?",
) | - |
| Create a prompt agent version (Python) | agent = project.agents.create_version(
agent_name="my-agent",
definition=PromptAgentDefinition(
model="gpt-5-mini",
instructions="You are a helpful assistant.",
),
) | - |
Prompting, Tuning & Observability
| Task | Azure CLI | PowerShell |
|---|
| Install client-side tracing packages (Python) | pip install azure-ai-projects opentelemetry-sdk azure-core-tracing-opentelemetry | - |
| Cap tokens and set reasoning effort (Python, chat completions) | max_completion_tokens=5000, reasoning_effort="medium" | - |
Topic pages: Generative Apps & RAG, Building Agents, Prompting, Tuning & Observability.
Implement computer vision solutions (10–15%)
Image & Video Generation
| Task | Azure CLI | PowerShell |
|---|
| Generate an image (Python, OpenAI client) | client.images.generate(model="gpt-image-1.5", prompt="A cute baby sea otter", n=1, size="1024x1024", stream=True, partial_images = 2) | - |
| Generate an image with the Responses API tool (Python) | response = client.responses.create(
model="MODEL_NAME",
input="Generate an image of a gray tabby cat hugging an otter with an orange scarf.",
tools=[{"type": "image_generation"}],
) | - |
| Create a Sora 2 video job (Python) | video = client.videos.create(
model="sora-2", # Replace with Sora 2 model deployment name
prompt="A video of a cool cat on a motorcycle in the night",
) | - |
| Poll a video job (Python) | client.videos.retrieve(video.id) | - |
| Download the finished video (Python) | client.videos.download_content(video_id, variant="video") | - |
| Remix a completed video (Python) | video = client.videos.remix(
video_id="<previous_video_id>",
prompt="Shift the color palette to teal, sand, and rust, with a warm backlight."
) | - |
Multimodal Understanding
| Task | Azure CLI | PowerShell |
|---|
| Send text and an image with the OpenAI Python client (Responses API) | response = client.responses.create(
model="MODEL_NAME",
input=[
{
"role": "user",
"content": [
{"type": "input_text", "text": "What is in this image?"},
{"type": "input_image", "image_url": "<image_url>"}
]
}
]
) | - |
| Set model deployment defaults for Content Understanding | PATCH /contentunderstanding/defaults?api-version=2025-11-01 | - |
| Analyze an image with the prebuilt image analyzer | curl -i -X POST "{endpoint}/contentunderstanding/analyzers/prebuilt-imageSearch:analyze?api-version=2025-11-01" | - |
Responsible AI for Visual Content
| Task | Azure CLI | PowerShell |
|---|
| Analyze an image (Python, azure-ai-contentsafety) | response = client.analyze_image(request) | - |
| Install the Content Safety Python library | python -m pip install azure-ai-contentsafety | - |
| Submit a provenance detection job (REST) | - | Invoke-WebRequest -Method POST "$endpoint/contentsafety/provenance:detect?api-version=$version" |
Topic pages: Image & Video Generation, Multimodal Understanding, Responsible AI for Visual Content.
Implement text analysis solutions (10–15%)
Text Analysis & Translation
| Task | Azure CLI | PowerShell |
|---|
| Install the Azure Language Python SDK | pip install azure-ai-textanalytics | - |
| Create the Language client | client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key)) | - |
| Detect the language of a text | result = client.detect_language([text])[0] | - |
| Redact PII in a text | result = client.recognize_pii_entities([text])[0] | - |
| Prompt a deployed model (Responses API) | message = client.responses.create(
model=deployment_name,
input="",
) | - |
| Structured output with Chat Completions | completion = client.beta.chat.completions.parse(
model="MODEL_DEPLOYMENT_NAME", # replace with the model deployment name of your gpt-4o 2024-08-06 deployment
messages=[
{"role": "system", "content": "Extract the event information."},
{"role": "user", "content": "Alice and Bob are going to a science fair on Friday."},
],
response_format=CalendarEvent,
) | - |
| Structured output with Responses | response = openai.responses.parse(
model="gpt-5-mini",
input="Extract the event information from: Alice and Bob are going to a science fair on Friday.",
text_format=CalendarEvent,
) | - |
Speech Solutions
| Task | Azure CLI | PowerShell |
|---|
| Install the Speech Python SDK | pip install azure-cognitiveservices-speech | - |
| Create a recognizer for the microphone | speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config) | - |
| Start real-time recognition | speech_recognizer.start_continuous_recognition() | - |
| Pick a synthesis voice | speech_config.speech_synthesis_voice_name='en-US-Ava:DragonHDLatestNeural' | - |
| Synthesize text to speech | speech_synthesizer.speak_text_async(text).get() | - |
| Install the Voice Live SDK | pip install azure-ai-voicelive | - |
| Batch transcription of many files | Transcription_Create | - |
Topic pages: Text Analysis & Translation, Speech Solutions.
Implement information extraction solutions (10–15%)
Retrieval & Grounding Pipelines
| Task | Azure CLI | PowerShell |
|---|
| Hybrid query with the Python SDK | client = SearchClient(endpoint=endpoint, index_name=index_name, credential=credential) | - |
| Build the vector part of a hybrid query (Python) | VectorizedQuery(vector=query_vector, k_nearest_neighbors=10, fields="DescriptionVector", exhaustive=True) | - |
| Run the hybrid search (Python) | results = client.search(
search_text="historic hotel walk to restaurants and shopping",
vector_queries=[vector_query],
select=["HotelName", "Description", "Address/City"],
top=10
) | - |
| Attach an Azure AI Search index to an agent (Python) | AzureAISearchTool(
azure_ai_search=AzureAISearchToolResource(
indexes=[
AISearchIndexResource(
project_connection_id=connection_id,
index_name=SEARCH_INDEX_NAME,
query_type=AzureAISearchQueryType.SIMPLE,
),
]
)
) | - |
Document Extraction
| Task | Azure CLI | PowerShell |
|---|
| Analyze a document with the Python SDK (long-running operation) | poller = client.begin_analyze(
analyzer_id="prebuilt-invoice",
inputs=[AnalysisInput(url=invoice_url)],
)
result: AnalysisResult = poller.result() | - |
| Install the Content Understanding Python SDK | python -m pip install azure-ai-contentunderstanding | - |
| Create a custom analyzer (REST) | curl -i -X PUT "{endpoint}/contentunderstanding/analyzers/{analyzerId}?api-version=2025-11-01" | - |
| Analyze with an analyzer (REST) | curl -i -X POST "{endpoint}/contentunderstanding/analyzers/{analyzerId}:analyze?api-version=2025-11-01" | - |
Topic pages: Retrieval & Grounding Pipelines, Document Extraction.
Pages with no command table
These topic pages have no CLI or PowerShell table, so nothing from them is repeated here: Choosing Models & Foundry Services.