问题
What is the best way to retrieve a list of topic names that are encapsulated by an Azure EventGrid Domain in C#?
It is easy enough to do this with Azure-CLI, but struggling to find examples of this in C#. I've looked at EventGridManagementClient with usage sample here, however, I feel there is too much overhead to try and get this to work, mainly to do with credentials and authentication.
回答1:
You can use the REST API call Domain Topics - List By Domain to get the list all the topics in a domain. Once your application has an Authorization Bearer access token, you can get any resource.
Have a look at my article Azure Event Grid Tester based on the Azure API Management using a REST API calls.
The following screen snippet shows getting a list of all the topics in a domain by Azure Event Grid Tester:
来源:https://stackoverflow.com/questions/57469609/how-to-get-a-list-of-existing-topics-in-an-azure-eventgrid-domain-in-c-sharp