azure-ai-projects-java — Claude Code skill: overview and setup
Equips your agent with Java SDK patterns for Azure AI Foundry, covering search index creation, connection listing, and model evaluations.
npx skills add microsoft/skills --skill azure-ai-projects-java -a claude-codeWhat azure-ai-projects-java does
This skill supplies code patterns for the com.azure:azure-ai-projects package at version 1.0.0-beta.1. It guides the assistant through configuring AIProjectClientBuilder and spawning sub-clients. Core covered components include ConnectionsClient, IndexesClient, and EvaluationsClient.
Authentication relies on DefaultAzureCredentialBuilder or ManagedIdentityCredentialBuilder. Without the PROJECT_ENDPOINT environment variable, project setup fails immediately. Production deployments using default credentials also demand the AZURE_TOKEN_CREDENTIALS flag.
Listing operations return a PagedIterable stream. You must handle pagination explicitly. For assessment workflows, the library bridges directly into OpenAI's EvalService via evaluationsClient.getOpenAIClient(). Common failures surface as ResourceNotFoundException or HttpResponseException.
What it helps with
- configure authentication using
DefaultAzureCredentialBuilder - create or update Azure AI Search indexes in Java
- list connected cloud resources through
ConnectionsClient - run model evaluations with OpenAI
EvalService
Example prompts for the agent
- Show me how to configure
AIProjectClientBuilderwith production credentials in Java. - Write Java code to create an Azure AI Search index using
IndexesClient. - How do I list connected project resources with
ConnectionsClientin Java?
How to install azure-ai-projects-java
1Skills CLI (Vercel)
npx skills add microsoft/skills --skill azure-ai-projects-java -a claude-code2Manually: put the files in place
~/.claude/skills/azure-ai-projects-java/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/azure-ai-projects-java/
Manually: put the files in place
.agents/skills/azure-ai-projects-java/SKILL.mdFor all projects use ~/.agents/skills/
Manually: put the files in place
.cursor/skills/azure-ai-projects-java/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install microsoft/skills azure-ai-projects-java2Manually: put the files in place
.github/skills/azure-ai-projects-java/SKILL.mdPlatform CLI
gemini skills install https://github.com/microsoft/skills --path .github/plugins/azure-sdk-java/skills/azure-ai-projects-javaManually: put the files in place
.devin/skills/azure-ai-projects-java/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about azure-ai-projects-java
How do I install azure-ai-projects-java in Claude Code?
Run npx skills add microsoft/skills --skill azure-ai-projects-java -a claude-code. This registers the skill for Claude Code.
What does the azure-ai-projects-java skill do?
It supplies ready-to-use patterns for the Azure AI Projects Java SDK. The skill assists in building client instances, configuring credentials, and orchestrating search indexes or datasets.
Which environment variables are required for the SDK?
You must provide PROJECT_ENDPOINT pointing to your project service URL. When running DefaultAzureCredential in production environments, set AZURE_TOKEN_CREDENTIALS as well.
Source text
SKILL.md · MIT
---
name: azure-ai-projects-java
description: |
Azure AI Projects SDK for Java. High-level SDK for Azure AI Foundry project management including connections, datasets, indexes, and evaluations.
Triggers: "AIProjectClient java", "azure ai projects java", "Foundry project java", "ConnectionsClient", "DatasetsClient", "IndexesClient".
license: MIT
metadata:
author: Microsoft
version: "1.0.0"
package: com.azure:azure-ai-projects
---
# Azure AI Projects SDK for Java
High-level SDK for Azure AI Foundry project management with access to connections, datasets, indexes, and evaluations.
## Installation
```xml
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-ai-projects</artifactId>
<version>1.0.0-beta.1</version>
</dependency>
```
## Environment Variables
```bash
PROJECT_ENDPOINT=https://<resource>.services.ai.azure.com/api/projects/<project> # Required for project configuration
AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production
```
## Authentication
```java
import com.azure.ai.projects.AIProjectClientBuilder;
import com.azure.core.credential.TokenCredential;
import com.azure.identity.AzureIdentityEnvVars;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.identity.ManagedIdentityCredentialBuilder;
TokenCredential credential = new DefaultAzureCredentialBuilder()
.requireEnvVars(AzureIdentityEnvVars.AZURE_TOKEN_CREDENTIALS)
.build();
// Or use a specific credential directly in production:
// See https://learn.microsoft.com/java/api/overview/azure/identity-readme?view=azure-java-stable#credential-classes
// TokenCredential credential = new ManagedIdentityCredentialBuilder().build();
AIProjectClientBuilder builder = new AIProjectClientBuilder()
.endpoint(System.getenv("PROJECT_ENDPOINT"))
.credential(credential);
```
## Client Hierarchy
The SDK provides multiple sub-clients for different operations:
| Client | Purpose |
|--------|---------|
| `ConnectionsClient` | Enumerate connected Azure resources |
| `DatasetsClient` | Upload documents and manage datasets |
| `DeploymentsClient` | Enumerate AI model deployments |
| `IndexesClient` | Create and manage search indexes |
| `EvaluationsClient` | Run AI model evaluations |
| `EvaluatorsClient` | Manage evaluator configurations |
| `SchedulesClient` | Manage scheduled operations |
```java
// Build sub-clients from builder
ConnectionsClient connectionsClient = builder.buildConnectionsClient();
DatasetsClient datasetsClient = builder.buildDatasetsClient();
DeploymentsClient deploymentsClient = builder.buildDeploymentsClient();
IndexesClient indexesClient = builder.buildIndexesClient();
EvaluationsClient evaluationsClient = builder.buildEvaluationsClient();
```
## Core Operations
### List Connections
```java
import com.azure.ai.projects.models.Connection;
import com.azure.core.http.rest.PagedIterable;
PagedIterable<Connection> connections = connectionsClient.listConnections();
for (Connection connection : connections) {
System.out.println("Name: " + connection.getName());
System.out.println("Type: " + connection.getType());
System.out.println("Credential Type: " + connection.getCredentials().getType());
}
```
### List Indexes
```java
indexesClient.listLatest().forEach(index -> {
System.out.println("Index name: " + index.getName());
System.out.println("Version: " + index.getVersion());
System.out.println("Description: " + index.getDescription());
});
```
### Create or Update Index
```java
import com.azure.ai.projects.models.AzureAISearchIndex;
import com.azure.ai.projects.models.Index;
String indexName = "my-index";
String indexVersion = "1.0";
String searchConnectionName = System.getenv("AI_SEARCH_CONNECTION_NAME");
String searchIndexName = System.getenv("AI_SEARCH_INDEX_NAME");
Index index = indexesClient.createOrUpdate(
indexName,
indexVersion,
new AzureAISearchIndex()
.setConnectionName(searchConnectionName)
.setIndexName(searchIndexName)
);
System.out.println("Created index: " + index.getName());
```
### Access OpenAI Evaluations
The SDK exposes OpenAI's official SDK for evaluations:
```java
import com.openai.services.EvalService;
EvalService evalService = evaluationsClient.getOpenAIClient();
// Use OpenAI evaluation APIs directly
```
## Best Practices
1. **Use DefaultAzureCredential** for production authentication
2. **Reuse client builder** to create multiple sub-clients efficiently
3. **Handle pagination** when listing resources with `PagedIterable`
4. **Use environment variables** for connection names and configuration
5. **Check connection types** before accessing credentials
## Error Handling
```java
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceNotFoundException;
try {
Index index = indexesClient.get(indexName, version);
} catch (ResourceNotFoundException e) {
System.err.println("Index not found: " + indexName);
} catch (HttpResponseException e) {
System.err.println("Error: " + e.getResponse().getStatusCode());
}
```
## Reference Links
| Resource | URL |
|----------|-----|
| Product Docs | https://learn.microsoft.com/azure/ai-studio/ |
| API Reference | https://learn.microsoft.com/rest/api/aifoundry/aiprojects/ |
| GitHub Source | https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/ai/azure-ai-projects |
| Samples | https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/ai/azure-ai-projects/src/samples |
© Microsoft · MIT · microsoft/skills