简体   繁体   中英

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 ImageAzure 函数私钥证书

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM