Connect-Exchange Online (Error while sending the request)

AW13-2828 10 Reputation points
2023-11-20T10:17:36.3+00:00

Hello,

I'm getting the below Error while connecting to Exchange Online (PowerShell Script) when called from .Net Application.

        #Import-Module ExchangeOnlineManagement
        #Connect-ExchangeOnline -Credential $Creds
An error occurred while sending the request.
At C:\Program 
Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.4.0\netFramework\ExchangeOnlineManagement.psm1:762 char:21
+                     throw $_.Exception.InnerException;
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], HttpRequestException
    + FullyQualifiedErrorId : An error occurred while sending the request.

I've checked the Credentials. Updated the Exchange Online Module. Checked .Net Framework and its Compatible.

I'm using Windows PowerShell 5.1.

Policy is been set to Bypass.

Thanks & Regards

Microsoft Exchange Online
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
547 questions
Microsoft Exchange Hybrid Management
Microsoft Exchange Hybrid Management
Microsoft Exchange: Microsoft messaging and collaboration software.Hybrid Management: Organizing, handling, directing or controlling hybrid deployments.
2,133 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,549 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Mora, Juan-Manuel 0 Reputation points
    2024-02-26T16:10:13.8866667+00:00

    Any steps to solve this issue?

    0 comments No comments

  2. Russ S 20 Reputation points
    2024-03-05T22:39:38.7833333+00:00

    I had the same issue, but was able to solve it by specifying Tls 1.2.

    Add this line:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

    That should get you past that error.


  3. Andre g 6 Reputation points
    2024-05-13T12:15:06.99+00:00

    We tried with registry keys for TLS, with latest updates for Exchange and Windows server.

    The error was fixed temporarely, but now is back in all machines behind our customer network. So I just updated the Sonicwall, but the error persists.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.