即使使用一个帐户,在 Azure 上触发逻辑应用程序时也会收到 InvalidAuthorizationTokenTenant 错误?

问题描述 投票:0回答:2

目前,我尝试在 Microsoft Azure 上的逻辑应用程序上运行触发器,但每次尝试时,我都会收到 InvalidAuthorizationTokenTenant 错误。让我解释一下。

因此,我在 Microsoft Azure 上有一个名为

StaticReportingVM
的虚拟机,它在打开时会自动运行服务。我正在尝试使用名为
startVM
的逻辑应用程序来自动化打开和关闭机器的过程。逻辑设计如下:它有一个循环任务,检查一年中的时间(该任务应该在每个月初运行),它告诉机器打开,并通过我的个人电子邮件通知我是否打开任务成功了。

startVM design

startVM parameters

这些参数对于我的机器和我的订阅来说是正确的。但是,每次运行触发器时,我都会收到以下错误:

{
  "error": {
    "code": "InvalidAuthenticationTokenTenant",
    "message": "The access token is from the wrong issuer 'https://sts.windows.net/xxxxxxx-xxxxxxx-xxxxxxx/'. It must match the tenant 'https://sts.windows.net/yyyyy-yyyyy-yyyyyy/' associated with this subscription. Please use the authority (URL) 'https://login.windows.net/yyyyy-yyyyy-yyyyyy' to get the token. Note, if the subscription is transferred to another tenant there is no impact to the services, but information about new tenant could take time to propagate (up to an hour). If you just transferred your subscription and see this error message, please try back later."
  }
}

请注意,

xxxxx-xxxxx-xxxxx
yyyyy-yyyyy-yyyyy
不同,两个
yyyyy-yyyyy-yyyyy
是相同的。 (不确定这是否有助于回答我的问题,但我只是想涵盖更多基础!)

下面是我为逻辑应用程序设置的连接的(编辑不当)图像,其中上面的电子邮件是使用我的 Azure 帐户注册的电子邮件,Office 365 电子邮件是我的个人电子邮件,用于通知我是否触发器已起作用。

startVM connections

我对此有几个问题:为什么即使我只使用一个订阅,我也会收到 InvalidAuthenticationTokenTenant 错误?我的该帐户下是否有可能有多个租户,如果是,我该如何删除这些租户?如何绕过错误并使逻辑应用正常工作?

附注这是我的第一个 stackoverflow 问题,所以如果我遗漏了任何关键细节,我很抱歉!感谢任何和所有反馈。

azure azure-active-directory azure-logic-apps azure-virtual-machine
2个回答
1
投票

• 您尝试在 Microsoft Azure VM 上触发逻辑应用以启动重复任务并通过个人电子邮件地址通知您的方式不正确。你应该

create a managed identity for the logic app through which the trigger is configured. Once configured, then assign a new role to the logic app’s managed identity through the VM’s IAM (Identity and Access Management) blade. Once done, then update the ‘Start the Virtual Machine’ task in the logic app to connect using the managed identity created for the logic app

通过这种方式,您的问题应该得到解决,并且您不应该收到任何有关“租户令牌身份验证”的错误。此外,您会收到此错误,因为在配置“StartVM 参数”时,不会询问租户 ID,而只会询问“订阅 ID”和“资源组”。因此,如果您在多个相互链接的租户中至少拥有“贡献者”角色访问权限,则默认租户 ID 和您部署虚拟机的租户将不同,因此会面临与之相关的冲突错误.

• 请找到以下配置快照,以将托管标识包含在逻辑应用设计中:-

因此,一旦 您在逻辑应用“启动 VM”操作中将 VM 的托管标识提供为连接,逻辑应用“启动 VM”触发器将使用为 VM 分配的托管标识角色作为启动 VM 的授权,并且因此租户令牌问题将得到解决

欲了解更多信息和说明,请参阅以下链接:-

https://learn.microsoft.com/en-us/azure/azure-functions/start-stop-vms/deploy#enable-multiple-subscriptions


0
投票

它与逻辑应用生成的托管身份完美配合。然后就以这个身份的角色

© www.soinside.com 2019 - 2024. All rights reserved.