Skip to content

Connect-CrmOnline - intermittent connection failure  #520

@ryan950ng

Description

@ryan950ng

Hi,

I am using the Connect-CrmOnline to connect to the server in my Gitlab pipeline, but the connection will fail intermittently.
Sometimes it works after a few retry.

    Import-Module Microsoft.Xrm.Data.PowerShell
    Set-CrmConnectionTimeout -TimeoutInSeconds 600
    $conn.OrganizationWebProxyClient.Endpoint.Binding.SendTimeout.TotalMinutes
    
    Connect-CrmOnline -ConnectionTimeoutInSeconds 600 -ClientSecret $oAuthClientSecret -OAuthClientId $oAuthClientId -ServerUrl $CRMDestinationUrl

This is the error returned:

WARNING: Please reconnect to the service after setting the connection timeout or the new timeout will *not* be used for
 operations.
IsReady                             : False
IsBatchOperationsAvailable          : False
MaxRetryCount                       : 10
RetryPauseTime                      : 00:00:05
Authority                           : 
ActiveAuthenticationType            : ClientSecret
OAuthUserId                         : 
TenantId                            : 00000000-0000-0000-0000-000000000000
EnvironmentId                       : 
ConnectedOrgId                      : 00000000-0000-0000-0000-000000000000
CrmConnectOrgUriActual              : https://[Masked]/XRMServices/2011/Organization.svc
ConnectedOrgFriendlyName            : 
ConnectedOrgUniqueName              : 
ConnectedOrgVersion                 : 
SdkVersionProperty                  : 9.2.47.9489
CallerId                            : 00000000-0000-0000-0000-000000000000
CallerAADObjectId                   : 
DisableCrossThreadSafeties          : False
SessionTrackingId                   : 
ForceServerMetadataCacheConsistency : False
LastCrmError                        : One or more errors occurred. => An error occurred while sending the request. => 
                                      Unable to connect to the remote server => A connection attempt failed because 
                                      the connected party did not properly respond after a period of time, or 
                                      established connection failed because connected host has failed to respond 
                                      40.119.215.132:443ERROR REQUESTING Token FROM THE Authentication context - 
                                      General ADAL Error
                                      One or more errors occurred. => An error occurred while sending the request. => 
                                      Unable to connect to the remote server => A connection attempt failed because 
                                      the connected party did not properly respond after a period of time, or 
                                      established connection failed because connected host has failed to respond 
                                      40.119.215.132:443One or more errors occurred. => An error occurred while 
                                      sending the request. => Unable to connect to the remote server => A connection 
                                      attempt failed because the connected party did not properly respond after a 
                                      period of time, or established connection failed because connected host has 
                                      failed to respond 40.119.215.132:443Unable to connect to CRM: An error occurred 
                                      while sending the request.
                                      One or more errors occurred. => An error occurred while sending the request. => 
                                      Unable to connect to the remote server => A connection attempt failed because 
                                      the connected party did not properly respond after a period of time, or 
                                      established connection failed because connected host has failed to respond 
                                      40.119.215.132:443Unable to Login to Dynamics CRM
                                      Unable to Login to Dynamics CRMOrganizationWebProxyClient is null
                                      OrganizationWebProxyClient is null
An error has occurred: One or more errors occurred. => An error occurred while sending the request. => Unable to connect to the remote server => A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 40.119.215.132:443ERROR REQUESTING Token FROM THE Authentication context - General ADAL Error
One or more errors occurred. => An error occurred while sending the request. => Unable to connect to the remote server => A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 40.119.215.132:443One or more errors occurred. => An error occurred while sending the request. => Unable to connect to the remote server => A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 40.119.215.132:443Unable to connect to CRM: An error occurred while sending the request.
One or more errors occurred. => An error occurred while sending the request. => Unable to connect to the remote server => A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 40.119.215.132:443Unable to Login to Dynamics CRM
Unable to Login to Dynamics CRMOrganizationWebProxyClient is null
OrganizationWebProxyClient is null************ NullReferenceException - ExecuteAsync : AsyncImportRequest |=> Object reference not set to an instance of an object.
Object reference not set to an instance of an object.[TerminalFailure] Failed to Execute Command - ExecuteAsync : RequestID=[Masked] : AsyncImportRequest duration=00:00:00.0117927 ExceptionMessage = Object reference not set to an instance of an object.
Object reference not set to an instance of an object.

The confusing part is due to the intermittent failure, and I have tried timeout and it's still having the same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions