'Azure PowerShell Connect-AzureAD and Connect-MsolService both with MFA connect
i use a script to connect AzureAD and MsolService.
Connect-AzureAD
Connect-MsolService
and it ask me both for username, password, and telephone verification.
Is there a way to only enter the information once ?
Solution 1:[1]
If you are not using graph like @AdminofThings said, then you will be prompted with MFA (Password + telephone verification) every time you connect to a service. Since you are connecting to 2 services MSOL and Azure it will prompt you for MFA twice.
Solution 2:[2]
If the credentials are the same:
$Credential = Get-Credential
Connect-AzureAD -Credential $Credential
Connect-MsolService -Credential $Credential
As per:
Microsoft Docs | Connect-AzureAD Examples
and
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dharman |
Solution 2 |