问题描述

在上一次的博文中,我们提到了使用“ 【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/

设置如下:

【Azure Logic App】使用Event Hub 连接器配置 Active Directory OAuth 认证无法成功连接到中国区Event Hub的解决之法_App

 

参考文档

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

 


当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!