update_subscription or create_subscription with forward_to throw an exception
Describe the bug I tried to create a subscription and set forward_to attribute but got an error I can update all properties except forward_to. if I set it manually and try to update any of attribute I get same error here is the function
def get_and_update_subscription(servicebus_mgmt_client):
subscription_properties = servicebus_mgmt_client.get_subscription(
TOPIC_NAME, SUBSCRIPTION_NAME)
subscription_properties.forward_to = QUEUE_ADDRESS
subscription_properties.max_delivery_count = 5
servicebus_mgmt_client.update_subscription(
TOPIC_NAME, subscription_properties)
Exception or Stack Trace
Exception has occurred: HttpResponseError
MissingToken: The authorization header was not found. To know more visit https://aka.ms/sbResourceMgrExceptions. . TrackingId:a950b88a-d221-4f3d-aa8e-898d8d7233f8_G36, SystemTracker:zishibus:Topic:zishi.adaptive/cognitiveandsurveyupload, Timestamp:2020-11-25T13:31:47
File "/home/farsid/development/zishi-adaptive-prediction-engine/src/PredictionConsummer.py", line 62, in get_and_update_subscription
TOPIC_NAME, subscription_properties)
File "/home/farsid/development/zishi-adaptive-prediction-engine/src/PredictionConsummer.py", line 68, in <module>
get_and_update_subscription(servicebus_mgmt_client)
To Reproduce Steps to reproduce the behavior: Create a queue and subscription and try to set forward_to to the queue address
CONNECTION_STR = "Endpoint=sb://xxxx"
QUEUE_NAME = "cognitive-servey-prediction"
SUBSCRIPTION_NAME = "cognitive-servey-prediction"
TOPIC_NAME = "zishi.adaptive/cognitiveandsurveyupload"
QUEUE_ADDRESS = "sb://xxxx.servicebus.windows.net/cognitive-servey-prediction"
def create_subscription(servicebus_mgmt_client):
print("-- Create Subscription")
if not any(x.name == SUBSCRIPTION_NAME for x in servicebus_mgmt_client.list_subscriptions(TOPIC_NAME)):
servicebus_mgmt_client.create_subscription(
TOPIC_NAME, SUBSCRIPTION_NAME)
print("Subscription {} is created.".format(QUEUE_NAME))
print("")
def create_queue(servicebus_mgmt_client):
if not any(x.name == QUEUE_NAME for x in servicebus_mgmt_client.list_queues()):
servicebus_mgmt_client.create_queue(
QUEUE_NAME, max_delivery_count=10, dead_lettering_on_message_expiration=True)
def get_and_update_subscription(servicebus_mgmt_client):
subscription_properties = servicebus_mgmt_client.get_subscription(
TOPIC_NAME, SUBSCRIPTION_NAME)
subscription_properties.forward_to = QUEUE_ADDRESS
subscription_properties.max_delivery_count = 5
servicebus_mgmt_client.update_subscription(
TOPIC_NAME, subscription_properties)
with ServiceBusAdministrationClient.from_connection_string(CONNECTION_STR) as servicebus_mgmt_client:
create_queue(servicebus_mgmt_client)
create_subscription(servicebus_mgmt_client)
get_and_update_subscription(servicebus_mgmt_client)
Setup (please complete the following information):
- Python Version: 3.7.5
- SDK Version: azure-servicebus==7.0.0
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl, @axisc.
Issue Details
Describe the bug I tried to create a subscription and set forward_to attribute but got an error I can update all properties except forward_to. if I set it manually and try to update any of attribute I get same error here is the function
def get_and_update_subscription(servicebus_mgmt_client):
subscription_properties = servicebus_mgmt_client.get_subscription(
TOPIC_NAME, SUBSCRIPTION_NAME)
subscription_properties.forward_to = QUEUE_ADDRESS
subscription_properties.max_delivery_count = 5
servicebus_mgmt_client.update_subscription(
TOPIC_NAME, subscription_properties)
Exception or Stack Trace
Exception has occurred: HttpResponseError
MissingToken: The authorization header was not found. To know more visit https://aka.ms/sbResourceMgrExceptions. . TrackingId:a950b88a-d221-4f3d-aa8e-898d8d7233f8_G36, SystemTracker:zishibus:Topic:zishi.adaptive/cognitiveandsurveyupload, Timestamp:2020-11-25T13:31:47
File "/home/farsid/development/zishi-adaptive-prediction-engine/src/PredictionConsummer.py", line 62, in get_and_update_subscription
TOPIC_NAME, subscription_properties)
File "/home/farsid/development/zishi-adaptive-prediction-engine/src/PredictionConsummer.py", line 68, in <module>
get_and_update_subscription(servicebus_mgmt_client)
To Reproduce Steps to reproduce the behavior: Create a queue and subscription and try to set forward_to to the queue address
CONNECTION_STR = "Endpoint=sb://xxxx"
QUEUE_NAME = "cognitive-servey-prediction"
SUBSCRIPTION_NAME = "cognitive-servey-prediction"
TOPIC_NAME = "zishi.adaptive/cognitiveandsurveyupload"
QUEUE_ADDRESS = "sb://xxxx.servicebus.windows.net/cognitive-servey-prediction"
def create_subscription(servicebus_mgmt_client):
print("-- Create Subscription")
if not any(x.name == SUBSCRIPTION_NAME for x in servicebus_mgmt_client.list_subscriptions(TOPIC_NAME)):
servicebus_mgmt_client.create_subscription(
TOPIC_NAME, SUBSCRIPTION_NAME)
print("Subscription {} is created.".format(QUEUE_NAME))
print("")
def create_queue(servicebus_mgmt_client):
if not any(x.name == QUEUE_NAME for x in servicebus_mgmt_client.list_queues()):
servicebus_mgmt_client.create_queue(
QUEUE_NAME, max_delivery_count=10, dead_lettering_on_message_expiration=True)
def get_and_update_subscription(servicebus_mgmt_client):
subscription_properties = servicebus_mgmt_client.get_subscription(
TOPIC_NAME, SUBSCRIPTION_NAME)
subscription_properties.forward_to = QUEUE_ADDRESS
subscription_properties.max_delivery_count = 5
servicebus_mgmt_client.update_subscription(
TOPIC_NAME, subscription_properties)
with ServiceBusAdministrationClient.from_connection_string(CONNECTION_STR) as servicebus_mgmt_client:
create_queue(servicebus_mgmt_client)
create_subscription(servicebus_mgmt_client)
get_and_update_subscription(servicebus_mgmt_client)
Setup (please complete the following information):
- Python Version: 3.7.5
- SDK Version: azure-servicebus==7.0.0
| Author: | farshid3003 |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
(Removing mgmt tag as this is the dataplane (azure-servicebus) administration SDK.)
Thanks @farshid3003 , this was a really solid set of repro steps, and I can confirm what you're seeing. Will loop back here as soon as we know more, but wanted to mention if this was a hard blocker the azure-mgmt-servicebus lib is an option (and typically the one we point folks at for management that doesn't require SAS based auth)
Hi @KieranBrantnerMagee , Thanks for the answer, for now I just create it manually.
Good news @farshid3003 We've found the issue at hand; forward_to and forward_dead_lettered_messages_to require additional bearer token headers to be provided. (see here) Thanks for the callout, this was a good gap to fill and have tested, I expect this to find its way in with the next release.