共用方式為


Passwordless authentication with Spring Cloud Azure

本文介紹 Azure 身份擴充功能 ,並說明如何實作無密碼認證,以安全連接您的 Spring Cloud Azure 應用程式與 Azure 服務。 透過消除將憑證儲存在應用程式碼、設定檔或環境變數中的需求,你不僅能提升安全性,也能簡化設定流程。

核心功能

Azure Identity Extensions

Azure Identity Extensions 是建立在 Azure Identity 函式庫之上,簡化了與 Microsoft Entra ID 及其他 Azure 服務的認證流程。 它提供了一個通用的範本框架,讓使用者能使用多種憑證類型從 Microsoft Entra ID 取得令牌,包括:

  • ClientSecretCredential
  • ClientCertificateCredential
  • ManagedIdentityCredential
  • DefaultAzureCredential

取得代幣後,它將取代傳統密碼。 擴充功能還包含以下外掛,以促進使用 Microsoft Entra ID 進行資料庫認證:

  • AzureMysqlAuthenticationPlugin
  • AzurePostgresqlAuthenticationPlugin

Spring Boot 整合

Spring Cloud Azure 建立在 Azure 身份擴充之上,提供更高層次、更便利的實作,讓開發者能專注於商業邏輯,而非手動驗證設定。 以下自動設定豆子簡化了整合:

實作指南

連線到 MySQL

Spring Cloud Azure 使用 AzureMysqlAuthenticationPlugin 將 Microsoft Entra 憑證轉換成相容的 MySQL 密碼。 欲了解更多資訊,請參閱 Spring Cloud Azure MySQL 支援範例資料庫

連線到 PostgreSQL

對於 PostgreSQL,Spring Cloud Azure 使用 AzurePostgresqlAuthenticationPlugin 將 Microsoft Entra 令牌轉換成 PostgreSQL 識別的密碼。 欲了解更多資訊,請參閱 Spring Cloud Azure PostgreSQL 支援範例倉庫

連接 Redis

為了啟用 Redis 的無密碼認證,Spring Cloud Azure 使用 AzureAuthenticationTemplate 將 Microsoft Entra 憑證轉換成有效的 Redis 憑證。 欲了解更多資訊,請參閱 Spring Cloud Azure Redis 支援範例倉庫

Connect to Azure Service Bus JMS

對於 Azure Service Bus JMS,Spring Cloud Azure 使用 TokenCredentialProviderOptions 將 Microsoft Entra 令牌轉移到 Azure Service Bus JMS 憑證。 欲了解更多資訊,請參閱 使用 Azure Service Bus with JMS範例資料庫