The Azure AI extension provides prompt flow visual editing, local testing, model catalog browsing, and inline evaluation. Install the “Azure AI” extension pack from the VS Code Marketplace.
Copilot assists with Azure AI SDK calls, prompt template authoring, evaluation dataset generation, and Bicep/Terraform scaffolding.
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
ml_client = MLClient(
DefaultAzureCredential(),
subscription_id="<sub-id>",
resource_group_name="<rg>",
workspace_name="<project>",
)
for model in ml_client.models.list():
print(f"{model.name} v{model.version}")
# List AI Foundry projects
az ml workspace list --resource-group rg-ai --query "[?kind=='Project']"
# Deploy a model to an endpoint
az ml online-deployment create --file deployment.yml \
--resource-group rg-ai --workspace-name my-project
# Invoke an endpoint
az ml online-endpoint invoke --name genai-endpoint \
--request-file request.json --resource-group rg-ai --workspace-name my-project
# Check endpoint logs
az ml online-deployment get-logs --name blue --endpoint-name genai-endpoint \
--resource-group rg-ai --workspace-name my-project
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
project = AIProjectClient(
credential=DefaultAzureCredential(),
endpoint="https://<hub>.api.azureml.ms",
project_name="my-project",
)
# Chat completion
response = project.inference.get_chat_completions_client().complete(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in 3 sentences."},
],
)
print(response.choices[0].message.content)
# Embeddings
embeddings_client = project.inference.get_embeddings_client()
result = embeddings_client.embed(
model="text-embedding-ada-002",
input=["Azure AI Foundry is a platform for building AI apps."],
)
print(f"Embedding dimension: {len(result.data[0].embedding)}")
curl -X POST "https://<endpoint>.inference.ml.azure.com/score" \
-H "Authorization: Bearer $(az account get-access-token --query accessToken -o tsv)" \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Hello!"}], "max_tokens": 100}'
Tip: AI Foundry endpoints are OpenAI-compatible. Use the
openaiPython package by pointingbase_urlto your Azure endpoint - no code changes needed.
| Task | Best Tool |
|——|———–|
| Interactive exploration | VS Code / Notebooks |
| Automation & CI/CD | Azure CLI (az ml) |
| Application code | AI Foundry SDK for Python |
| Quick testing | REST API / curl |
| Infrastructure | Bicep / Terraform |