Azure / Azure/data-api-builder

[Enh]: Support Entra in Local Containers with `SQL_ACCESS_TOKEN`

Abierto
#3,252 0 comentarios 0 reacciones 0 asignados Ver en GitHub
2.x
Lenguaje dominante
C#
Estrellas
1.5k
Forks
370
Merge medio
3 d 22 h
PR fusionados (30 d)
9

Descripción

## What

Allow Data API builder to read a development token from `SQL_ACCESS_TOKEN` and assign it to `SqlConnection.AccessToken`.

> [!IMPORTANT]
> This feature is explicitly scoped to development mode. Never use in production.

## Why

When DAB runs in Docker, normal Entra credential chains often fail. Some SQL endpoints, such as Fabric SQL, require token authentication. This feature provides a development token override so containerized development works without changing production authentication.

## How

- No change to the configuration file.
- No change to the command-line.

### At connection creation:

```
if (development mode &&
not OBO &&
Entra authentication &&
SQL_ACCESS_TOKEN exists)
{
connection.AccessToken = SQL_ACCESS_TOKEN
connection.Pooling = false
}
```

> [!IMPORTANT]
> The env var is re-read on every connection open (never cached).

> [!NOTE]
> In a pooled scenario, you might not see a clean error. So, we disable pooling.

### Logging

When properly invoked:

```
[INFO] Using SQL_ACCESS_TOKEN for connection (development mode)
```

When prerequisites are not met:

```
[WARN] SQL_ACCESS_TOKEN set but requirements are not met — token ignored
```

### Rules

* only when the connection string uses Microsoft Entra authentication: `Active Directory Default`, `Active Directory Managed Identity`, `Active Directory Workload Identity` only.
* only when the `OBO` flow is not being used
* only when `SQL_ACCESS_TOKEN` exists
* only when `runtime.host.mode=development`
* always allow the engine to start
* let the database raise connection errors if the token is invalid
* do not cache the token, re-read it every time a connection is opened

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en la ruta de creación de conexiones y sigue las comprobaciones del modo de desarrollo, OBO y la autenticación de Microsoft Entra. Verifica que SQL_ACCESS_TOKEN se vuelva a leer para cada conexión, que el uso de este token deshabilite el pooling y que se registre la información o advertencia especificada. Confirma que los requisitos previos no cumplidos no impidan el inicio y que los tokens no válidos se dejen para que la base de datos los rechace.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
azure, csharp, sql
Área
authentication, backend-api-design, databases
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.