azure-active-directory - "System Assigned"身份和应用注册的区别 "Service Principal"

标签 azure-active-directory azure-web-app-service

有人可以帮助我了解在 AAD 中创建应用注册时创建的服务主体与在应用服务的标识边栏选项卡上启用“系统分配”时创建的托管标识之间的区别吗?

我们有一个正在开发的应用服务,我们已经为其创建了应用注册,并且我们还启用了系统分配的身份。当我们进入 AAD 下的企业应用程序并搜索我们的应用程序时,它会出现 2 个条目。一个用于托管标识,另一个用于作为应用注册的一部分创建的服务主体。我们试图了解我们将使用哪一个来授予应用程序写入 Azure SQL DB 的权限。

最佳答案

托管身份本质上是用 Microsoft 逻辑包装的服务主体,使访问资源更简单。尽管有时添加更多层可能会使事情复杂化,但其想法是使其更容易、更简单且消费者交互更少。

对于您的场景,您需要考虑您想要做什么。您想使用受 AAD 保护的 Azure SQL DB 进行更多控制并实现您自己的逻辑,还是尝试利用 Microsoft 的托管标识来保护/访问 Azure SQL DB 资源。 (理想情况下,托管身份路径应该更少工作)

可以在此处找到使用托管身份从应用服务访问 azure SQL 数据库的教程:
https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi

可以在此处找到使用 Azure AD 保护 Azure SQL DB 的文档:
https://docs.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication

此外,此处的 Microsoft 官方文档中解释了托管身份:
https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview

请务必注意,有两种托管身份。

来自文档:

A system-assigned managed identity is enabled directly on an Azure service instance. When the identity is enabled, Azure creates an identity for the instance in the Azure AD tenant that's trusted by the subscription of the instance. After the identity is created, the credentials are provisioned onto the instance. The lifecycle of a system-assigned identity is directly tied to the Azure service instance that it's enabled on. If the instance is deleted, Azure automatically cleans up the credentials and the identity in Azure AD.

A user-assigned managed identity is created as a standalone Azure resource. Through a create process, Azure creates an identity in the Azure AD tenant that's trusted by the subscription in use. After the identity is created, the identity can be assigned to one or more Azure service instances. The lifecycle of a user-assigned identity is managed separately from the lifecycle of the Azure service instances to which it's assigned.



官方文档中的图片也给出了使用 MSI(托管服务标识)的 VM 的一个很好的例子。

提供如下:
Microsoft Managed Identity Diagram for Virtual Machines.

除此之外,可以在此处找到应用服务托管标识文档:
https://docs.microsoft.com/en-us/azure/app-service/overview-managed-identity

关于azure-active-directory - "System Assigned"身份和应用注册的区别 "Service Principal",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56189276/

相关文章:

azure - 有没有办法将一个 AzureAD 应用程序同时用于前端和后端

node.js - 无法让 Next.js 应用程序在 Azure 应用服务上运行

asp.net-web-api - 重新使用 jwt 从另一个 API 调用 API

azure - ADAL 到 MSAL - 权限不足,无法完成操作

Azure Active Directory 强制执行图形端点而不是组声明

azure - 服务主体凭据,设置自定义标识符?

Azure 网站和 Google Api

javascript - 如何更改azure网站中执行的javascript文件?

azure - 监控azure服务总线队列长度

c# - Azure Web App - 如何使用 Fluent API 更新 MinTlsVersion