'Error while connecting Azure function with IBM MQ using TLS certificate

I am getting the same issue from Azure function 4 with .NET 6 to connect to MQ v9.1 queue manager using IBMMQDotnetClient(9.2.4).

[05/03/2022 14:37:23 > 06c3c9: INFO]       Error occured when trying to establish Queue Manager connection: MQRC_HOST_NOT_AVAILABLE
[05/03/2022 14:37:23 > 06c3c9: INFO]       CompCode: 2, Reason: 2538

Have installed the pfx certificate as per below:

enter image description here

Here is the connection property object creation:

    using IBM.WMQ;    
    private Hashtable GetConnectionProperties()
    {
        var connectionProperties = new Hashtable
        {
            { MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED },
            { MQC.HOST_NAME_PROPERTY, _options.Hostname },
            { MQC.CHANNEL_PROPERTY, _options.Channel },
            { MQC.PORT_PROPERTY, _options.Port },
            { MQC.CONNECT_OPTIONS_PROPERTY, MQC.MQCNO_RECONNECT_Q_MGR }
        };
        //options to connect
        if (!string.IsNullOrWhiteSpace(_options.Username))
        {
            connectionProperties.Add(MQC.USER_ID_PROPERTY, _options.Username);
            connectionProperties.Add(MQC.PASSWORD_PROPERTY, _options.Password);
        }
        if(!string.IsNullOrWhiteSpace(_options.CipherSpec))
            connectionProperties.Add(MQC.SSL_CIPHER_SPEC_PROPERTY, _options.CipherSpec); //e.g TLS_RSA_WITH_AES_128_CBC_SHA256
        if (!string.IsNullOrWhiteSpace(_options.CertStore))
        {
            //*USER or *SYSTEM
            connectionProperties.Add(MQC.SSL_CERT_STORE_PROPERTY, _options.CertStore);
            //Certificate friendly name
            connectionProperties.Add(MQC.CERT_LABEL_PROPERTY, _options.CertLabel);
            connectionProperties.Add(MQC.SSL_PEER_NAME_PROPERTY, "CN=XXXXXXX.XXXX.internal");
        }
        if (!string.IsNullOrWhiteSpace(_options.Application))
            connectionProperties.Add(MQC.APPNAME_PROPERTY, _options.Application);

        return connectionProperties;
    }

I tried changing the SSL_CERT_STORE_PROPERTY from *SYSTEM to *USER but still it does not work. I had followed this link earlier Azure Function IBM MQ Setup with pfx Certificate and had replied on the question with same information but somehow it marked hidden by stackoverflow hence creating new post. I had followed the answer but did couldn't able to solve. Can someone please suggest or direct me on this issue as I have limited knowledge on IBM MQ.

Error details on MQ Queue Manager:

04/05/2022 11:37:03 - Process(680.5915) User(svc_mqm) Program(amqrmppa.exe)
                      Host(vmmqXXXXXX) Installation(Installation1)
                      VRMF(9.1.5.0) QMgr(P2CXXXX01)
                      Time(2022-05-04T10:37:03.758Z)
                      CommentInsert1(????)
                      CommentInsert2(680(104))
                      CommentInsert3(10.219.145.39)
    
Channel '????' to host '10.2XX.XXX.XX' ended abnormally.
    
    
The channel program running under process ID 680(104) for channel '????' 
ended abnormally. The host name is '10.219.145.39'; in some cases the host 
name cannot be determined and so is shown as '????'.
       
    
Look at previous error messages for the channel program in the error logs to 
determine the cause of the failure. Note that this message can be excluded 
completely or suppressed by tuning the "ExcludeMessage" or "SuppressMessage" 
attributes under the "QMErrorLog" stanza in qm.ini. Further information can 
be found in the System Administration Guide.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source