API 连接会无限期地保留其授权状态吗?
Do API Connections retain their authorisation state indefinitely?
我创建了一个 Azure Automation API Connection to use in a Logic App action. As the docs explain,当首次创建 API 连接时,它需要授权才能与自动化对话:
PS C:\> $conn = Get-AzResource -ResourceGroupName my-rg -ResourceType Microsoft.Web/connections -Name azureautomation
PS C:\> $conn.Properties.statuses
status target error
------ ------ -----
Error token @{code=Unauthenticated; message=This connection is not authenticated.}
按照文档,我可以在逻辑应用程序设计器中打开连接并验证为有权创建自动化作业的用户(例如,具有 Automation Job Operator 角色的用户)。然后连接显示为已通过身份验证,操作成功创建作业:
PS C:\> $conn = Get-AzResource -ResourceGroupName my-rg -ResourceType Microsoft.Web/connections -Name azureautomation
PS C:\> $conn.Properties.statuses
status
------
Connected
PS C:\> $conn.Properties.authenticatedUser
name
----
username@example.com
很明显,连接不仅通过了身份验证,还获得了授权。我不清楚哪个 authentication flow the Logic App Designer has followed, and in particular whether the connection will automatically refresh its access tokens 没有进一步干预。这不仅仅是学术上的:我想知道的是 连接会在未来的某个时候悄悄失去授权吗?
我正在为 Azure 的新客户构建此解决方案,因此我希望使解决方案尽可能简单。他们熟悉本地 AD 世界中服务帐户的概念,但 AAD 服务主体对他们来说是新的。通过逻辑应用程序设计器依赖一次性手动授权是否安全,还是using a service principal确保连接保持授权的唯一可靠方法?
我认为 using a service principal 在您的场景中更可靠,如果您使用用户帐户授权连接,连接可能会因未确定的问题而中断,例如密码在以后更改。如果使用service principal来授权,我们只需要使用一个永不过期的client secret,就永远不会失去授权。
我创建了一个 Azure Automation API Connection to use in a Logic App action. As the docs explain,当首次创建 API 连接时,它需要授权才能与自动化对话:
PS C:\> $conn = Get-AzResource -ResourceGroupName my-rg -ResourceType Microsoft.Web/connections -Name azureautomation
PS C:\> $conn.Properties.statuses
status target error
------ ------ -----
Error token @{code=Unauthenticated; message=This connection is not authenticated.}
按照文档,我可以在逻辑应用程序设计器中打开连接并验证为有权创建自动化作业的用户(例如,具有 Automation Job Operator 角色的用户)。然后连接显示为已通过身份验证,操作成功创建作业:
PS C:\> $conn = Get-AzResource -ResourceGroupName my-rg -ResourceType Microsoft.Web/connections -Name azureautomation
PS C:\> $conn.Properties.statuses
status
------
Connected
PS C:\> $conn.Properties.authenticatedUser
name
----
username@example.com
很明显,连接不仅通过了身份验证,还获得了授权。我不清楚哪个 authentication flow the Logic App Designer has followed, and in particular whether the connection will automatically refresh its access tokens 没有进一步干预。这不仅仅是学术上的:我想知道的是 连接会在未来的某个时候悄悄失去授权吗?
我正在为 Azure 的新客户构建此解决方案,因此我希望使解决方案尽可能简单。他们熟悉本地 AD 世界中服务帐户的概念,但 AAD 服务主体对他们来说是新的。通过逻辑应用程序设计器依赖一次性手动授权是否安全,还是using a service principal确保连接保持授权的唯一可靠方法?
我认为 using a service principal 在您的场景中更可靠,如果您使用用户帐户授权连接,连接可能会因未确定的问题而中断,例如密码在以后更改。如果使用service principal来授权,我们只需要使用一个永不过期的client secret,就永远不会失去授权。