Azure / Azure/data-api-builder
[Enh]: Support Entra in Local Containers with `SQL_ACCESS_TOKEN`
- 主要言語
- C#
- スター
- 1.5k
- フォーク
- 370
- 平均マージ
- 3日 22時間
- マージ済み PR(30日)
- 9
説明
## 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
コントリビューションガイド
調査の方向性
接続作成パスから開始し、開発モード、OBO、および Microsoft Entra 認証のチェックを追跡します。SQL_ACCESS_TOKEN が接続ごとに再読み込みされること、使用時にはプーリングが無効になること、指定された info または warning がログに記録されることを確認します。満たされていない前提条件によって起動が妨げられないこと、無効なトークンはデータベースに拒否させることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- azure, csharp, sql
- 領域
- authentication, backend-api-design, databases
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100