簡體   English   中英

Connect-AzAccount 更改瀏覽器

[英]Connect-AzAccount change browser

當我運行 Connect-AzAccount 時,我在 windows OS(Chrome) 上設置的默認瀏覽器沒有運行。 但相反,它正在加載 IE 並詢問登錄詳細信息。 怎么換瀏覽器?

彈出的window不是默認瀏覽器,只有az login通過瀏覽器登錄。

az login中,如果要在任何瀏覽器中登錄,請通過az login --use-device-code

在此處輸入圖像描述

Connect-AzAccount中,默認打開的頁面仍然是 powershell 工具,它不是瀏覽器,在任務管理器中可以清楚的看到下面的 gif。

步驟 1. 在 powershell 中運行Connect-AzAccount AzAccount。

在此處輸入圖像描述

步驟 2. 檢查任務管理器。

在此處輸入圖像描述

建議

無需瀏覽器即可登錄 azure

Connect-AzAccount -Credential $Credential -Tenant $tenant -Subscription $subscription

更多詳情,您可以參考帖子。

Connect-AzAccount - 如何避免 azure 設備身份驗證?

在我的公司,我們為 Azure AD 帳戶使用 MFA。 此外,我們的本地 AD 未與 Azure AD 集成。 And to make it more challenging, we use our local AD account (first.last@company.com) to authenticate to Azure DevOps while we use our Azure AD account (first.last@admin.company.com) to authenticate to the Azure資源管理器 API。

每次我嘗試使用Connect-AzAccount在 PowerShell 中使用我的 Azure AD 帳戶 (first.last@admin.company.com) 進行身份驗證時,它都會像使用我的本地 AD 帳戶 (first.last@company.com) 一樣進行身份驗證,而不是.

我嘗試了通常的命令無濟於事:

Disconnect-AzAccount
Clear-AzContext -Scope CurrentUser -Force
Disable-AzContextAutosave -Scope Process

我嘗試在 Internet Explorer 中刪除歷史記錄,但沒有骰子。

我將筆記本電腦上的默認瀏覽器從 Chrome 更改為 Edge,並在 Edge 中刪除了歷史記錄。 沒有影響。 PowerShell 似乎仍在使用相同的引擎來管理交互式 Azure 登錄頁面,無論操作系統使用什么默認瀏覽器。

我研究了如何更改 PowerShell 使用的瀏覽器來管理交互式 Azure 登錄頁面 ( Connect-AzAccount ) 以解決該問題。 但我沒有任何運氣找到解決方案。

以下是最終在我的場景中起作用的方法:

Disconnect-AzAccount
Connect-AzAccount -UseDeviceAuthentication

當您使用-UseDeviceAuthentication選項時, Connect-AzAccount允許您手動選擇要用於 Azure 身份驗證的瀏覽器。

就我而言,我在隱身模式下使用 Chrome 執行 Azure 身份驗證,我終於能夠使用我的 Azure AD 帳戶(“first.last@admin.company.com”)成功進行身份驗證。

盡管這不會更改 Connect-AzAccount 使用的默認瀏覽器,但可以讓您手動選擇不同的瀏覽器進行 Azure 身份驗證。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM