エラー発生
PowerShellでAzureADへの接続時、以下のエラーが発生した。
($credential = Get-Credentialは実行済み。)
Connect-AzureAD -Credential $credential
Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access 'xxx'.
+ CategoryInfo : 認証エラー: (:) [Connect-AzureAD]AadAuthenticationFailedException
対処法
今回はAzureAD上で多様素認証を有効にしていた。そのため-Credential $credentialは必要なく、単純にConnect-AzureADを実行すると自動で多様素認証の画面が出てくる。
そこで画面に従い必要情報を入力すれば、接続できる。
参考
https://docs.microsoft.com/ja-jp/microsoft-365/enterprise/connect-to-microsoft-365-powershell?view=o365-worldwide
https://nozangyo.com/powershell_office365_setting/
ひと目でわかるOffice 365導入・運用管理編 (マイクロソフト関連書)