【Azure Logic App】使用Event Hub 连接器配置 Active Directory OAuth 认证无法成功连接到中国区Event Hub的解决之法
问题描述
在上一次的博文中,我们提到了使用“ 【Azure Logic App】使用Event Hub 连接器配置 Active Directory OAuth 认证无法成功连接到中国区Event Hub ” 无法成功连接到Event Hub,报错 “ 2024-08-17T08:40:30Z [Error] An exception occurred while retrieving properties for Event Hub: logicapp. Error Message: 'ClientSecretCredential authentication failed: AADSTS90002: Tenant 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' not found. Check to make sure you have the correct tenant ID and are signing into the correct cloud. Check with your subscription administrator, this may happen if there are no active subscriptions for the tenant.”
问题解答
上次分析问题,是因为Logic App服务后台使用的Event Hub Extension在设置authority上没有生效的原因。上次提供的替代方案是使用connection string 或者是 managed identity 方式连接Event Hub。
其实,还有另外一种更好的解决方案,可以继续使用Active Directory OAuth进行认证。Event Hub Extension可以直接从环境变量中读取Authority设置。所以只需要在Logic App的环境变量中设置AZURE_AUTHORITY_HOST。
AZURE_AUTHORITY_HOST = https://login.partner.microsoftonline.cn/
设置如下:
参考文档
How to use Azure.Identity with Azure Government Cloud, Azure German Cloud, and Azure China Cloud : https://blog.jongallant.com/2020/02/azure-identity-other-clouds/#google_vignette
使用Event Hub 连接器配置 Active Directory OAuth 认证无法成功连接到中国区Event Hub : https://www.cnblogs.com/lulight/p/18364675
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2021-09-09 【Azure 应用服务】Azure App Service 在不配置自定义域名的情况下如何使用呢?
2020-09-09 【Azure云服务 Cloud Service】Cloud Service的实例(VM)中的服务描述Software Protection 与 Windows Defender, 如何设置Windows Defender Antivirus服务