Azure函数操作后Teams Bot权限丢失,需用户重装应用求助
Teams Bot部署/迁移Azure Function后丢失客户访问权限,需重新安装应用恢复
我开发了一款可向客户发送消息的Teams Bot,Bot本身运行正常,但存在严重的可用性问题:对托管该Bot的Azure Function执行任何操作后,都会失去客户访问权限,无法向客户发送消息,除非客户卸载并重新安装应用。
具体场景:
- 使用VSCode Teams Toolkit部署代码变更(即使是添加调试信息、修复安全漏洞等小改动)会导致Bot权限被撤销;
- 昨日将服务计划升级至高级层,Azure Function迁移至新实例后,虽未修改代码或权限,但再次出现权限丢失情况。
我进行了以下测试:
- 直接向Azure Function发送httpRequest,成功在Teams中收到消息;
- 使用VSCode Teams Toolkit部署代码(未修改代码内容);
- 再次发送httpRequest失败(无法找到member对象);
- 卸载并重新安装应用后,一切恢复正常。
相关代码片段:
const member = await notificationApp.notification.findMember( //findMember is expecting a function that returns a predicate. therefore, we must use async function //to return a promise that resolves to a predicate (even if the actual operation is synchronous) async (m) => (m.account.userPrincipalName.toLowerCase() === userEmail.toLowerCase() || m.account.email?.toLowerCase() === userEmail.toLowerCase()) ).catch((error) => { context.log.error(`Error finding member ${userEmail}:`, error); });
请问是否有人遇到过类似问题或找到解决方案?
感谢,
内容的提问来源于stack exchange,提问作者Lior Lew
相关产品推荐
相关产品推荐

