question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Connect to Office 365 with Powershell from non-Windows

See original GitHub issue

Steps to reproduce

$credential = get-credential
New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection

Expected behavior


Actual behavior

New-PSSession : [outlook.office365.com] Connecting to remote server outlook.office365.com failed with the following error message : MI_RESULT_FAILED For more information, see 
the about_Remote_Troubleshooting Help topic.
At line:1 char:12
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : 1,PSSessionOpenFailed

Environment data

> $PSVersionTable
Name                           Value                                                                                                                                             
----                           -----                                                                                                                                             
PSVersion                      6.0.0-beta.8                                                                                                                                      
PSEdition                      Core                                                                                                                                              
GitCommitId                    v6.0.0-beta.8                                                                                                                                     
OS                             Linux 4.4.0-97-generic #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017                                                                               
Platform                       Unix                                                                                                                                              
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                           
PSRemotingProtocolVersion      2.3                                                                                                                                               
SerializationVersion           1.1.0.1                                                                                                                                           
WSManStackVersion              3.0 

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:29 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JoeJePropellercommented, Aug 26, 2022

Similar issue when trying to run the following: Invoke-Command -ComputerName 10.0.0.4 -Credential domain\administrator -ScriptBlock {write-host 123} -authentication kerberos -usessl

I end up with the following returned:

OpenError: [10.0.0.4] Connecting to remote server 10.0.0.4 failed with the following error message : MI_RESULT_FAILED For more information, see the about_Remote_Troubleshooting Help topic.

$PSVersionTable:

Name                           Value
----                           -----
PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Linux 5.4.0-120-generic #136-Ubuntu SMP Fri Jun 10 13:40:48 UTC 2022
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

This is being ran from a Docker image. Dockerfile:

FROM mcr.microsoft.com/powershell:latest

RUN pwsh -Command 'Install-Module -Name PSWSMan -Force -Scope AllUsers'
RUN pwsh -Command 'Install-WSMan'


SHELL ["pwsh", "-Command"]
1reaction
andrew951commented, Oct 20, 2017

@SBiliarski if it’s urgent, you can install PS Version 6 beta 6. It is working in that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access is denied when you connect to Exchange Online ...
Solution · Sign in to the Microsoft 365 portal (https://portal.office.com) as an administrator. · Click Admin, and then click Exchange. · Click ...
Read more >
Connect to Microsoft 365 with PowerShell
Connect to your Microsoft 365 tenant by using PowerShell for Microsoft 365 to do admin center tasks from the command line.
Read more >
Can not connect to Office 365 / Exchange Online with ...
Install PowerShell 6.0.0-rc on macOS 10.12 or 10.13. Use Get-Credential to get an Office 365 administrator credential and then use New-PSSession ...
Read more >
Connect to Office 365 with PowerShell Core from non-Windows
I was asked: “Do you use the native macOS PowerShell to connect to Office 365”. The short answer is: “Not really”!
Read more >
Error Connecting To Exchange Online Powershell
Solved. Microsoft Office 365 Microsoft Exchange. I recently installed an update to the MIcrosoft Exchange ONline POwershell module.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found