migrate-apim: against CLI 1.0.0b34, provider and model creates are rejected, read-backs never match, and the Foundry endpoint 404s
Los mantenedores suelen responder en 1 día
@santiagxf ya está trabajando en esto.
Desde el 17/11/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Summary
Against az aigateway 1.0.0b34 (default API version 2026-11-01), an end-to-end migrate-apim run can't finish, even for a small, clean APIM source:
applycan't create a model provider or a model: the resource provider rejects both withThe displayName property is required.- The provider and MCP read-backs compare against the 1.0.0b31 resource shape, so correct objects report
the object exists but does not match the desired state. - The planner copies APIM's
.../openaibackend URL as the Foundry provider endpoint. Every read-back saysverified, but inference returns 404. - An
authentication-managed-identitypolicy at API scope (the common APIM pattern) isn't recognized, so the plan has no identity step and no Foundry RBAC prerequisite.
The planner reports N items against CLI 1.0.0b31 (declared, not probed) (with --probe-cli: (probed)), while the installed CLI is 1.0.0b34.
Found while writing the migration section of lab 17 (PR #51). Every finding below was reproduced live with tools/migrate-apim at main 990fd3f. The plugin aigateway@azure v3.1.1 installed from the marketplace has an identical copy.
Environment
az aigateway1.0.0b34, Azure CLI 2.91.0, Python 3.14, macOS- Source: APIM BasicV2
@2025-09-01-previewin Sweden Central with a system-assigned identity, one Foundry account (gpt-5-mini2025-08-07, GlobalStandard), one Azure OpenAI model API withllm-token-limitandset-header, one product with one subscription, and one MCP passthrough API (https://learn.microsoft.com/api/mcp) - The source template is
labs/17-coding-agent-plugin/infra/apim-source.bicepin PR #51
Repro
TOOL=~/aigateway/tools/migrate-apim
PYTHONPATH=$TOOL python3 -m migrate_apim.cli collect --apim <apim> -g <rg> -o inventory.json
PYTHONPATH=$TOOL python3 -m migrate_apim.cli discover-tools --inventory inventory.json --allow-secret-use mcp:learn-mcp
PYTHONPATH=$TOOL python3 -m migrate_apim.cli plan --inventory inventory.json -o plan.json \
--target /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ApiManagement/aigateways/<new-gateway>
# settle the 6 decisions, re-run plan, then for each phase:
PYTHONPATH=$TOOL python3 -m migrate_apim.cli apply --plan plan.json --inventory inventory.json --phase <phase> --execute
apply --status after the run:
steps: 8 in the plan, 2 failed, 6 verified
gateway complete (1 steps)
identity complete (1 steps)
providers stopped (1 steps) (rehearsed)
models complete (1 steps) <- only because the model was created by hand (workaround below)
aliases complete (1 steps)
toolServers stopped (1 steps) (rehearsed)
policies complete (1 steps)
keys complete (1 steps)
stuck:
failed: item:modelProvider/modelProvider-foundry-ai-endpoint -- foundry-ai-endpoint: ERROR: (ValidationError) ... The displayName property is required.
failed: item:mcp/learn-mcp/registration -- learn-mcp: the object exists but does not match the desired state
Findings
1. model-provider create is rejected: displayName is required
apply.py _provider_create (L869) builds az aigateway model-provider create ... --kind Foundry --foundry @<file> with no --display-name. With 1.0.0b34 the RP rejects it:
(ValidationError) One or more fields contain incorrect values:
Exception Details: (ValidationError) The displayName property is required.
The providers phase stops with exit 1: "Stopped in providers. The source APIM is untouched; the gateway is partially built."
Expected: pass --display-name (for example, the APIM backend name or its title).
2. model create is rejected the same way
_model_create (L882) also passes no --display-name, and the RP returns the same displayName property is required error once a provider exists.
3. The provider read-back expects the 1.0.0b31 shape
The comparison reads kind, foundry.endpoint as a string, and foundry.authentication. 1.0.0b34 (2026-11-01) returns:
{
"modelProviderType": "Foundry",
"displayName": "foundry-ai-endpoint",
"foundry": { "endpoint": { "url": "https://<acct>.cognitiveservices.azure.com/" }, "resourceIds": ["..."] },
"authentication": { "managedIdentity": { "resource": "https://cognitiveservices.azure.com/" } }
}
Even a correct provider reports "the object exists but does not match the desired state". Note the trailing / that the service adds to managedIdentity.resource.
4. The MCP read-back expects the 1.0.0b31 shape
The MCP server is created correctly (az aigateway mcp show and an initialize call through /default/toolservers/learn-mcp/mcp both work), but the read-back compares endpoints[].mcp.url and required: true. 1.0.0b34 returns endpoints[].mcp.endpoint.url, mode: "failClosed", plus id and gatewayEndpoints. The toolServers phase reports failed and stays stopped.
5. The planner uses APIM's /openai backend URL as the Foundry provider endpoint
plan.py _provider (L389) copies the backend URL https://<acct>.cognitiveservices.azure.com/openai into foundry.endpoint. The gateway needs the account root https://<acct>.cognitiveservices.azure.com/. With the /openai endpoint, every step reads back as verified, yet POST /default/models/openai/v1/chat/completions returns 404 Resource not found. This is the dangerous one: the run looks green and serves no traffic.
Expected: strip the API path suffix (/openai, /openai/v1, /models) for Foundry providers, or take the endpoint from the resolved Foundry account (properties.endpoint), which collect already reads.
6. An API-scoped authentication-managed-identity policy leaves provider auth undetermined
collect.py (around L1935-2000) reads provider auth from the backend's credentials.managedIdentity or from the backend-scoped effective policy only. The most common APIM pattern puts <authentication-managed-identity resource="https://cognitiveservices.azure.com" /> in the API policy. Then the provider shows auth=undetermined, and the plan has no identity.assign step and no prereq:foundry-rbac. The migrated gateway has no identity and no grant, and inference fails at runtime.
With credentials.managedIdentity on the backend instead, the inventory shows auth=managedIdentity and the plan includes both.
7. The planner proposes reuse-appinsights for an Azure Monitor logger
With only an azureMonitor logger (resourceId: null, no Application Insights), plan.py (L1025-1047) still proposes reuse-appinsights and adds the prerequisite "Enable the OTLP endpoint on the Application Insights resource APIM reports to". There is no such resource. The coding agent caught it during review ("The generated reuse recommendation is unsupported by the collected evidence"). Suggest proposing gateway-metrics-only or new-appinsights when no logger is applicationInsights.
8. --next-phase returns to a stopped phase
next_phase() (L547) returns the first incomplete phase, so after providers stops, --next-phase returns providers again, even when a later phase could run. The operator has to name every later phase with --phase. Consider a hint ("providers is stopped; later phases can run with --phase models") or a --skip option.
Verified fixes
In a patched copy of the tool (not proposed as a PR, so that the maintainers can choose the shape), the following made a full run finish with model 200 and MCP 200:
- Pass
--display-name <name>in_provider_createand_model_create. - Compare the 2026-11-01 provider shape:
modelProviderType,foundry.endpoint.url, top-levelauthentication.managedIdentity.resource(normalized trailing/). - Compare the 2026-11-01 MCP shape:
mcp.endpoint.url,mode, and ignoreidandgatewayEndpoints. - Normalize the Foundry endpoint to the account root in
plan.py.
Workarounds documented in lab 17
Until this is fixed, the lab tells learners to:
- After the identity phase, create the provider with the CLI's Foundry shortcut, which sets the root endpoint, the managed identity, and the Foundry User role:
az aigateway model-provider create -g <rg> --gateway-name <g> -n foundry-ai-endpoint --foundry-resource-id <account-id> - Create the model with the shortcut, then run
--phase models --execute, which reads it back as "already present with the desired state":
az aigateway model create -g <rg> --gateway-name <g> --provider-name foundry-ai-endpoint -n gpt-5-mini --deployment gpt-5-mini --foundry-resource-id <account-id> - Name each later phase with
--phase(aliases,toolServers,policies,keys), and check the MCP server withaz aigateway mcp showwhen toolServers reports "does not match". - Or skip
applyand have the coding agent write Bicep or Terraform from the settledplan.json. The lab ships a verified reference of both.
- Lenguaje dominante
- Python
- Estrellas
- 18
- Forks
- 9
- Merge medio
- 1 d 16 h
- PR fusionados (30 d)
- 23
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Azure/aigateway
-
How do I use the AI Gateway to route to ADO Remote MCP Server?Posiblemente ocupada @santiagxf la tomó hoy. Abiertoquestion
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
Azure/aigateway#72 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Playground testing to external claude enterprise fails from AI GatewayPosiblemente ocupada @santiagxf la tomó hoy. Abiertoinvestigate
Dificultad 3/5 1-2 días Aptitud para principiantes 53/100
Azure/aigateway#71 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
migrate-apim: partialWhen conditions are declared in the schema and implemented in the planner, and nothing checks the two agreePosiblemente ocupada @santiagxf la tomó hoy. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 57/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
Todos los issues de Azure/aigateway
Issues similares
-
roadmap/v1.3.0 scope/entitlement type/improvement
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
databrickslabs/ontos#1778 ·
Los mantenedores suelen responder en 2 días
-
bug good first issue help wanted up-for-grabs
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
ClickHouse/loom#2075 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: pip install -U cudaq-qec fails with a conflict that names cudaq-qec itselfPosiblemente ocupada @fedonman la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 69/100
StevenBlack/hosts#3314 ·
-
task
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
SparseLinearAlgebra/spla#316 · 1 comentario ·
Los mantenedores suelen responder en 1 día