如何在C#中获取Azure EventGrid域中的现有主题列表 [英] How to get a list of existing topics in an Azure EventGrid Domain in C#
问题描述
检索由C#中的Azure EventGrid域封装的主题名称列表的最佳方法是什么?
What is the best way to retrieve a list of topic names that are encapsulated by an Azure EventGrid Domain in C#?
使用Azure-CLI做到这一点很容易,但是却很难在C#中找到它的示例.我看过 EventGridManagementClient 和使用示例 太多了,无法尝试使其正常工作,主要是与凭据和身份验证有关.
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.
推荐答案
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.
看看我的文章 Azure事件网格测试器使用 REST API 调用基于Azure API管理.
Have a look at my article Azure Event Grid Tester based on the Azure API Management using a REST API calls.
以下屏幕片段显示了通过Azure Event Grid Tester获取域中所有主题的列表:
The following screen snippet shows getting a list of all the topics in a domain by Azure Event Grid Tester:
这篇关于如何在C#中获取Azure EventGrid域中的现有主题列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!