Azure 解决方案:User-assigned managed identity使用场景分析

51CTO 博客地址:https://blog.51cto.com/14669127

需求:计划部署一个名为App1的应用程序,将在5Azure VM上运行,稍后会部署更多的VM来运行App1,对于运行App1VM,需要满足如下要求,你需要考虑如何配置相应类型的identity?

·       确保VM可以向Azure Active DirectoryAzure AD)进行身份验证,以访问Azure密钥库、Azure Logic Apps实例和Azure SQL 数据库

·       部署额外的VM时,避免为Azure服务分配新的角色和权限

·       避免在VM上存储secretsCertificates

·       最小化管理Identities的工作

解决方案分析:IT Admin经常面临一个挑战就是secretscredentials的管理,以保护不同服务之间的通信,在Azure上,通过为Azure ADAzure Resource提供一个身份,并使用它来获得Azure Active Directory令牌,Managed identities消除了IT Admin必须管理Credentials的需求,有助于访问Azure密钥库,开发人员可以使用安全的方式存储credentials

Azure资源的Managed identitiesAzure Active Directory的一个特性,有以下2种类型:

·       System-assigned: 一些Azure服务允许直接在服务实例上启用managed identity,当启用一个System-assigned managed identity时,将在Azure AD中创建一个与该服务实例的声明周期绑定的identity, 因此,当资源被删除时,Azure会自动为你删除identity,根据设计,只有Azure 资源可以使用这个identityAzure AD请求令牌。

·       User-assigned:你可以创建一个User-assigned managed identity,并将其分配给Azure服务的一个或者多个实例,在User-assigned managed identitycase中,identity和与使用它的资源可以分开管理。

下表为System-assigned managed identityUser-assigned managed identity差异对比。

属性

System-assigned   managed identity

User-assigned   managed identity

Creation

可以创建部分Azure Resource,比如Azure VM或者App Service

可以创建一个独立的Azure Resource

Lifecycle

与创建Managed IdentitiesAzure资源共享生命周期。

当父资源被删除时,managed Identities也被删除

独立的生命周期

必须显式删除

Sharing across   Azure Resource

不能共享

只能关联一个Azure Resource

可以共享

可以管理多个Azure Resource

 

综上所述,User-assigned managed identity是可以共享的,同一个User-assigned managed identity可以与多个Azure资源相关联,符合客户需求。

相关资料:

·       Configure managed identities for Azure resources on a VM using the Azure portal

·       How to use managed identities for Azure resources on an Azure VM to acquire an access token

·       Create, list, delete, or assign a role to a user-assigned managed identity using the Azure portal


猜你喜欢

转载自blog.51cto.com/14669127/2679018