天天看點

Azure Managed Service Identities如何與Azure VM協同工作的場景

51CTO 部落格位址:https://blog.51cto.com/14669127

部落格園部落格位址:https://www.cnblogs.com/Nancy1983

需求:Azure 訂閱中包含一個名為VM1的虛拟機,VM1在名為RG1的資源組中,VM1運作的服務,其資源都部署到RG1中,如果確定運作在VM1的服務可以使用VM1的Identity來管理RG1中的資源,該如何配置?

解決方案需求解析:

Azure Managed Service Identities如何與Azure VM協同工作的場景

  1. Azure資料總管收到請求,在VM上啟用系統配置設定的Managed Identity.
  2. Azure資料總管在Azure AD中建立與VM Identities相對應的服務主體
  3. Azure資料總管通過使用服務主體用戶端ID和證書更新Azure Instance Metadata Service Identities endpoint來配置VM上的辨別。
  4. VM有了Identities之後,根據服務主體資訊向VM授權對Azure資源的通路權限。

    說明:若調用Azure資料總管,使用Azure 基于角色的通路控制向VM服務主體配置設定相應的角色;若調用Key Vault,請授權代碼對Key Vault中特定密鑰的通路權限。

  5. 在VM上運作的代碼可以從VM中通路的Azure Instance Metadata Service Identities endpoint請求令牌:http://169.254.169.254/metadata/identity/oauth2/token
  6. 調用了Azure AD,以便使用在步驟3中配置的用戶端ID和證書請求通路令牌。Azure AD傳回JSON Web令牌通路令牌。
  7. 代碼在調用支援Azure AD身份驗證的服務時發送通路令牌。

繼續閱讀