Home

O365 Powershell error during global admin credentials validation

%3CLINGO-SUB%20id%3D%22lingo-sub-70599%22%20slang%3D%22en-US%22%3EO365%20Powershell%20error%20during%20global%20admin%20credentials%20validation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-70599%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20are%20using%20Powershell%20script%20for%20validation%20O365%20credentials%20(is%20it%20global%20admin%20O365%20user%20or%20not).%20It%20was%20working%20fine%20for%20all%20cases%20except%20one.%20We%20received%20an%20error%3A%26nbsp%3B%3C%2FP%3E%3CPRE%3EConnect-MsolService%20%3A%20Exception%20of%20type%20%0A'Microsoft.Online.Administration.Automation.MicrosoftOnlineException'%20was%20%0Athrown.%0AAt%20line%3A4%20char%3A1%0A%2B%20Connect-MsolService%20-Credential%20%24cred%0A%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20OperationStopped%3A%20(%3A)%20%5BConnect-MsolService%5D%2C%20Mic%20%0A%20%20%20rosoftOnlineException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%200x800488F2%2CMicrosoft.Online.Administration.Autom%20%0A%20%20%20ation.ConnectMsolService%26nbsp%3B%3C%2FPRE%3E%3CP%3EAlso%2C%20we%20have%20verified%20that%20these%20credentials%20are%20credentials%20of%20O365%20global%20admin%20user%2C%20there%20is%20no%20SSO%20and%20MFA%20enabled%26nbsp%3Bfor%20this%20organization.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPowershell%20module%20is%20up-to-date.%20The%20script%26nbsp%3Bwhich%20is%20executed%20is%20next%3A%3C%2FP%3E%3CPRE%3E'Import-Module%20Microsoft.Online.SharePoint.PowerShell%20-DisableNameChecking%5Cn'%0A'%24cred%20%3D%20New-Object%20-TypeName%20System.Management.Automation.PSCredential%20-ArgumentList'%0A'%20%24username%2C%20%24(convertto-securestring%20%24password%20-AsPlainText%20-Force)%5Cn'%0A'Connect-SPOService%20-Url%20%22%24admin_site_url%22%20-Credential%20%24cred%5Cn'%3C%2FPRE%3E%3CP%3Eand%20we%20are%20passing%20appropriate%20values%20in%20variables.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20it%20possible%20that%20somewhere%20in%20Portal%20Azure%20this%20global%20admin%20user%20has%20disabled%20Powershell%20access%20for%20the%20account%3F%20Or%20this%20organization%20disabled%20Powershell%20access%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-70599%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-101049%22%20slang%3D%22en-US%22%3ERe%3A%20O365%20Powershell%20error%20during%20global%20admin%20credentials%20validation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-101049%22%20slang%3D%22en-US%22%3E%3CP%3ECan%20you%20please%20provide%20more%20info%3F%20And%20a%20suggestion%20you%20could%20use%20pnp%20powershell%20this%20has%20a%20lot%20of%20extra%20functionality%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-100825%22%20slang%3D%22en-US%22%3ERe%3A%20O365%20Powershell%20error%20during%20global%20admin%20credentials%20validation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-100825%22%20slang%3D%22en-US%22%3E%3CP%3EI%20saw%20this%20for%20several%20times.%20The%20exception%20is%20too%20generic.%26nbsp%3BProbably%20wait%20for%20some%20seconds%20or%20minutes%20and%20try%20again%20and%20it%20is%20gone.%20Hope%20my%20experience%20helps%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Yevhen Kryvun
New Contributor

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 
'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was 
thrown.
At line:4 char:1
+ Connect-MsolService -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [Connect-MsolService], Mic 
   rosoftOnlineException
    + FullyQualifiedErrorId : 0x800488F2,Microsoft.Online.Administration.Autom 
   ation.ConnectMsolService 

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?

 

 

 

 

 

2 Replies

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

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
9 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies