# Elastic Search 7 on Microsoft Azure Connection Failure

**URL:** <https://discuss.elastic.co/t/elastic-search-7-on-microsoft-azure-connection-failure/312407>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [August 18, 2022, 7:52pm UTC](https://discuss.elastic.co/t/elastic-search-7-on-microsoft-azure-connection-failure/312407 "2022-08-18T19:52:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JSK1304](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@JSK1304](https://discuss.elastic.co/u/JSK1304)\
**Post date:** [August 18, 2022, 7:52pm UTC](https://discuss.elastic.co/t/elastic-search-7-on-microsoft-azure-connection-failure/312407/1 "2022-08-18T19:52:51Z")

</div>

I am new to Elasticsearch and I have created a 1 node Elasticsearch cluster in Microsoft Azure using the "Elastic Stack" template.  
But I am not able to connect to the cluster using connection pool or using a single node connection.  
var uris = new  
{  
new Uri("[https://hide.dev.es.canadacentral.azure.elastic-cloud.com:9243](https://hide.dev.es.canadacentral.azure.elastic-cloud.com:9243)")  
};

var connectionPool = new SniffingConnectionPool(uris);

```
        var settings = new ConnectionSettings(connectionPool)
            .SniffOnConnectionFault(false)
            .SniffOnStartup(false)
            .RequestTimeout(TimeSpan.FromSeconds(500))
            .PingTimeout(TimeSpan.FromSeconds(500))
            .MaximumRetries(5)
            .DefaultIndex("people");

        var client = new ElasticClient(settings);

```

Getting the below error

Invalid NEST response built from a unsuccessful (401) low level call on HEAD: /Preformatted text

# Audit trail of this API call:

- [1] PingFailure: Node: {URL} Exception: PipelineException Took: 00:00:01.2884735

# OriginalException: Elasticsearch.Net.ElasticsearchClientException: Failed to ping the specified node.. Call: Status code 401 from: HEAD / ---\> Elasticsearch.Net.PipelineException: Failed to ping the specified node. ---\> Elasticsearch.Net.PipelineException: Could not authenticate with the specified node. Try verifying your credentials or check your Shield configuration. ---\> System.Net.WebException: The remote server returned an error: (401) Unauthorized.

at System.Net.HttpWebRequest.GetResponse()  
at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData)  
--- End of inner exception stack trace ---  
at Elasticsearch.Net.RequestPipeline.ThrowBadAuthPipelineExceptionWhenNeeded(IApiCallDetails details, IElasticsearchResponse response)  
at Elasticsearch.Net.RequestPipeline.Ping(Node node)  
--- End of inner exception stack trace ---  
at Elasticsearch.Net.RequestPipeline.Ping(Node node)  
at Elasticsearch.Net.Transport`1.Ping(IRequestPipeline pipeline, Node node) at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)  
--- End of inner exception stack trace ---

# Audit exception in step 1 PingFailure:

Elasticsearch.Net.PipelineException: Could not authenticate with the specified node. Try verifying your credentials or check your Shield configuration. ---\> System.Net.WebException: The remote server returned an error: (401) Unauthorized.  
at System.Net.HttpWebRequest.GetResponse()  
at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData)  
--- End of inner exception stack trace ---  
at Elasticsearch.Net.RequestPipeline.ThrowBadAuthPipelineExceptionWhenNeeded(IApiCallDetails details, IElasticsearchResponse response)  
at Elasticsearch.Net.RequestPipeline.Ping(Node node)

# Request:

\<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.\>

# Response:

\<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.\>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 15, 2022, 7:52pm UTC](https://discuss.elastic.co/t/elastic-search-7-on-microsoft-azure-connection-failure/312407/2 "2022-09-15T19:52:57Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
