I have made one script in which i need to connect the connect-exchangeonline and connect-msolservice. I am using the MFA credential to connect these services
Is there anyway where we can connect these two services with single credential or can we save the MFA credential in variable from where we can use to connect both services?
Thanks in advance
CodePudding user response:
$acctName="<UPN of the account, such as [email protected]>"
$orgName="<for example, litwareinc for litwareinc.onmicrosoft.com>"
#Azure Active Directory
Connect-MsolService
#Exchange Online
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName $acctName -ShowProgress $true
