Exception: Microsoft.Online.Administration.Automation.MicrosoftOnlineException

%3CLINGO-SUB%20id%3D%22lingo-sub-271930%22%20slang%3D%22en-US%22%3EException%3A%20Microsoft.Online.Administration.Automation.MicrosoftOnlineException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-271930%22%20slang%3D%22en-US%22%3E%3CP%3EDear%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20facing%20one%20of%20a%20weird%20issue%20while%20connecting%20Azure%20AD%20using%20Connect-MSolservice.%20Attaching%20the%20PowerShell%20log%20for%20your%20reference.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20let%20me%20know%20if%20anyone%20else%20has%20faced%20a%20similar%20issue.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%2C%3CBR%20%2F%3ERahul%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-271930%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-358171%22%20slang%3D%22en-US%22%3ERe%3A%20Exception%3A%20Microsoft.Online.Administration.Automation.MicrosoftOnlineException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-358171%22%20slang%3D%22en-US%22%3E%3CP%3EI%20understand%20your%20concern%3B%20hence%2C%20the%20importance%20of%20documenting%20changes.%3C%2FP%3E%3CP%3EA%20system%20as%20large%20and%20complex%20as%20Windows%20will%20never%20be%20perfect.%3C%2FP%3E%3CP%3ESo%2C%20hand-jammed%20tweaks%20to%20settings%20may%20be%20required%20to%20get%20a%20system%20%2F%20component%20to%20work%20...again...%20until%20a%20permanent%20solution%20is%20incorporated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EStill%20a%20pain%20nonetheless.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-358036%22%20slang%3D%22en-US%22%3ERe%3A%20Exception%3A%20Microsoft.Online.Administration.Automation.MicrosoftOnlineException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-358036%22%20slang%3D%22en-US%22%3E%3CP%3EIt%20worries%20me%20putting%20in%20a%20reg%20key%20like%20that%2C%20as%20what%20happens%20oneday%20when%20something%20else%20changes%20and%20this%20'custom%20fix'%20breaks%20something%20new.%20As%20built%20doco%20reflects%20this%20for%20us%20now%20to%20reference%2C%20but%20this%20seems%20unworkable%20from%20microsoft%20on%20a%20large%20scale.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357729%22%20slang%3D%22en-US%22%3ERe%3A%20Exception%3A%20Microsoft.Online.Administration.Automation.MicrosoftOnlineException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357729%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20sharing%20this%20tip.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357404%22%20slang%3D%22en-US%22%3ERe%3A%20Exception%3A%20Microsoft.Online.Administration.Automation.MicrosoftOnlineException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357404%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20fixed%20mine%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.crammysblog.com%2Fthe-pain-of-tls-1-2-with-powershell-module-for-azure-active-directory-msonline%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.crammysblog.com%2Fthe-pain-of-tls-1-2-with-powershell-module-for-azure-active-directory-msonline%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EReally%20stupid%20issue%2C%20having%20to%20force%20TLS%201.2%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-275143%22%20slang%3D%22en-US%22%3ERe%3A%20Exception%3A%20Microsoft.Online.Administration.Automation.MicrosoftOnlineException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-275143%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you!%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EI%20finally%20figured%20out%20the%20issue.%20I%20checked%20the%20log%20again%20and%20find%20below%20error%20message%20--%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESystem.Net.WebException%20-%20The%20remote%20server%20returned%20an%20error%3A%20(407)%20Proxy%20Authentication%20Required.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EProxy%20was%20rejecting%20the%20PowerShell%20Web%20request.%20The%20issue%20got%20fixed%20after%20setting%20the%20proxy%20using%20below%20commands%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20netsh%20winhttp%20show%20proxy%3C%2FP%3E%3CP%3ECheck%20the%20current%20proxy%20setting%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Enetsh%20winhttp%20import%20proxy%20source%3Die%3C%2FP%3E%3CP%3ESet%20the%20IE%20as%20a%20source%20for%20proxy%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E--%20Rahul%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-275107%22%20slang%3D%22en-US%22%3ERe%3A%20Exception%3A%20Microsoft.Online.Administration.Automation.MicrosoftOnlineException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-275107%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%2C%20Vasil!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWell!%20To%20check%20if%20anything%20blocking%20the%20HTTP%20traffic%2C%20I%20tried%20to%20log%20in%20using%20office%20365%20services%20using%20IE%20and%20it's%20working%20fine.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20will%20try%20to%20remove%20and%20reinstall%20MSOnline%20module%20and%20try%20again.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E--%20Rahul%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-272141%22%20slang%3D%22en-US%22%3ERe%3A%20Exception%3A%20Microsoft.Online.Administration.Automation.MicrosoftOnlineException%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-272141%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20seem%20to%20have%20issues%20reaching%20the%20relevant%20endpoint%20(%3CA%20href%3D%22https%3A%2F%2Fprovisioningapi.microsoftonline.com%2Fprovisioningwebservice.svc%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fprovisioningapi.microsoftonline.com%2Fprovisioningwebservice.svc%3C%2FA%3E%20)%2C%20so%20make%20sure%20your%20proxy%2Ffirewall%20is%20not%20blocking%20the%20connection.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Dear All,

 

I am facing one of a weird issue while connecting Azure AD using Connect-MSolservice. Attaching the PowerShell log for your reference. 

 

Please let me know if anyone else has faced a similar issue. 

 

Thank you,
Rahul 

7 Replies
Highlighted

You seem to have issues reaching the relevant endpoint (https://provisioningapi.microsoftonline.com/provisioningwebservice.svc ), so make sure your proxy/firewall is not blocking the connection.

Highlighted

Thank you, Vasil!

 

Well! To check if anything blocking the HTTP traffic, I tried to log in using office 365 services using IE and it's working fine.

 

I will try to remove and reinstall MSOnline module and try again.

 

-- Rahul 

Highlighted

Thank you!

I finally figured out the issue. I checked the log again and find below error message -- 

 

System.Net.WebException - The remote server returned an error: (407) Proxy Authentication Required.

 

Proxy was rejecting the PowerShell Web request. The issue got fixed after setting the proxy using below commands

 

1. netsh winhttp show proxy

Check the current proxy setting 

 

netsh winhttp import proxy source=ie

Set the IE as a source for proxy 

 

-- Rahul 

Highlighted
Highlighted
Highlighted

It worries me putting in a reg key like that, as what happens oneday when something else changes and this 'custom fix' breaks something new. As built doco reflects this for us now to reference, but this seems unworkable from microsoft on a large scale.

Highlighted

I understand your concern; hence, the importance of documenting changes.

A system as large and complex as Windows will never be perfect.

So, hand-jammed tweaks to settings may be required to get a system / component to work ...again... until a permanent solution is incorporated.

 

Still a pain nonetheless.