将托管标识添加到 Azure 服务结构的正确方法

Right way to add Managed Identity to Azure service fabric

由于没有直接将托管标识直接添加到 Azure 服务结构的直接方法,考虑将托管标识添加到 Azure VM 规模集实例,而后者又由预期的 Azure 服务结构实例管理。以便 Service Fabric 应用程序(最终部署到 Azure VM 规模集实例的那些 VM)可以利用为 Azure VM 规模集实例配置的托管标识,访问其他 Azure 资源,如 Azure Key vault 等。

这是为 Azure 服务结构应用程序创建托管标识的正确方法吗? (或)是否有任何方法可以使用 Powershell 或 Azure 门户为 Azure 服务结构启用托管标识?

有什么方法可以将托管身份限制为仅适用于 Azure 服务结构集群中的特定应用程序,而不适用于所有应用程序?

请说明。

Is this right way of creating managed identity for the Azure service fabric applications? (or) is there any way of enabling managed identity for the Azure service fabric using Powershell or Azure portal?

是的,这应该是正确的方法,您可以利用 VMSS 的 MSI(托管身份)来访问 azure 资源。 该文档还提到了相同的方式 - Authenticate Service Fabric applications to Azure Resources using Managed Service Identity (MSI),它提供了一种启用 MSI 的 ARM 模板方式。

通过powershell或portal开启VMSS的MSI,可参考

注意:在使用MSI访问Azure资源之前,您需要grant the correct RBAC roles to the MSI at the resource scope. For Azure keyvault, you need to add the MSI to the access policy.

Is there any way to restrict, Managed Identity only to certain application in Azure service fabric cluster but to not all applications?

不,你不能。为VMSS启用MSI后,它将应用于VMSS中的所有应用程序。

如果您只想将 MSI 限制到某个应用程序,您可能需要先使用 system-assigned or User-Assigned managed identity, use the MSI of application instead of VMSS, make sure enable the Managed Identity Token Service on the cluster 部署 Service Fabric 应用程序。