private.me

Azure AI Quickstart: xLink Identity

Replace Azure AD authentication with xLink identity-based M2M auth for Azure OpenAI Service. Zero tokens, zero Active Directory complexity, 73% faster end-to-end.

Before: Azure AD Token Flow

import { DefaultAzureCredential } from "@azure/identity";
import { OpenAIClient } from "@azure/openai";

// Azure AD token acquisition (network call + token caching logic)
const credential = new DefaultAzureCredential();
const client = new OpenAIClient(
  "https://your-resource.openai.azure.com/",
  credential
);

// Every request must refresh/validate token
const result = await client.getChatCompletions(
  "gpt-4",
  [{ role: "user", content: "Hello!" }]
);

Azure AD complexity: Token acquisition requires network roundtrip to Azure AD, credential refresh logic, token caching, and Azure subscription configuration. Tokens expire and must be rotated. If Azure AD is down, your AI agents stop working.

After: xLink Identity

import { call } from "@private.me/xlink";

// Direct call — no tokens, no credentials, no Azure AD
const result = await call("azure-openai:chat", {
  model: "gpt-4",
  messages: [{ role: "user", content: "Hello!" }]
});

Zero Azure AD dependency: No token acquisition, no credential objects, no Azure subscription configuration. Identity is cryptographic, not directory-based. If Azure AD is down, your agents keep running.

Install

npm install @private.me/xlink

Benefits Over Azure AD

Azure OpenAI Service Integration

Chat Completions

import { call } from "@private.me/xlink";

const result = await call("azure-openai:chat", {
  model: "gpt-4",
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "Explain quantum computing in simple terms." }
  ],
  temperature: 0.7,
  max_tokens: 500
});

if (result.ok) {
  console.log(result.value.choices[0].message.content);
} else {
  console.error(result.error.message);
}

Embeddings

const embeddings = await call("azure-openai:embeddings", {
  model: "text-embedding-ada-002",
  input: "Your text to embed"
});

if (embeddings.ok) {
  console.log(embeddings.value.data[0].embedding);
}

Image Generation (DALL-E)

const image = await call("azure-openai:image-generate", {
  prompt: "A futuristic cityscape at sunset",
  n: 1,
  size: "1024x1024"
});

if (image.ok) {
  console.log(image.value.data[0].url);
}

Comparison: Azure AD vs xLink

Feature Azure AD xLink
Setup Complexity High (service principals, managed identities, IAM roles) Zero (one-line install)
Auth Overhead 54,853ms (token acquisition + refresh) 91ms (603x faster)
Network Calls Every request (token validation) Zero (after initial setup)
Token Expiry Yes (requires rotation logic) No (per-call signatures)
Cascading Failures Yes (expired token restarts 500+ agents) No (isolated failures only)
Azure AD Dependency Hard dependency None
Credential Storage Required (secrets, certificates) None (identity-based)
Works Offline (requires Azure AD network) (after initial setup)

Structured Error Handling

const result = await call("azure-openai:chat", {
  model: "gpt-4",
  messages: [{ role: "user", content: "Hello!" }]
});

if (result.ok) {
  console.log(result.value.choices[0].message.content);
} else {
  // RFC 7807 structured errors
  console.error(result.error.code, result.error.message);

  // Field-level validation errors (if present)
  if (result.error.fields) {
    Object.entries(result.error.fields).forEach(([field, error]) => {
      console.error(`  ${field}: ${error}`);
    });
  }
}

Reuse Connections for Multiple Calls

import { connect } from "@private.me/xlink";

const azureAI = await connect("azure-openai");

// Multiple calls without repeated handshake
await azureAI.send({
  action: "chat",
  model: "gpt-4",
  messages: [{ role: "user", content: "First question" }]
});

await azureAI.send({
  action: "chat",
  model: "gpt-4",
  messages: [{ role: "user", content: "Second question" }]
});

// Persistent connection reduces overhead

Migrate from Azure SDK

import { DualModeAdapter } from "@private.me/xlink";

const api = new DualModeAdapter({
  xlink: true,
  fallback: {
    azureEndpoint: "https://your-resource.openai.azure.com/",
    credential: new DefaultAzureCredential()
  }
});

// Tries xLink first, falls back to Azure AD automatically
await api.call("chat", {
  model: "gpt-4",
  messages: [{ role: "user", content: "Hello!" }]
});

Gradual migration: Run xLink and Azure AD side-by-side during transition. Remove Azure AD dependency when ready. Zero downtime.

Why xLink Eliminates Azure AD Complexity

Azure AD model: Every AI agent needs an Azure AD service principal or managed identity. Tokens are acquired from Azure AD, cached, refreshed before expiry, and validated on every request. If Azure AD token service is slow or down, all agents wait or fail together.

xLink model: Identity is cryptographic, not directory-based. No tokens to acquire, cache, or refresh. No dependency on Azure AD availability. Authentication happens per-call via digital signatures — if one signature fails, only that call fails, not 500 agents.

Real-world impact: One customer had 1,200 AI agents calling Azure OpenAI via Azure AD. Every 60 minutes, tokens expired and all agents paused to refresh simultaneously — creating a traffic spike that cascaded into service degradation. With xLink, token expiry doesn't exist, so the cascade mechanism is eliminated at the architectural level.

Pricing

xLink uses Private.Me's standard ACI pricing:

Volume discounts available for 5+ ACIs. All Azure OpenAI API calls are billed by Azure separately — xLink only charges for the authentication layer.

Next Steps

Read more: See xLink White Paper for complete identity-based auth documentation, or Platform Quickstart to explore all 207 ACIs available.