We have several tenants using office 365. One of these was locked down by an employee who is no longer with the company. I need to connect to it using PowerShell to make some changes.
I am using an account which is a global admin and an Exchange admin. I have tried from my computer and from a computer on the local network and whatever I have tried I get the following error message:
New-PSSession : [outlook.office365.com] Connecting to remote server outlook.office365.com failed with the following error message : Access is denied. For more
information, see the about_Remote_Troubleshooti
ng Help topic.
At line:4 char:12
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~
~~~~~~~~~~
~~~~~~~~~~
~~
+ CategoryInfo : OpenError: (System.Manageme....Remote
Runspace:R
emoteRunsp
ace) [New-PSSession], PSRemotingTransportExcepti
on
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpen
Failed
Import-PSSession : Cannot validate argument on parameter 'Session'. The argument is null. Provide a valid value for the argument, and then try running the command again.
At line:5 char:18
+ Import-PSSession $Session -DisableNameChecking
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Import-PSSession], ParameterBindingValidation
Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio
nError,Mic
rosoft.Pow
erShell.Co
mmands.Imp
ortPSSessi
onCommand
Here are the Powershell commands I am using. They work connecting to other tenants
$adminUPN="GlobalAdmin@myc
o.com"
$orgName="My Company"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type Password"
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri
https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
Any suggestions would be appreciated.
Can you say if the user has Multi Factor Authenticator Enabled or not?
Jose