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!
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
Detail info on the Azure portal