Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[FEATURE REQ] Provide native support for API key–based authentication, similar to other SDKs.

Aperta
#48,868 1 commento 0 reazioni 5 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@trrwilson ci sta già lavorando.

Dal 8/8/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

AI Agents customer-reported feature-request needs-team-attention Service Attention

Currently, the com.azure:azure-ai-agents:2.0.1 SDK enforces a Bearer token–based authentication model via TokenCredential.
However, when using Azure API Management (APIM) in front of Azure OpenAI/Agents endpoints, authentication is commonly handled using API Key headers (e.g., x-api-key), not Bearer tokens.

At the moment, there is no first-class support to pass API key–based credentials. Even when attempting to override the pipeline manually (as shown below), the SDK still expects a credential and does not provide a clean or supported way to use API key authentication.

val builder = AgentsClientBuilder()
builder.endpoint(baseUrl)
builder.httpLogOptions(HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))

val httpClient = HttpClient.createDefault()
val headers = HttpHeaders()
headers.set(credentials.keyName, credentials.keyValue)

val pipeline = HttpPipelineBuilder()
    .policies(AddHeadersPolicy(headers))
    .httpClient(httpClient)
    .build()

builder.pipeline(pipeline)

// Forced workaround
builder.credential(null)

val client = builder.buildAgentsClient()

This approach is fragile and not officially supported, making integration with APIM cumbersome.

Describe the solution

For example:
Add a method like:

builder.apiKeyCredential(ApiKeyCredential("key-name", "key-value"))

Alternatively, allow:

Custom headers to be injected without requiring TokenCredential
A dedicated AzureApiKeyCredential or similar abstraction
This would make it seamless to integrate with Azure APIM endpoints.

Lingua principale
Java
Stelle
2.6k
Fork
2.2k
Merge medio
1g 22h
PR unite (30g)
225

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/azure-sdk-for-java

Tutte le issue di Azure/azure-sdk-for-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.