I'm using Python 3.8 and Azure's service bus SDK (azure-servicebus==0.50.3). Currently, I can use the below code to get a shared access policy rule (and key/value) for a specific topic within a namespace
from azure.mgmt.servicebus import ServiceBusManagementClient
...
self._sb_client = ServiceBusManagementClient(credential, subscription)
...
rule = self._sb_client.topics.list_keys(
self._resource_group_name,
self._namespace,
self._topic_name,
SB_SAS_POLICY_LISTEN
)
How do I make the logic a little more general so that I can query policies at the namespace level? We have a root shared access policy and I wanted to see if there's a programmatic way to get the rule similar to the above. I've tried excluding the topic parameter, but I'm unable it is required.
Aha. It appears you're specifically using azure-mgmt-servicebus
for the tooling you're leveraging, which is exactly the right thing, and has the functionality you're looking for:
There is a comparable list_keys method present on the namespace as well as on a given topic, which would be called via client.namespaces.list_keys(
.
Don't hesitate to shout if I've misunderstood or if any of this is unclear.