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

Đang mở Phù hợp với người mới
#10,333 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #10367 của @mvanhorn — đã đóng, không merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
cli

Hướng nghiên cứu

Tìm kiếm trong codebase thông báo lỗi 'Resolving Activity bot configuration' để xác định đoạn mã xử lý dịch vụ bot. Thêm bước loại bỏ trùng lặp trong danh sách botServices theo ID tài nguyên (không phân biệt chữ hoa chữ thường) trước khi kiểm tra MsaAppID. Xác minh bản sửa bằng cách chạy các bài kiểm thử dịch vụ bot liên quan hoặc tái hiện tình huống deploy.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Go
Star
573
Fork
387
Merge trung bình
2 ngày 20 giờ
Pull request đã merge (30 ngày)
196

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Azure/azure-dev

Tất cả issue của Azure/azure-dev

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.