0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Azure CLI/PowerShellの接続時における認証画面のトラブル対処方法 「すべてのアプリにサインインしたままにする」画面でOKボタンが表示されない場合の解決策

Last updated at Posted at 2025-02-26

本記事で扱う事象

以下のコマンドでAzureへ接続する際に発生する認証画面のトラブルについて説明します:

  • Azure CLI: az login
  • Azure PowerShell: Connect-AzAccount

発生する問題:

  • 認証画面で[すべてのアプリにサインインしたままにする]のダイアログが表示される
  • [OK]ボタンが表示されず、先に進めない

下記のスクリーンショットの状態となります。

wam2.png

対処方法

ともに Web Account Manager (WAM) を無効とすることで、[すべてのアプリにサインインしたままにする]を表示せず、Azureへ接続を行うことが可能です。

  • Azure CLI の場合

下記コマンドで WAM を無効にします

az config set core.enable_broker_on_windows=false

この状態で az login を実行すると、ブラウザが開きAzureへの接続を試みます。
そちらで認証をおこなうことで Azure への接続が可能です。

詳しくはAzure CLI を使用した対話形式でのサインインのWindows で Web アカウント マネージャー (WAM) を使用してサインインするを参照してください。

  • Azure PowerShell の場合

下記コマンドで WAM を無効にします

Update-AzConfig -EnableLoginByWam $false

この状態で Connect-AzAccount を実行すると、ブラウザが開きAzureへの接続を試みます。
そちらで認証をおこなうことで Azure への接続が可能です。

なお、単純に Connect-AzAccount コマンドレットを実行した場合、下記のように警告が表示される場合があります。

PS C:\Users\xxxx> Connect-AzAccount
Please select the account you want to login with.

Retrieving subscriptions for the selection...
警告: Unable to acquire token for tenant 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with error 'Authentication failed
against tenant xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. User interaction is required. This may be due to the conditional
access policy settings such as multi-factor authentication (MFA). If you need to access subscriptions in that tenant,
please rerun 'Connect-AzAccount' with additional parameter '-TenantId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.'

[Announcements]
With the new Azure PowerShell login experience, you can select the subscription you want to use more easily. Learn more about it and its configuration at https://go.microsoft.com/fwlink/?linkid=2271909.

If you encounter any problem, please open an issue at: https://aka.ms/azpsissue

アクセストークンが必要な場合のコマンドレットを実行する際には、下記のようにテナント ID を指定して接続を行ってください。

Connect-AzAccount -Tenant xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

詳しくは
Azure PowerShell に対話形式でサインインするWeb アカウント マネージャー (WAM)を参照してください。

注意事項

  • この設定変更はローカル環境にのみ影響します
  • セキュリティ要件によっては、WAMを無効化できない環境もある可能性があります
  • この対処方法は一時的な回避策であり、根本的な解決には組織の認証設定の確認が必要な場合があります

トラブルシューティング

WAMを無効化しても接続できない場合は、以下を確認してください:

  • ブラウザのポップアップブロックが有効になっていないか
  • プロキシ設定が正しく構成されているか
  • Azure CLIまたはAzure PowerShellが最新バージョンにアップデートされているか

対処前の状態に戻す方法

Web アカウント マネージャー (WAM)を有効に戻すには以下を実行してください。

  • Azure CLI の場合
az config set core.enable_broker_on_windows=true
  • Azure PowerShell の場合
Update-AzConfig -EnableLoginByWam $true

補足

本来はWAMが有効であるべきと考えられますので、本手順は恒久対策ではなく暫定対処とお考え下さい。

参考情報

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?