We are using Powershell script for validation O365 credentials (is it global admin O365 user or not). It was working fine for all cases except one. We received an error:
Connect-MsolService : Exception of type
At line:4 char:1
+ Connect-MsolService -Credential $cred
+ CategoryInfo : OperationStopped: (:) [Connect-MsolService], Mic
+ FullyQualifiedErrorId : 0x800488F2,Microsoft.Online.Administration.Autom
Also, we have verified that these credentials are credentials of O365 global admin user, there is no SSO and MFA enabled for this organization.
Powershell module is up-to-date. The script which is executed is next:
'Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking\n'
'$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList'
' $username, $(convertto-securestring $password -AsPlainText -Force)\n'
'Connect-SPOService -Url "$admin_site_url" -Credential $cred\n'
and we are passing appropriate values in variables.
Is it possible that somewhere in Portal Azure this global admin user has disabled Powershell access for the account? Or this organization disabled Powershell access?
I saw this for several times. The exception is too generic. Probably wait for some seconds or minutes and try again and it is gone. Hope my experience helps you.
Can you please provide more info? And a suggestion you could use pnp powershell this has a lot of extra functionality