Search code examples
azureazureservicebusazure-servicebusrelay

Can I programmatically get a list of Azure Service Bus Relays and how many listeners they have?


Via the Azure Portal, I can see which Relays are connected and how many listeners they have. I'd like to do this programmatically so that I can know which connections I have and whether or not there is anyone is listening on them.

Thanks!


Solution

  • As I know we can use Rest API to get the listeners and relays. I test it with fiddler, it works correctly more details please refer to the snapshot.

    https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourcegroup}/providers/Microsoft.Relay/namespaces/{namspace}/WcfRelays?api-version=2016-07-01
    

    If we want to get a WcfRelay, we need to supply a WcfRelay name.

    https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourcegroup}/providers/Microsoft.Relay/namespaces/{namspace}/WcfRelays/{WcfRelayName}?api-version=2016-07-01
    

    enter image description here

    Detail info on the Azure portal

    enter image description here