Metadata-Version: 2.5
Name: hermes-mai-image
Version: 0.3.0
Summary: Microsoft Foundry MAI image generation backend for Hermes Agent
Project-URL: Homepage, https://github.com/joescars/hermes-mai-image
Project-URL: Repository, https://github.com/joescars/hermes-mai-image
Project-URL: Issues, https://github.com/joescars/hermes-mai-image/issues
Author: joescars
License-Expression: MIT
License-File: LICENSE
Keywords: azure,hermes-agent,image-generation,mai,microsoft-foundry
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.10
Requires-Dist: requests<3,>=2.28
Provides-Extra: entra
Requires-Dist: azure-identity>=1.14; extra == 'entra'
Provides-Extra: lint
Requires-Dist: ruff>=0.8; extra == 'lint'
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Requires-Dist: pyyaml>=6; extra == 'test'
Requires-Dist: tomli>=2; (python_version < '3.11') and extra == 'test'
Description-Content-Type: text/markdown

# Hermes Microsoft Foundry MAI Image Plugin

Standalone Hermes Agent image-generation backend for Microsoft Foundry MAI image models.

## Quick Start

### 1. Get your Microsoft Foundry values

From the Foundry resource's **Keys and Endpoint** page, collect:

- An API key — or, if your resource has local (key) authentication disabled, Microsoft Entra ID credentials the plugin can pick up (see [Microsoft Entra ID authentication](#microsoft-entra-id-authentication-no-api-key) below).
- The resource endpoint, for example:

  ```text
  https://your-resource.services.ai.azure.com
  ```

- The deployment name assigned to your MAI image model.

Use the resource root as the endpoint; the plugin appends `/mai/v1` itself. The endpoint is normalized to `https://host[:port]`: a pasted `/mai/v1`, `/models`, `/openai/v1`, `/api/projects/<name>` suffix, query string or trailing slash is stripped (logged at debug level), and a bare host such as `your-resource.services.ai.azure.com` gets `https://` prepended. A non-`https` endpoint is rejected with an `invalid_config` error and no request is sent. The deployment name is the value sent as the API `model` field and may differ from the catalog model name.

### 2. Install the plugin into Hermes

Two paths install the same plugin. Prefer the catalog install; fall back to the Git install when you want the moving branch.

**Catalog install (recommended).** The entry is submitted to the Hermes plugin catalog as `azure-mai-image`; once it is merged there:

```bash
hermes plugins install azure-mai-image
```

The catalog entry (`catalog/mai-image.yaml`) pins an exact 40-character commit SHA that has been validated and reviewed for the catalog. Installs clone the repository, check out precisely that commit, and install from the `src/hermes_mai_image` subdirectory, so a catalog install is reproducible and does not move until you run `hermes plugins update azure-mai-image` (which adopts a newly reviewed pin). Use this path for a stable, vetted plugin.

**Git install (tracks the branch).** To run the current development code instead of a pinned release:

```bash
/usr/local/lib/hermes-agent/venv/bin/pip install --upgrade \\
  "git+https://github.com/joescars/hermes-mai-image.git"
```

The Git install tracks the branch, so `--upgrade` picks up the newest commits. A catalog install is pinned and validated; a Git install is live and unreviewed. Use the catalog install unless you specifically want unreleased changes.

To use Microsoft Entra ID authentication instead of an API key, install the optional `entra` extra (adds `azure-identity`):

```bash
/usr/local/lib/hermes-agent/venv/bin/pip install --upgrade \
  "hermes-mai-image[entra] @ git+https://github.com/joescars/hermes-mai-image.git"
```

Verify the package is visible either way:

```bash
hermes plugins list
```

### 3. Enable the plugin and image generation

```bash
hermes plugins enable azure-mai-image
hermes tools enable image_gen
```

Verify:

```bash
hermes plugins list
hermes tools list
```

You should see `azure-mai-image` enabled and:

```text
✓ enabled  image_gen  🎨 Image Generation
```

### 4. Restart Hermes processes

Plugins load when a Hermes process starts. No operating-system reboot is needed, but restart long-running processes after installation or updates:

```bash
hermes gateway restart
hermes dashboard --stop
hermes dashboard
```

### 5. Configure from the CLI

Run the interactive tool setup:

```bash
hermes tools
```

Choose **Image Generation → Microsoft Foundry MAI**, then enter the API key, endpoint, and deployment/model when prompted.

### 6. Configure from the Hermes Web UI

1. Run `hermes dashboard` and authenticate.
2. Open **Tools → Image Generation**.
3. Select **Microsoft Foundry MAI**.
4. Enter the API key and resource endpoint.
5. Save the provider.
6. Select the MAI deployment/model if the model picker is shown.

The Web UI uses the provider's setup schema and saves credentials in the active profile's `.env`. It supports these fields:

```text
MAI_FOUNDRY_API_KEY
MAI_FOUNDRY_ENDPOINT
MAI_FOUNDRY_AUTH
```

**Credential handling.** The plugin reads `MAI_FOUNDRY_API_KEY` and `MAI_FOUNDRY_ENDPOINT` through Hermes secret scope for the **active profile** — the values are resolved in the context of the profile that is running, so a second profile cannot pick them up accidentally. The values live in the active profile's `.env` under `$HERMES_HOME/profiles/<profile>/.env` (the default profile's `.env` sits at `$HERMES_HOME/.env`). The API key is sent to your Foundry resource in the `api-key` header on each request and is never logged, never written by the plugin anywhere else, and never included in image metadata. In Entra mode (`MAI_FOUNDRY_AUTH=entra`) no API key is needed or sent; see [Microsoft Entra ID authentication](#microsoft-entra-id-authentication-no-api-key).

Never put API keys in `config.yaml`, chat messages, or Git. Only `MAI_FOUNDRY_API_KEY` is a secret: inside Hermes it is read solely from the active profile's secret scope (a same-named process environment variable is ignored); outside Hermes it falls back to the environment. The endpoint, model and discovery path are non-secret and can instead be set in `config.yaml` under `image_gen.azure-mai` as `endpoint`, `model` and `models_path` (config wins over the `MAI_FOUNDRY_ENDPOINT`, `MAI_IMAGE_MODEL`, `MAI_FOUNDRY_MODELS_PATH` env vars; `MAI_IMAGE_MODEL` and `MAI_FOUNDRY_MODELS_PATH` are optional). `config.yaml` holds only non-secret model selection, not credentials.

If the provider does not appear, restart the dashboard after installing the package. A browser refresh alone does not reload Python plugins.

### Updating Hermes later

Hermes updates do not normally change this GitHub-installed plugin or its configuration. The API key, endpoint, deployment selection, and plugin-enabled state are stored separately in the active Hermes profile.

After a normal Hermes update, verify the plugin:

```bash
hermes plugins list
```

If `azure-mai-image` is still listed as enabled, restart Hermes processes:

```bash
hermes gateway restart
hermes dashboard --stop
hermes dashboard
```

If the Hermes update recreated or replaced its Python virtual environment, reinstall the plugin into the new Hermes environment:

```bash
/usr/local/lib/hermes-agent/venv/bin/pip install --upgrade \\
  "git+https://github.com/joescars/hermes-mai-image.git"
```

Then enable it again if necessary and restart Hermes:

```bash
hermes plugins enable azure-mai-image
hermes gateway restart
```

You do not need to re-enter the API key unless the active Hermes profile changed or its `.env` was intentionally reset.

### 7. Set the deployment explicitly when needed

For most Foundry deployments, set the exact deployment name in the active Hermes profile's `.env`:

```dotenv
MAI_FOUNDRY_API_KEY=your-foundry-key
MAI_FOUNDRY_ENDPOINT=https://your-resource.services.ai.azure.com
MAI_IMAGE_MODEL=your-deployment-name
```

Never put API keys in `config.yaml`, chat messages, or Git. Only `MAI_FOUNDRY_API_KEY` is a secret: inside Hermes it is read solely from the active profile's secret scope (a same-named process environment variable is ignored); outside Hermes it falls back to the environment. The endpoint, model and discovery path are non-secret and can instead be set in `config.yaml` under `image_gen.azure-mai` as `endpoint`, `model` and `models_path` (config wins over the `MAI_FOUNDRY_ENDPOINT`, `MAI_IMAGE_MODEL`, `MAI_FOUNDRY_MODELS_PATH` env vars; `MAI_IMAGE_MODEL` and `MAI_FOUNDRY_MODELS_PATH` are optional). `MAI_IMAGE_MODEL` defaults to `MAI-Image-2.5` if omitted, but the exact deployment name is recommended.

### 8. Test generation

```bash
hermes chat -q "Generate an image of a red fox sitting in a snowy forest at sunrise."
```

Generated images are saved under `$HERMES_HOME/cache/images/`.

### 9. Test editing

Provide a local PNG or JPEG path in the prompt:

```bash
hermes chat -q "Edit /absolute/path/to/source.png: turn the scene into a nighttime scene with moonlight."
```

The edit request uses MAI's `/mai/v1/images/edits` multipart endpoint.

## Features

- API-key authentication with the Foundry `api-key` header, or optional Microsoft Entra ID (`Authorization: Bearer`) authentication
- Live model discovery through the resource `/models` endpoint, with a documented MAI fallback catalog
- Text-to-image generation through `/mai/v1/images/generations`
- Image-to-image editing through `/mai/v1/images/edits`
- Landscape, square, and portrait dimensions
- Stable local output files under `$HERMES_HOME/cache/images/`
- Installable from the Hermes plugin catalog (pinned SHA) or directly from GitHub

## Model discovery

**The `model` sent to MAI is your Foundry *deployment name*, not necessarily a base model name.** Picking `MAI-Image-2.6` works only if your deployment is literally named `MAI-Image-2.6`; otherwise MAI returns 404.

Discovery is best-effort and unverified. The provider calls `GET {endpoint}/models` with the `api-key` header and reads a `data` (or `models`) array. Microsoft's MAI documentation lists deployments only through the Azure management plane, and we could not confirm that `/models` returns MAI deployments on a real resource, so in practice you will usually see the fallback list. Discovered entries that do not look like image models are labelled `(unverified: may not be an image model)`.

What the picker shows:

1. Your configured deployment (explicit model, `image_gen.azure-mai.model`, `MAI_IMAGE_MODEL`, or `image_gen.model`) is always listed first, labelled `(configured deployment)`, and de-duplicated against the rest.
2. Discovered entries, if any; otherwise the built-in fallback catalog, labelled `(model name — must match your deployment name)`:

```text
MAI-Image-2.6-Flash
MAI-Image-2.6
MAI-Image-2.5-Pro
MAI-Image-2.5-Flash
MAI-Image-2.5
```

Labels appear only in the display/description columns; the id saved to config and sent to the API is always the bare name.

**List your real deployment names** with the Azure CLI:

```bash
az cognitiveservices account deployment list \
  --name <resource-name> --resource-group <resource-group> \
  --query "[].name" -o tsv
```

Set one of those as the model (`MAI_IMAGE_MODEL` or `image_gen.azure-mai.model`) if it differs from the fallback names.

**Overriding the discovery path.** Set `MAI_FOUNDRY_MODELS_PATH` to point discovery at a different route on the same resource. A value without a leading `/` is normalised by adding one:

```dotenv
MAI_FOUNDRY_MODELS_PATH=/models
```

The model actually sent to MAI is resolved in this order: an explicit per-request model, then `image_gen.azure-mai.model` in `config.yaml`, then `MAI_IMAGE_MODEL` from the environment, then `image_gen.model`, then the `MAI-Image-2.5` default. The picker list does not change which deployment name is sent unless you pick one.

## Microsoft Entra ID authentication (no API key)

Many enterprise Foundry resources disable local (key) authentication. On those, the plugin can authenticate with Microsoft Entra ID instead of an API key.

**1. Install the `entra` extra.** It adds the optional `azure-identity` dependency:

```bash
/usr/local/lib/hermes-agent/venv/bin/pip install --upgrade \
  "hermes-mai-image[entra] @ git+https://github.com/joescars/hermes-mai-image.git"
```

**2. Assign the RBAC role.** Give the identity the plugin will run as the **Cognitive Services User** role on the Foundry resource (resource group or subscription scope works too, but keep it as narrow as possible):

```bash
az role assignment create \
  --assignee <object-id-or-principal> \
  --role "Cognitive Services User" \
  --scope /subscriptions/<subscription>/resourceGroups/<group>/providers/Microsoft.CognitiveServices/accounts/<resource-name>
```

**3. Switch the auth mode.** In the active Hermes profile's `.env`, set the mode and the endpoint. `MAI_FOUNDRY_API_KEY` is **not** required in this mode:

```dotenv
MAI_FOUNDRY_AUTH=entra
MAI_FOUNDRY_ENDPOINT=https://your-resource.services.ai.azure.com
MAI_IMAGE_MODEL=your-deployment-name
```

`MAI_FOUNDRY_AUTH` may also be set as `image_gen.azure-mai.auth: entra` in `config.yaml` (non-secret; config wins over the environment). Any value other than `entra` keeps the default key authentication, so an unrecognised value fails safe rather than changing behaviour.

**How it works.** The plugin builds a `DefaultAzureCredential` and requests access tokens for the scope `https://cognitiveservices.azure.com/.default`. Tokens are obtained with `get_bearer_token_provider` and cached until near expiry, so Microsoft Entra ID is contacted only when a new token is actually needed, not on every image request. The token provider is rebuilt whenever the Azure credential environment (`AZURE_*` variables such as `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`) changes, so credential rotation or an environment switch takes effect on the next request instead of being pinned to the first caller. Because `DefaultAzureCredential` reads the process environment (plus managed identity and `az login`), `AZURE_*` credentials must be present in the actual process environment; they are not read from Hermes profile secret scope. The credential fingerprint used for the rebuild check is never logged. Requests then carry `Authorization: Bearer <token>` instead of the `api-key` header.

`DefaultAzureCredential` resolves credentials in the standard order — environment variables (`AZURE_CLIENT_ID`/`AZURE_TENANT_ID`/`AZURE_CLIENT_SECRET`), managed identity, `az login`, and so on — so it works on a VM, in a container with a managed identity, or on a workstation with the Azure CLI signed in.

**Error handling.** With `MAI_FOUNDRY_AUTH=entra` set but `azure-identity` missing, generation returns a clear `invalid_config` error naming the `pip install "hermes-mai-image[entra]"` command instead of attempting a request. If token acquisition fails (for example the role assignment is missing), the error names the **Cognitive Services User** role to check.

## API behavior

MAI generation uses (key mode):

```text
POST {endpoint}/mai/v1/images/generations
api-key: ***
{"model": "<deployment>", "prompt": "...", "width": 1248, "height": 832}
```

MAI editing uses multipart form data (key mode):

```text
POST {endpoint}/mai/v1/images/edits
api-key: ***
model=<deployment>
prompt=<prompt>
image=<file>
```

In Entra mode (`MAI_FOUNDRY_AUTH=entra`) the `api-key` header is replaced by an Entra access token on both endpoints:

```text
POST {endpoint}/mai/v1/images/generations
Authorization: Bearer <token-from-microsoft-entra>
```

The plugin accepts a local file path or HTTP(S) URL as `image_url`/`reference_image_urls`. Up to five source images (JPEG/PNG) are supported for edits and are sent as repeated multipart `image` fields in the order given (`image_url` first, then `reference_image_urls`); more than five are rejected with a `too_many_references` error before any request is sent. Each source passes the same safety, format and size checks, and the combined upload is capped at 250 MB. Generated images remain in Hermes' `$HERMES_HOME/cache/images/`. Successful results expose the WebUI-facing `file://` URI in `image` and retain the absolute cached path in `host_image` for Hermes media delivery.

### Retry behavior

- HTTP 429 is always retried, waiting for `Retry-After` (seconds or HTTP-date, capped at 120s). Without the header the wait is about 10s, then 30s, plus jitter, because MAI quotas can be as low as 2 requests per minute.
- Among 5xx errors only 502 and 503 are retried. 500 and 504 are never retried, since they do not prove a paid generation did not run and a retry could bill twice.
- At most 3 attempts are made, all within an overall deadline set by `MAI_REQUEST_DEADLINE` (seconds, default 600; also `image_gen.azure-mai.request_deadline` in config.yaml). The plugin never sleeps past the deadline, and each request timeout is shortened to the remaining budget.
- Connection errors and timeouts are not retried.

## Disclosure

This section is the plugin's [catalog rule 13](https://github.com/NousResearch/hermes-agent/blob/main/plugin-catalog/README.md) disclosure — what the plugin does that you should know before installing it.

- **Network destination.** Your prompt, the optional source image (for edits), and your Foundry credentials are sent over **https** to **your own Microsoft Azure AI Foundry resource** — the endpoint you configure in `MAI_FOUNDRY_ENDPOINT`. The plugin talks to no other host. In the default key mode the API key travels only in the `api-key` header on requests to that resource; in Entra mode a Microsoft Entra access token for the `https://cognitiveservices.azure.com/.default` scope travels only in the `Authorization` header to that same resource (obtained from Microsoft Entra ID and cached until near expiry).
- **Web grounding (opt-in).** If you enable `web_grounding` (MAI-Image-2.6 only, off by default), the model may derive search queries from your prompt and send them to **Bing Search** as part of the Foundry service. Leave it off if prompts must not leave your Foundry resource for web search.
- **Billing.** Every generation and edit calls your Foundry deployment and **bills your Azure subscription** for that deployment. There is **no Hermes approval prompt before spending** — the plugin does not gate on cost and does not know MAI pricing. Your Azure quota and rate limits are the only backstop.
- **Local writes.** Returned images are downloaded and written into the Hermes image cache under `$HERMES_HOME/cache/images/`. Nothing is written outside that cache and the plugin's own working directory.
- **No telemetry.** The plugin reports no usage, analytics, or diagnostics anywhere.
- **No shell commands.** It never runs a subprocess or shell command.
- **No background processes.** It makes synchronous HTTP requests and starts no daemons, timers, or watchers.
- **No self-updates.** The plugin does not fetch or replace its own files. Catalog updates arrive only through a reviewed SHA-bump in the catalog plus `hermes plugins update azure-mai-image`.
- **No extra required dependencies.** The only required runtime dependency is `requests` (plus Hermes itself). The optional Entra mode adds `azure-identity`, installed only when you choose the `[entra]` extra.

## Compatibility

- **Hermes floor:** `requires_hermes: ">=0.21.6"`. The plugin uses image-gen provider APIs that require a Hermes at or above this version.
- **Where it is declared:** in `plugin.yaml` (`requires_hermes`) inside the package, **and** in the catalog entry (`catalog/mai-image.yaml`, `requires_hermes`), so both the loader and the catalog enforce the same floor.
- **Install behaviour:** an install by catalog name refuses on an older Hermes, and `hermes plugins update` keeps an installed copy at its current pin until Hermes is updated.
- **Python:** 3.10 or newer (`requires-python = ">=3.10"`).

## Security behaviour

Source images are the one place this plugin handles untrusted input. Remote references are fetched with `requests` behind an explicit SSRF policy rather than being handed to the HTTP client unexamined. Local file reads are additionally checked against Hermes' file-safety rules.

- **Scheme allowlist.** Only `https` source references are fetched; anything else is refused.
- **Address checks.** The host is resolved and every returned address must be public; loopback, private, link-local, reserved and multicast ranges are refused, and the cloud metadata address is blocked regardless of settings. When Hermes' own `tools.url_safety` policy is importable it is used in preference to the built-in check.
- **Redirects are not followed.** A redirecting source response raises instead of being followed, so a public URL cannot bounce into an internal address. Requests are sent with `allow_redirects=False`, and any 3xx status or response with redirect history is refused. Known limitation: the address check resolves the host separately from the fetch, so a DNS-rebinding attacker who controls a hostname's DNS could in principle return a public address for the check and an internal one for the connection; connection-time IP pinning is not implemented.
- **Byte caps.** A downloaded source image is capped at 50 MiB (`MAX_SOURCE_IMAGE_BYTES`) enforced while streaming, so an oversized body is aborted rather than buffered; the same limit applies to local source files.
- **Content sniffing.** The source is validated by magic bytes (PNG or JPEG) and the authoritative MIME type is taken from the file content, not from the file extension or a caller-supplied type. Non-images are rejected, and GIF and WebP sources are rejected before upload (`invalid_input`) because MAI accepts only JPEG or PNG source images; convert them first.
- **Up to five reference images.** MAI editing takes at most five JPEG/PNG source images. Six or more are rejected with a `too_many_references` error before any request is sent, and the total upload across sources is capped at 250 MB.
- **Width and height constraints.** Generation uses fixed presets chosen from the resolved aspect ratio and the model family (width and height each ≥ 768; MAI-Image-2.5 family ≤ 1,048,576 pixels, MAI-Image-2.6 family ≤ 2,359,296). 2.5 (default): landscape `1248x832`, square `1024x1024`, portrait `832x1248`. 2.6: landscape `1824x1216`, square `1536x1536`, portrait `1216x1824`. A deployment name containing `2.6` or `2-6` selects the 2.6 sizes; otherwise 2.5 sizes are used. For custom deployment names, set `MAI_IMAGE_SIZE_PROFILE=2.6` (or `2.5`) in the profile `.env`, or `image_gen.azure-mai.size_profile` in `config.yaml`. There is no free-form width/height input.
- **MAI-Image-2.6 options.** `auto_aspect_ratio` (the model chooses the output aspect ratio) and `web_grounding` (the model may use Bing Search results as context; see Disclosure) are off by default and sent only when enabled, on both generation and edits. Enable with `image_gen.azure-mai.auto_aspect_ratio: true` / `web_grounding: true` in `config.yaml`, or `MAI_AUTO_ASPECT_RATIO=true` / `MAI_WEB_GROUNDING=true` in the profile `.env` (truthy: `1`, `true`, `yes`, `on`). They are only supported by 2.6 deployments (2.5 returns 400): on other deployments the fields are skipped with a logged warning. For custom deployment names, set `size_profile` / `MAI_IMAGE_SIZE_PROFILE` to `2.6`.
- **Auth tokens.** In Entra mode the plugin obtains access tokens through `azure-identity`'s `DefaultAzureCredential` for the `https://cognitiveservices.azure.com/.default` scope only, sends them only in the `Authorization` header to the configured endpoint, and never logs or persists them; token refresh and caching are handled by `azure-identity`, and the token provider is rebuilt whenever the `AZURE_*` credential environment changes so a rotated credential is never reused (the fingerprint used for that check is itself never logged). Key mode continues to send the API key only in the `api-key` header.

## Development

```bash
python3 -m venv .venv
. .venv/bin/activate
pip install -e '.[test]'
pytest -q
```

The tests mock HTTP responses and never require an Azure key.

## Validation

`hermes plugins validate src/hermes_mai_image` passes. It reports one warning, which is understood and accepted:

```
⚠ private core imports (catalog rule 9: public surfaces only; these can break on
any release): provider.py:45 agent.file_safety.raise_if_read_blocked
```

**Why it is accepted.** `raise_if_read_blocked` is the shared chokepoint Hermes itself uses for local-path input loading; the same import appears in Hermes' own bundled providers (`plugins/image_gen/{xai,openai,openai-codex,krea,openrouter}` and `plugins/video_gen/xai`). It is what stops a local reference image from reading a credential store or a protected path, and there is no public equivalent for it. Dropping the import to silence the warning would remove that guard — a worse outcome than the warning.

The warning fires because `agent.file_safety` is not listed in `hermes_cli/data/plugin_api.json`, which is the allowlist the lint consults. A request to publish a public seam for this (and for image fetching, where no public download API exists at all) is filed upstream at [NousResearch/hermes-agent#155704](https://github.com/NousResearch/hermes-agent/issues/155704); if it lands, the import is replaced and the warning disappears.

The other private import originally flagged — `tools.vision_tools._download_image` — **has been removed**: the plugin now fetches source images itself behind the published `tools.url_safety.is_safe_url` policy. The redirect guard, byte cap and magic-byte sniffing are covered by tests, including a test asserting a redirect's `Location` is never dereferenced.

## Microsoft documentation

- [Deploy and use MAI image models in Microsoft Foundry](https://learn.microsoft.com/en-us/azure/foundry/foundry-models/how-to/use-foundry-models-mai-image)
- [Use Microsoft Entra ID authentication with MAI image models](https://learn.microsoft.com/en-us/azure/foundry/foundry-models/how-to/use-foundry-models-mai-image#use-microsoft-entra-id-authentication)
