Azure AI Projects TS
MicrosoftOfficialCreated by Microsoft
- Skill
- Tool integration
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The Azure AI Projects SDK for TypeScript provides a high-level interface for interacting with Azure AI Foundry projects. It enables developers to manage AI agents, model deployments, connections to Azure resources, datasets, search indexes, and evaluation metrics. The SDK simplifies the integration of various AI tools, including code interpreters, file search, and custom function calling, while providing access to OpenAI clients for conversational workflows.
What it does
- Create and manage AI agents with custom instructions and tools
- List and retrieve connections to Azure resources like OpenAI and AI Search
- Upload and manage datasets for AI model training or evaluation
- Configure and manage search indexes for RAG applications
- Execute and monitor evaluations to assess model output quality
- Access OpenAI clients for generating responses and managing conversations
When to use it
- When building AI applications within the Azure AI Foundry ecosystem
- When you need to programmatically manage agent lifecycles and versions
- When integrating Azure AI Search or other data sources into AI workflows
- When performing automated quality assessments on model outputs
- When managing connections to Azure services securely within your application
Advantages
- Unified interface for diverse AI project components
- Supports complex agent tools like code interpreters and web search
- Provides built-in support for evaluation metrics like groundedness and relevance
- Simplifies authentication using standard Azure identity credentials
- Enables programmatic management of datasets and model deployments
Usage examples
- “How do I create an AI agent with a code interpreter tool using the SDK?”
- The agent is created using client.agents.createVersion with the 'code_interpreter' tool type and 'auto' container configuration.
- “How can I list all available model deployments in my project?”
- You iterate through client.deployments.list() and filter by type or publisher to identify specific model deployments.
- “How do I run a groundedness evaluation on my RAG application?”
- You use client.evaluations.create with your dataset and specify 'groundedness' as a builtin evaluator to receive metrics.
- “How do I get an OpenAI client from my project connection?”
- You call await client.getOpenAIClient() to retrieve an instance configured for your project's resources.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/microsoft/azure-ai-projects-ts/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip azure-ai-projects-ts.zip -d .agents/skills
Documentation by Microsoft
Azure AI Projects SDK for TypeScript
High-level SDK for Azure AI Foundry projects with agents, connections, deployments, and evaluations.
Installation
npm install @azure/ai-projects @azure/identityFor tracing:
npm install @azure/monitor-opentelemetry @opentelemetry/apiEnvironment Variables
AZURE_AI_PROJECT_ENDPOINT=https://<resource>.services.ai.azure.com/api/projects/<project>
MODEL_DEPLOYMENT_NAME=gpt-4o
AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in productionAuthentication
import { AIProjectClient } from "@azure/ai-projects";
import { DefaultAzureCredential, ManagedIdentityCredential } from "@azure/identity";
// Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=<specific_credential>
const credential = new DefaultAzureCredential({requiredEnvVars: ["AZURE_TOKEN_CREDENTIALS"]});
// Or use a specific credential directly in production:
// See https://learn.microsoft.com/javascript/api/overview/azure/identity-readme?view=azure-node-latest#credential-classes
// const credential = new ManagedIdentityCredential();
const client = new AIProjectClient(
process.env.AZURE_AI_PROJECT_ENDPOINT!,
credential
);Operation Groups
| Group | Purpose |
|---|---|
client.agents | Create and manage AI agents |
client.connections | List connected Azure resources |
client.deployments | List model deployments |
client.datasets | Upload and manage datasets |
client.indexes | Create and manage search indexes |
client.evaluators | Manage evaluation metrics |
client.memoryStores | Manage agent memory |
Getting OpenAI Client
const openAIClient = await client.getOpenAIClient();
// Use for responses
const response = await openAIClient.responses.create({
model: "gpt-4o",
input: "What is the capital of France?"
});
// Use for conversations
const conversation = await openAIClient.conversations.create({
items: [{ type: "message", role: "user", content: "Hello!" }]
});Agents
Create Agent
const agent = await client.agents.createVersion("my-agent", {
kind: "prompt",
model: "gpt-4o",
instructions: "You are a helpful assistant."
});Agent with Tools
// Code Interpreter
const agent = await client.agents.createVersion("code-agent", {
kind: "prompt",
model: "gpt-4o",
instructions: "You can execute code.",
tools: [{ type: "code_interpreter", container: { type: "auto" } }]
});
// File Search
const agent = await client.agents.createVersion("search-agent", {
kind: "prompt",
model: "gpt-4o",
tools: [{ type: "file_search", vector_store_ids: [vectorStoreId] }]
});
// Web Search
const agent = await client.agents.createVersion("web-agent", {
kind: "prompt",
model: "gpt-4o",
tools: [{
type: "web_search_preview",
user_location: { type: "approximate", country: "US", city: "Seattle" }
}]
});
// Azure AI Search
const agent = await client.agents.createVersion("aisearch-agent", {
kind: "prompt",
model: "gpt-4o",
tools: [{
type: "azure_ai_search",
azure_ai_search: {
indexes: [{
project_connection_id: connectionId,
index_name: "my-index",
query_type: "simple"
}]
}
}]
});
// Function Tool
const agent = await client.agents.createVersion("func-agent", {
kind: "prompt",
model: "gpt-4o",
tools: [{
type: "function",
function: {
name: "get_weather",
description: "Get weather for a location",
strict: true,
parameters: {
type: "object",
properties: { location: { type: "string" } },
required: ["location"]
}
}
}]
});
// MCP Tool
const agent = await client.agents.createVersion("mcp-agent", {
kind: "prompt",
model: "gpt-4o",
tools: [{
type: "mcp",
server_label: "my-mcp",
server_url: "https://mcp-server.example.com",
require_approval: "always"
}]
});Run Agent
const openAIClient = await client.getOpenAIClient();
// Create conversation
const conversation = await openAIClient.conversations.create({
items: [{ type: "message", role: "user", content: "Hello!" }]
});
// Generate response using agent
const response = await openAIClient.responses.create(
{ conversation: conversation.id },
{ body: { agent: { name: agent.name, type: "agent_reference" } } }
);
// Cleanup
await openAIClient.conversations.delete(conversation.id);
await client.agents.deleteVersion(agent.name, agent.version);Connections
// List all connections
for await (const conn of client.connections.list()) {
console.log(conn.name, conn.type);
}
// Get connection by name
const conn = await client.connections.get("my-connection");
// Get connection with credentials
const connWithCreds = await client.connections.getWithCredentials("my-connection");
// Get default connection by type
const defaultAzureOpenAI = await client.connections.getDefault("AzureOpenAI", true);Deployments
// List all deployments
for await (const deployment of client.deployments.list()) {
if (deployment.type === "ModelDeployment") {
console.log(deployment.name, deployment.modelName);
}
}
// Filter by publisher
for await (const d of client.deployments.list({ modelPublisher: "OpenAI" })) {
console.log(d.name);
}
// Get specific deployment
const deployment = await client.deployments.get("gpt-4o");Datasets
// Upload single file
const dataset = await client.datasets.uploadFile(
"my-dataset",
"1.0",
"./data/training.jsonl"
);
// Upload folder
const dataset = await client.datasets.uploadFolder(
"my-dataset",
"2.0",
"./data/documents/"
);
// Get dataset
const ds = await client.datasets.get("my-dataset", "1.0");
// List versions
for await (const version of client.datasets.listVersions("my-dataset")) {
console.log(version);
}
// Delete
await client.datasets.delete("my-dataset", "1.0");Indexes
import { AzureAISearchIndex } from "@azure/ai-projects";
const indexConfig: AzureAISearchIndex = {
name: "my-index",
type: "AzureSearch",
version: "1",
indexName: "my-index",
connectionName: "search-connection"
};
// Create index
const index = await client.indexes.createOrUpdate("my-index", "1", indexConfig);
// List indexes
for await (const idx of client.indexes.list()) {
console.log(idx.name);
}
// Delete
await client.indexes.delete("my-index", "1");Key Types
import {
AIProjectClient,
AIProjectClientOptionalParams,
Connection,
ModelDeployment,
DatasetVersionUnion,
AzureAISearchIndex
} from "@azure/ai-projects";Best Practices
Use getOpenAIClient() - For responses, conversations, files, and vector stores
Version your agents - Use
createVersionfor reproducible agent definitionsClean up resources - Delete agents, conversations when done
Use connections - Get credentials from project connections, don't hardcode
Filter deployments - Use
modelPublisherfilter to find specific models
Files
- ATTRIBUTION.mdAdded by AutoGineer979 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md7.4 KiB
- references/connections.md5.5 KiB
- references/evaluations.md8.3 KiB
references/connections.md
Connections Reference
Working with Azure AI Foundry project connections to access linked Azure resources.
Overview
Connections represent linked Azure resources (Azure OpenAI, AI Search, Storage, etc.) configured in your Foundry project. The SDK provides methods to list, retrieve, and access credentials for these connections.
Connection Types
| Type | Description | Use Case |
|---|---|---|
AzureOpenAI | Azure OpenAI Service | Chat completions, embeddings |
AzureAISearch | Azure AI Search | Vector search, RAG |
AzureBlob | Blob Storage | File storage for agents |
AzureAIServices | Cognitive Services | Speech, Vision, etc. |
Custom | Custom connections | External APIs |
List Connections
import { AIProjectClient } from "@azure/ai-projects";
import { DefaultAzureCredential } from "@azure/identity";
const client = new AIProjectClient(
process.env.AZURE_AI_PROJECT_ENDPOINT!,
new DefaultAzureCredential()
);
// List all connections
for await (const connection of client.connections.list()) {
console.log(`Name: ${connection.name}`);
console.log(`Type: ${connection.type}`);
console.log(`---`);
}
// Filter by category
for await (const conn of client.connections.list({
category: "AzureOpenAI"
})) {
console.log(`OpenAI Connection: ${conn.name}`);
}Get Connection by Name
// Get connection metadata (no credentials)
const connection = await client.connections.get("my-openai-connection");
console.log(`Endpoint: ${connection.target}`);
console.log(`Type: ${connection.type}`);
// Get connection with credentials
const connWithCreds = await client.connections.getWithCredentials(
"my-openai-connection"
);
// Access credentials based on auth type
if (connWithCreds.credentials.type === "ApiKey") {
console.log(`API Key: ${connWithCreds.credentials.key}`);
} else if (connWithCreds.credentials.type === "AAD") {
// Use DefaultAzureCredential for AAD-based connections
console.log("Uses Entra ID authentication");
}Get Default Connection
// Get default connection of a specific type
const defaultOpenAI = await client.connections.getDefault(
"AzureOpenAI",
true // withCredentials
);
const defaultSearch = await client.connections.getDefault(
"AzureAISearch",
true
);
// Use the connection endpoint
console.log(`OpenAI Endpoint: ${defaultOpenAI.target}`);
console.log(`Search Endpoint: ${defaultSearch.target}`);Connection Interface
interface Connection {
/** Connection name */
name: string;
/** Connection type (e.g., "AzureOpenAI", "AzureAISearch") */
type: string;
/** Target endpoint URL */
target: string;
/** Authentication type */
authType: "ApiKey" | "AAD" | "SAS" | "CustomKeys";
/** Additional metadata */
metadata?: Record<string, string>;
}
interface ConnectionWithCredentials extends Connection {
credentials: ApiKeyCredentials | AADCredentials | SASCredentials;
}
interface ApiKeyCredentials {
type: "ApiKey";
key: string;
}
interface AADCredentials {
type: "AAD";
// Use DefaultAzureCredential to get tokens
}Using Connections with Agents
// Get Search connection for agent tool
const searchConn = await client.connections.getWithCredentials("my-search");
// Create agent with Azure AI Search tool
const agent = await client.agents.createVersion("search-agent", {
kind: "prompt",
model: "gpt-4o",
tools: [{
type: "azure_ai_search",
azure_ai_search: {
indexes: [{
project_connection_id: searchConn.name,
index_name: "my-index",
query_type: "vector_semantic_hybrid"
}]
}
}]
});Using Connections for Direct SDK Access
// Get Azure OpenAI connection
const openAIConn = await client.connections.getWithCredentials("my-openai");
// Create Azure OpenAI client directly
import { AzureOpenAI } from "openai";
const openAIClient = new AzureOpenAI({
endpoint: openAIConn.target,
apiKey: openAIConn.credentials.type === "ApiKey"
? openAIConn.credentials.key
: undefined,
// Or use credential for AAD
azureADTokenProvider: openAIConn.credentials.type === "AAD"
? () => getAccessToken()
: undefined,
});
// Get AI Search connection
const searchConn = await client.connections.getWithCredentials("my-search");
// Create Search client directly
import { SearchClient, AzureKeyCredential } from "@azure/search-documents";
const searchClient = new SearchClient(
searchConn.target,
"my-index",
new AzureKeyCredential(searchConn.credentials.key)
);Error Handling
import { RestError } from "@azure/core-rest-pipeline";
try {
const conn = await client.connections.get("non-existent");
} catch (error) {
if (error instanceof RestError) {
if (error.statusCode === 404) {
console.log("Connection not found");
} else if (error.statusCode === 403) {
console.log("Not authorized to access connection");
}
}
throw error;
}Best Practices
Use
getDefault()for standard resources — Avoids hardcoding connection namesCache connections — Connection metadata rarely changes; cache to reduce API calls
Use AAD when possible — Prefer
AADauth overApiKeyfor better securityNever log credentials — Avoid logging
getWithCredentials()responsesValidate connection type — Check
typebefore casting credentials
See Also
Agents with Tools
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Microsoft
- Publisher
- Microsoft (Official)
- Source
- microsoft/skills · .github/plugins/azure-sdk-typescript/skills/azure-ai-projects-ts · commit 0696600
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Microsoft or Microsoft.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download azure-ai-projects-ts.zip