Connect-AzAccount interactive login fails on macOS (Apple Silicon): "Interactive requests with mac broker enabled must be executed on the main thread"

Đang mở
#29,941 4 bình luận 5 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.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
csharp, powershell
Lĩnh vực
authentication, cli

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện Connect-AzAccount trên macOS Apple Silicon với Az.Accounts 5.5.1, sau đó so sánh với 5.2.0 và workaround -UseDeviceAuthentication. Theo dõi luồng trình duyệt tương tác và đường dẫn MSAL mac-broker của nó; hoàn tất khi lệnh tiêu chuẩn mở trình duyệt mà không gặp lỗi luồng chính.

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

Mô tả

customer-reported Similar-Issue
Description

Connect-AzAccount (interactive browser flow) fails on macOS with the following error, starting in Az.Accounts 5.5.1:

WARNING: Unable to acquire token for tenant 'organizations' with error
'InteractiveBrowserCredential authentication failed: Interactive requests
with mac broker enabled must be executed on the main thread on macOS.'
Connect-AzAccount: InteractiveBrowserCredential authentication failed:
Interactive requests with mac broker enabled must be executed on the main
thread on macOS.
Environment
  • Az.Accounts version (broken): 5.5.1
  • Az.Accounts version (last known good): 5.2.0
  • OS: macOS (Apple Silicon)
  • PowerShell: 7.6.4 (pwsh)
  • Shell/terminal: zsh, running inside Ghostty
Steps to reproduce
  1. Install Az.Accounts 5.5.1 (via Install-Module -Name Az -Repository PSGallery)
  2. Run Connect-AzAccount
  3. Observe the error above instead of a browser window opening
Expected behavior

Interactive browser login opens as it did on 5.2.0.

Workaround found

Downgrading fixes it:

Uninstall-Module Az.Accounts -AllVersions -Force
Install-Module -Name Az.Accounts -RequiredVersion 5.2.0 -Repository PSGallery -Force -AllowClobber

Connect-AzAccount -UseDeviceAuthentication also works around it without downgrading, but the standard interactive flow should not require this.

Additional notes

This appears to be caused by the MSAL mac-broker interactive auth path requiring main-thread execution, which isn't guaranteed when pwsh is run from a non-default terminal host.


Duplicate of #29940 (filed from a different account by mistake; leaving that one open too so a maintainer can dedupe).

Ngôn ngữ chính
C#
Star
4.8k
Fork
4.3k
Merge trung bình
2 ngày 18 giờ
Pull request đã merge (30 ngày)
91

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-powershell

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

Issue tương tự

Thêm issue về C#

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.