简体   繁体   中英

azure queue service php connectionstring

So I want a script to connect to a queue and retrieve messages. On a .NET application, I used the following string to connect and all worked well:

sb://host.com/USER;StsEndpoint=https://host.com:9355/USER/;RuntimePort=9354;ManagementPort=9355;SharedSecretIssuer=USER;SharedSecretValue=XXX';

It's a pretty big string but it worked well in .NET. For php however, I noticed in the Azure php sdk documentation, the connection string should have the following format:

DefaultEndpointsProtocol=[http|https];AccountName=[yourAccount];AccountKey=[yourKey]

I'm not sure how to "translate" the large url I have in the format needed for php. I tried the following but didn't work

DefaultEndpointsProtocol=https://host.com;AccountName=USER;AccountKey=XXX

Anyone know how the connection string should actually look like? Thanks in advance

I believe you're mixing 2 things - Service Bus Queues in .Net and Azure Storage Queues in PHP. The connection string you are trying to use in PHP is for Storage Queues. Based on the documentation here: https://github.com/Azure/azure-sdk-for-php (See "Getting Started" section), the connection string for Service Bus should be in this format:

Endpoint=[yourEndpoint];SharedSecretIssuer=[yourWrapAuthenticationName];SharedSecretValue=[yourWrapPassword]

Where the Endpoint is typically of the format https://[yourNamespace].servicebus.windows.net .

Here is a great article showing how this should be setup:

https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-php-how-to-use-queues

Endpoint=[yourEndpoint];SharedSecretIssuer=[Default Issuer];SharedSecretValue=[Default Key]

This article explains setting up an ACS connection which will be required when using via PHP:

https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-authentication-and-authorization

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