'Azure Function IBM MQ Setup with pfx Certificate

I am having a connection problem when I am trying to set up a connection to a IBM MQ V6 QueueManager and a .net client using IBM.XMS namespace in Azure Function.

I am setting up the connection like this:

XMSFactoryFactory xff = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
IConnectionFactory cf = xff.CreateConnectionFactory();
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "servername.ibmcloud.com");
cf.SetIntProperty(XMSC.WMQ_PORT, 1415);
cf.SetStringProperty(XMSC.WMQ_CHANNEL, "SYSTEM.SSL.SVRCONN");
cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);  //Managed Client
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "OM_QMGR");
cf.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1);
cf.SetStringProperty(XMSC.WMQ_CONNECTION_NAME_LIST, "servername.ibmcloud.com(1415)");
cf.SetStringProperty(XMSC.WMQ_SSL_CLIENT_CERT_LABEL, "ibmwebspheremqsystem");
cf.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, "TLS_RSA_WITH_AES_128_CBC_SHA256");
cf.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, "*SYSTEM");

return cf.CreateConnection();

This works properly when I run it in my local machine where pfx certificate is installed in my MMC console. Om my local system it is working properly, as it is able to find the WMQ_SSL_KEY_REPOSITORY from "System".

I have added the pfx certificate in Azure Function under "Private Key Certificates", and it appears as healthy, just like this Image Azure Function Private Key Certificates

but when I call the cf.CreateConnection I get an error 2538: MQRC_HOST_NOT_AVAILABLE as an exception. I know the issue is because of WMQ_SSL_KEY_REPOSITORY property, I am not sure what to provide in place of "*SYSTEM" so that this works properly on Azure Function.

Any help regarding this will be appreciated. Thank you all.



Solution 1:[1]

This question was solved in the comments by JoshMc.

The above code works with Azure Function with just one modification. Put *USER as the value of XMSC.WMQ_SSL_KEY_REPOSITORY instead of *SYSTEM and this should work on Azure Function.

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 JoshMc