Azure 队列服务 PHP 连接字符串


azure queue service php connectionstring

所以我想要一个脚本连接到队列并检索消息。在 .NET 应用程序上,我使用以下字符串进行连接,并且一切运行良好:

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

这是一个相当大的字符串,但它在 .NET 中运行良好。但是,对于 php,我在 Azure php sdk 文档中注意到,连接字符串应具有以下格式:

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

我不确定如何以 php 所需的格式"翻译"我拥有的大网址。我尝试了以下方法,但没有奏效

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

有人知道连接字符串实际上应该是什么样子吗?提前致谢

我相信你混合了两件事 - .Net 中的服务总线队列和 PHP 中的 Azure 存储队列。您尝试在 PHP 中使用的连接字符串适用于存储队列。根据此处的文档:https://github.com/Azure/azure-sdk-for-php(请参阅"入门"部分),服务总线的连接字符串应采用以下格式:

端点

=[你的端点];SharedSecretIssuer=[yourWrapAuthenticationName];SharedSecretValue=[yourWrapPassword]

终结点通常采用以下格式的位置 https://[yourNamespace].servicebus.windows.net.

这是一篇很棒的文章,展示了应该如何设置:

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

端点

=[你的端点];SharedSecretIssuer=[Default Issuer];共享密钥值=[默认键]

本文介绍如何设置通过 PHP 使用时需要的 ACS 连接:

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