[Issue] azd deploy fails with "multiple Azure Bots are bound to the same MsaAppID" because botServices list API returns duplicate entries

Abierto Apto para principiantes
#10,333 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #10367 de @mvanhorn — cerrado sin fusionar

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
70/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go
Área
cli

Línea de trabajo

Busca en el código base el mensaje de error 'Resolving Activity bot configuration' para localizar el código que gestiona el servicio del bot. Añade la eliminación de duplicados de la lista botServices por ID de recurso (sin distinguir entre mayúsculas y minúsculas) antes de la comprobación de MsaAppID. Verifica la corrección ejecutando las pruebas pertinentes del servicio del bot o reproduciendo el escenario de deploy.

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

Descripción

agentic bug customer-reported ext-agents
  • Make sure you've installed the latest version using instructions

Output from azd version

azd version 1.35.0 (commit 170ebb858071da353cc9bf8657a377bff268ba36) (stable)

Extension: azure.ai.agents 1.0.0-beta.18 (also reproduced with azd 1.34.2 + azure.ai.agents 1.0.0-beta.17)

Describe the bug
azd deploy for a hosted agent with the Activity protocol always fails in the step "Resolving Activity bot configuration":

ERROR: botservice: multiple Azure Bots are bound to the same MsaAppID
Suggestion: keep only one Azure Bot bound to this MsaAppID, then retry

Only one Azure Bot is bound to that MsaAppID. The cause appears to be that the Bot Service list endpoint returns every bot twice, and the extension does not deduplicate the results by resource ID before the MsaAppID check.

  1. Only one bot uses the MsaAppID (Resource Graph). This query returns count: 1; all other bots in the subscription have different MsaAppIDs:

    resources
    | where type =~ 'microsoft.botservice/botservices'
    | where tolower(tostring(properties.msaAppId)) == '<agent-instance-identity-client-id>'
    
  2. The botServices list API returns every bot twice:

    az rest --method get --url "https://management.azure.com/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.BotService/botServices?api-version=2022-09-15"
    
    • Result: 2N entries for N distinct resource IDs. Every bot in the resource group appears twice with an identical id and etag, not only the agent's bot.
    • The subscription-level list (/subscriptions/<sub>/providers/Microsoft.BotService/botServices) behaves the same way.
    • It happens with all available api-versions: 2017-12-01, 2018-07-12, 2020-06-02, 2021-03-01, 2021-05-01-preview, 2022-06-15-preview, 2022-09-15, 2023-09-15-preview.
    • nextLink is empty, so this is not a paging overlap.

    Example (the agent's bot):

    /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.BotService/botServices/<agent>-bot-xxxxxxxx | location=global | etag="<same-etag>"
    /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.BotService/botServices/<agent>-bot-xxxxxxxx | location=global | etag="<same-etag>"
    
  3. Setting the bot name explicitly does not help. After azd env set AGENT_<NAME>_BOT_NAME <existing-bot-name> (the existing azd-created bot), the deploy still fails with the same error. AGENT_<NAME>_BOT_OWNED=true and AGENT_<NAME>_BOT_RESOURCE_GROUP were already set.

The hosted agent itself is updated before the failure (new agent versions are created and become active), so in practice only the exit code is wrong. However, this breaks scripted/CI deploys, and there is no option to skip the bot step.

To Reproduce

  1. Deploy a hosted agent with protocols responses + activity via azd deploy (code deploy). The Azure Bot is created by azd on the first deploy (tag azd-created, kind: azurebot, location: global, msaAppType: SingleTenant).
  2. Make sure the botServices list endpoint for the resource group/subscription returns duplicate entries (see the az rest call above).
  3. Run azd deploy --no-prompt again.
  4. The deploy fails at "Resolving Activity bot configuration" with botservice: multiple Azure Bots are bound to the same MsaAppID.

Expected behavior

  • The extension deduplicates the bot list by resource ID (case-insensitive) before counting bots bound to the MsaAppID, and the deploy succeeds by reusing the existing bot.
  • Optionally, a way to skip Activity bot resolution on deploy when the bot already exists (e.g. AZD_AGENT_SKIP_BOT=true), similar to AZD_AGENT_SKIP_ACR / AZD_AGENT_SKIP_ROLE_ASSIGNMENTS.

Environment
Information on your environment:
* Language name and version: Python 3.13 (hosted agent runtime python_3_13, code deploy with remote_build)
* IDE and version: N/A, azd run from PowerShell on Windows

Additional context

  • The duplicate list entries are probably also a Bot Service API issue. I'm reporting it here because the extension could easily be robust against it.
  • The current suggestion ("keep only one Azure Bot bound to this MsaAppID" / "remove that Bot") points users toward deleting a production bot that is actually unique.
Lenguaje dominante
Go
Estrellas
573
Forks
387
Merge medio
2 d 20 h
PR fusionados (30 d)
196

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Azure/azure-dev

Todos los issues de Azure/azure-dev

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.