授权令牌签名有问题

时间:2014-10-27 10:42:22

标签: python-2.7 azure raspberry-pi azureservicebus

我在授权令牌签名方面遇到问题。

    from azure.servicebus import ServiceBusService

key_name = 'RootManageSharedAccessKey' # SharedAccessKeyName from Azure portal
key_value = '***' # SharedAccessKey from Azure portal
service_namespace = 'lenioService' 
sbs = ServiceBusService(service_namespace,
                        shared_access_key_name=key_name,
                        shared_access_key_value=key_value)

## To receive Messages !

sbs.create_subscription('cdmessages', 'AllMessages')

msg = sbs.receive_subscription_message('cdmessages', 'AllMessages', peek_lock=False)
print(msg.body)

它给了我这个错误:

 Traceback (most recent call last):
  File "C:\Users\RH-TH\Desktop\azureTest.py", line 14, in <module>
    sbs.create_subscription('cdmessages', 'AllMessages')
  File "C:\Python27\lib\azure\servicebus\servicebusservice.py", line 497, in create_subscription
    _dont_fail_on_exist(ex)
  File "C:\Python27\lib\azure\__init__.py", line 890, in _dont_fail_on_exist
    raise error
WindowsAzureError: Unknown error (40103: Invalid authorization token signature)

我跟着: https://github.com/Azure/azure-sdk-for-python

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

对于shared_access_key_value,请使用Primary Key,而不要使用Primary Connection String