migrate-apim: against CLI 1.0.0b34, provider and model creates are rejected, read-backs never match, and the Foundry endpoint 404s
I maintainer di solito rispondono entro 1 giorno
@santiagxf ci sta già lavorando.
Dal 17/11/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 18
- Fork
- 9
- Merge medio
- 1g 16h
- PR unite (30g)
- 23
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Azure/aigateway
-
How do I use the AI Gateway to route to ADO Remote MCP Server?Forse già presa @santiagxf l’ha presa oggi. Apertaquestion
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
Azure/aigateway#72 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Playground testing to external claude enterprise fails from AI GatewayForse già presa @santiagxf l’ha presa oggi. Apertainvestigate
Difficoltà 3/5 1-2 giorni Idoneità per principianti 53/100
Azure/aigateway#71 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
migrate-apim: partialWhen conditions are declared in the schema and implemented in the planner, and nothing checks the two agreeForse già presa @santiagxf l’ha presa oggi. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Azure/aigateway
Issue simili
-
roadmap/v1.3.0 scope/entitlement type/improvement
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
databrickslabs/ontos#1778 ·
I maintainer di solito rispondono entro 2 giorni
-
bug good first issue help wanted up-for-grabs
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/loom#2075 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: pip install -U cudaq-qec fails with a conflict that names cudaq-qec itselfForse già presa @fedonman l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 69/100
StevenBlack/hosts#3314 ·
-
task
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
SparseLinearAlgebra/spla#316 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno