Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

on-prem Dynamics PowerShell error

Posted on by 30

Hi Guys,

When I try to run any Dynamics commands on PowerShell, I get "The underlying connection was closed: an unexpected error occurred ". Anyone seen this or have idea why this is happening? 

Thank you

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: on-prem Dynamics PowerShell error

    This problem occurs when the server or another network device unexpectedly closes an existing Transmission Control Protocol (TCP) connection. Analyze the server logs to see if this may be the issue.

  • Suggested answer
    DipakAch Profile Picture
    DipakAch 30 on at
    RE: on-prem Dynamics PowerShell error

    All, I was able to fix this error by replacing actual cert SAN to the field Deployment Web Service URL under Dynamics 365 Deployment manager. Hope this helps someone :)

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: on-prem Dynamics PowerShell error

    Hi DipakAch,

    Dynamics 365 (online) version 9.x and Dynamics 365 (online) Government version 8.2, requires that connections to customer engagement applications are secured by TLS 1.2 (or better) security.

    Try including the below line in your Powershell Script before you call Get-CrmConnection.

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans