# Getting error while establishing connection with MQTT on Azure Container :tlsv13 alert certificate required

**URL:** <https://community.hivemq.com/t/getting-error-while-establishing-connection-with-mqtt-on-azure-container-tlsv13-alert-certificate-required/3338>\
**Category:** HiveMQ Cloud\
**Created:** [November 15, 2024, 7:24am UTC](https://community.hivemq.com/t/getting-error-while-establishing-connection-with-mqtt-on-azure-container-tlsv13-alert-certificate-required/3338 "2024-11-15T07:24:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhargav.better](https://avatars.discourse-cdn.com/v4/letter/b/a3d4f5/32.png) [@bhargav.better](https://community.hivemq.com/u/bhargav.better)\
**Post date:** [November 15, 2024, 7:24am UTC](https://community.hivemq.com/t/getting-error-while-establishing-connection-with-mqtt-on-azure-container-tlsv13-alert-certificate-required/3338/1 "2024-11-15T07:24:33Z")

</div>

Getting error while establishing connection with MQTT on Azure Container :tlsv13 alert certificate required but it is working on the local windows machine

[Ask Question](https://stackoverflow.com/questions/ask)

public MQTTClient(MQTTClientOptions clientOptions, IOSPLogger logger)  
{  
try  
{  
certificateProvider = new KeyVaultCertificatesProvider(clientOptions.DeviceCertificateName, new Uri(clientOptions.KeyVaultUri), logger);

```
    _clientOptions = new MqttClientOptionsBuilder()
                         .WithTcpServer(clientOptions.Host, clientOptions.Port)
                         .WithProtocolVersion(MQTTnet.Formatter.MqttProtocolVersion.V500)
                         .WithWillQualityOfServiceLevel(MqttQualityOfServiceLevel.AtLeastOnce)
                         .WithClientId(Guid.NewGuid().ToString())
                         .WithWillRetain(true)
                         .WithTlsOptions(new MqttClientTlsOptions
                         {
                             UseTls = clientOptions.UseTLS,
                             ClientCertificatesProvider = certificateProvider,
                             IgnoreCertificateRevocationErrors = true,
                             AllowUntrustedCertificates = true,
                             IgnoreCertificateChainErrors = true
                         })
                         .WithCleanStart(clientOptions.CleanStart)
                         .WithKeepAlivePeriod(TimeSpan.FromSeconds(clientOptions.KeepAlive))
                         .Build();

    _automaticReconnect = clientOptions.AutomaticReconnect;
    _client = new MqttFactory().CreateMqttClient();
    _logger = logger;

    JsonSerializerOptions option = new JsonSerializerOptions()
    {
        DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
    };
}
catch (Exception e)
{
    throw new MQTTClientInitializationException(e.Message);
}

```

}

MQTTnet.Adapter.MqttConnectingFailedException: Error while authenticating. The decryption operation failed, see inner exception. —\> MQTTnet.Exceptions.MqttCommunicationException: The decryption operation failed, see inner exception. —\> System.IO.IOException: The decryption operation failed, see inner exception. —\> Interop+OpenSsl+SslException: Decrypt failed with OpenSSL error - SSL\_ERROR\_SSL. —\> Interop+Crypto+OpenSslCryptographicException: error:0A00045C:SSL routines::tlsv13 alert certificate required — End of inner exception stack trace — at Interop.OpenSsl.Decrypt(SafeSslHandle context, Span`1 buffer, SslErrorCode& errorCode) at System.Net.Security.SslStreamPal.DecryptMessage(SafeDeleteSslContext securityContext, Span`1 buffer, Int32& offset, Int32& count) — End of inner exception stack trace — at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](Memory`1 buffer, CancellationToken cancellationToken) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at MQTTnet.Implementations.MqttTcpChannel.ReadAsync(Byte buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) at MQTTnet.Adapter.MqttChannelAdapter.ReadFixedHeaderAsync(CancellationToken cancellationToken) at MQTTnet.Adapter.MqttChannelAdapter.ReceiveAsync(CancellationToken cancellationToken) at MQTTnet.Adapter.MqttChannelAdapter.ReceivePacketAsync(CancellationToken cancellationToken) — End of inner exception stack trace — at MQTTnet.Adapter.MqttChannelAdapter.WrapAndThrowException(Exception exception) at MQTTnet.Adapter.MqttChannelAdapter.ReceivePacketAsync(CancellationToken cancellationToken) at MQTTnet.Client.MqttClient.Receive(CancellationToken cancellationToken) at MQTTnet.Client.MqttClient.Authenticate(IMqttChannelAdapter channelAdapter, MqttClientOptions options, CancellationToken cancellationToken) — End of inner exception stack trace — at MQTTnet.Client.MqttClient.Authenticate(IMqttChannelAdapter channelAdapter, MqttClientOptions options, CancellationToken cancellationToken) at MQTTnet.Client.MqttClient.ConnectInternal(IMqttChannelAdapter channelAdapter, CancellationToken cancellationToken) at MQTTnet.Client.MqttClient.ConnectAsync(MqttClientOptions options, CancellationToken cancellationToken) at MQTTnet.Client.MqttClient.ConnectAsync(MqttClientOptions options, CancellationToken cancellationToken)

---

<div class="post-metadata">

**Author:** ![pglombardo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/pglombardo/32/588_2.png) [@pglombardo](https://community.hivemq.com/u/pglombardo)\
**Post date:** [November 20, 2024, 9:45pm UTC](https://community.hivemq.com/t/getting-error-while-establishing-connection-with-mqtt-on-azure-container-tlsv13-alert-certificate-required/3338/2 "2024-11-20T21:45:23Z")

</div>

> [@bhargav.better](#):
>
> :tlsv13 alert certificate required

This generally means that the broker you are connecting to requires you to provide a client certificate.

Are you connecting to the same broker on your windows machine and in Azure?
