{"id":2250,"date":"2022-10-25T11:43:41","date_gmt":"2022-10-25T18:43:41","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/azure-sdk\/?p=2250"},"modified":"2022-10-25T11:43:41","modified_gmt":"2022-10-25T18:43:41","slug":"announcing-the-stable-release-of-spring-cloud-azure-version-4-4-0","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/azure-sdk\/announcing-the-stable-release-of-spring-cloud-azure-version-4-4-0\/","title":{"rendered":"Announcing the stable release of Spring Cloud Azure version 4.4.0"},"content":{"rendered":"<p>We&#8217;re pleased to announce the release of Spring Cloud Azure version 4.4.0 (stable), in addition to version 4.5.0-beta.1 (beta). All Java packages are generally released in Maven. These two releases are compatible with:<\/p>\n<ul>\n<li>Spring Boot versions:\n<ul>\n<li>2.5.0 through 2.5.14<\/li>\n<li>2.6.0 through 2.6.11<\/li>\n<li>2.7.0 through 2.7.3<\/li>\n<\/ul>\n<\/li>\n<li>Spring Cloud versions:\n<ul>\n<li>2020.0.3 through 2020.0.6<\/li>\n<li>2021.0.0 through 2021.0.3<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<blockquote><p>NOTE: Spring Boot 2.5.x (x &gt; 14), 2.6.y (y &gt; 11), and 2.7.z (z &gt; 3) should be supported, but they weren&#8217;t tested with this release.<\/p>\n<p>Spring Cloud 2020.0.x (x &gt; 6) and 2021.0.y (y &gt; 3) should be supported, but they weren&#8217;t tested with this release.<\/p><\/blockquote>\n<p>The 4.4.0 release focused on improving the support of different Azure clouds, adding proxy support for Azure Active Directory (Azure AD), and improving passwordless connections to Azure Event Hubs for Kafka. For a complete list of changes, see the <a href=\"https:\/\/github.com\/Azure\/azure-sdk-for-java\/releases\/tag\/spring-cloud-azure_4.4.0\">release notes<\/a>.<\/p>\n<p>The 4.5.0 Beta 1 release introduced two extra Spring Boot starters to support passwordless connections to Azure Database for MySQL and PostgreSQL. For a complete list of changes, see the <a href=\"https:\/\/github.com\/Azure\/azure-sdk-for-java\/releases\/tag\/spring-cloud-azure_4.5.0-beta.1\">release notes<\/a>.<\/p>\n<h2>Connect to Azure AD via proxy<\/h2>\n<p>As of the 4.4.0 release, you can proxy the HTTP requests to Azure AD. To achieve that, provide a <code>RestTemplateCustomizer<\/code> bean. For example:<\/p>\n<pre><code class=\"language-java\">@Configuration\r\nclass DemoConfiguration {\r\n    @Bean\r\n    public RestTemplateCustomizer proxyRestTemplateCustomizer() {\r\n        return (RestTemplate restTemplate) -&gt; {\r\n            Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXY_SERVER_HOST, PROXY_SERVER_PORT));\r\n            SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();\r\n            requestFactory.setProxy(proxy);\r\n            restTemplate.setRequestFactory(requestFactory);\r\n        };\r\n    }\r\n}<\/code><\/pre>\n<h2>Connect to different Azure clouds<\/h2>\n<p>As of the 4.4.0 release, you can configure the <code>spring.cloud.azure.profile.cloud-type<\/code> property to different Azure clouds. All service starters, such as <code>spring-cloud-azure-starter-keyvault-secrets<\/code>, will then use the specified cloud. For example:<\/p>\n<pre><code class=\"language-yaml\">spring:\r\n  cloud:\r\n    azure: \r\n      profile:\r\n        cloud-type: AZURE_CHINA<\/code><\/pre>\n<p>If the <code>spring.cloud.azure.profile.cloud-type<\/code> property isn&#8217;t set, its default value is <code>AZURE<\/code>. The available values are <code>AZURE<\/code>, <code>AZURE_CHINA<\/code>, <code>AZURE_GERMANY<\/code>, <code>AZURE_US_GOVERNMENT<\/code>, and <code>OTHER<\/code>. If you&#8217;re using Azure Stack, set the value to <code>OTHER<\/code> and configure different endpoints via <code>spring.cloud.azure.profile.environment.*<\/code>. For a complete list of endpoint properties, see <a href=\"https:\/\/microsoft.github.io\/spring-cloud-azure\/4.4.0\/reference\/html\/appendix.html#global_proeprties\">Configuration properties<\/a>.<\/p>\n<p>If your application connects to multiple Azure clouds, you can also set the <code>profile.cloud-type<\/code> property for each service. In the following example, the property is set for both Azure Key Vault and Azure Blob Storage:<\/p>\n<pre><code class=\"language-yaml\">spring:\r\n  cloud:\r\n    azure: \r\n      keyvault:\r\n        secret:\r\n          profile:\r\n            cloud-type: AZURE_CHINA\r\n      storage:\r\n        blob:\r\n          profile:\r\n            cloud-type: AZURE<\/code><\/pre>\n<h2>Connect to Azure Event Hubs for Kafka via passwordless connections<\/h2>\n<p>Azure Event Hubs for Kafka supports integration with Azure AD, which enables you to authenticate using Azure AD users, applications, or managed identities. Since version 4.3.0, you can achieve it by deleting the password provided via the <code>spring.kafka.sasl.jass.config<\/code> property. In version 4.4.0, we provided more flexibility by introducing a <code>spring.cloud.azure.eventhubs.kafka.enabled<\/code> property to toggle the OAuth 2.0 feature.<\/p>\n<p>The only property you need when connecting to Azure Event Hubs for Kafka in a passwordless way is:<\/p>\n<pre><code class=\"language-yaml\">spring:\r\n  kafka:\r\n    bootstrap-servers: ${AZ_EVENTHUBS_NAMESPACE_NAME}.servicebus.windows.net:9093<\/code><\/pre>\n<p>For detailed migration instructions, see <a href=\"https:\/\/learn.microsoft.com\/azure\/developer\/java\/spring-framework\/migrate-kafka-to-passwordless-connection\">Migrate an application to use passwordless connections with Azure Event Hubs for Kafka<\/a>.<\/p>\n<h2>Connect to Azure Database for MySQL and PostgreSQL via passwordless connections<\/h2>\n<blockquote><p>NOTE: This feature is only available in version 4.5.0 Beta 1.<\/p><\/blockquote>\n<p>Both Azure Database for MySQL and Azure Database for PostgreSQL support integration with Azure AD. This integration allows you to authenticate using Azure AD users, applications, or managed identities.<\/p>\n<blockquote><p>NOTE: This feature applies to both Single Server and Flexible Server variants of Azure Database for MySQL and PostgreSQL.<\/p><\/blockquote>\n<p>To authenticate in a passwordless manner, complete the following steps:<\/p>\n<ol>\n<li>Add the dependencies:<strong>MySQL:<\/strong>\n<pre><code class=\"language-xml\">&lt;dependency&gt;\r\n    &lt;groupId&gt;com.azure.spring&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;spring-cloud-azure-starter-jdbc-mysql&lt;\/artifactId&gt;\r\n    &lt;version&gt;4.5.0-beta.1&lt;\/version&gt;\r\n&lt;\/dependency&gt;<\/code><\/pre>\n<p><strong>PostgreSQL:<\/strong><\/p>\n<pre><code class=\"language-xml\">&lt;dependency&gt;\r\n    &lt;groupId&gt;com.azure.spring&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;spring-cloud-azure-starter-jdbc-postgresql&lt;\/artifactId&gt;\r\n    &lt;version&gt;4.5.0-beta.1&lt;\/version&gt;\r\n&lt;\/dependency&gt;<\/code><\/pre>\n<\/li>\n<li>Configure the properties:\n<pre><code class=\"language-yaml\">spring:\r\n datasource:\r\n   url: jdbc:mysql:\/\/${AZ_DATABASE_SERVER_NAME}.mysql.database.azure.com:3306\/${AZ_DATABASE_NAME}\r\n   username: ${AZ_AD_USERNAME}@${AZ_DATABASE_SERVER_NAME}\r\n   azure:\r\n     passwordless-enabled: true<\/code><\/pre>\n<blockquote><p>NOTE: If you&#8217;re using PostgreSQL, change the <code>spring.datasource.url<\/code> property value to something like <code>jdbc:postgresql:\/\/${AZ_DATABASE_SERVER_NAME}.postgres.database.azure.com:5432\/$AZ_DATABASE_NAME<\/code>.<\/p><\/blockquote>\n<\/li>\n<\/ol>\n<p>For more information, see <a href=\"https:\/\/aka.ms\/passwordless-connections\">Passwordless connections for Azure services<\/a>.<\/p>\n<h2>Dependency upgrades<\/h2>\n<p>Here&#8217;s a list of dependency upgrades in both releases:<\/p>\n<ul>\n<li>Upgrade to Azure SDK BOM 1.2.6<\/li>\n<li>Upgrade to Azure Spring Data Cosmos DB 3.27.0<\/li>\n<li>Upgrade to Azure Resource Manager 2.19.0<\/li>\n<\/ul>\n<h2>Feedback<\/h2>\n<p>As always, we welcome feedback and contributions. Reach out to us on <a href=\"https:\/\/stackoverflow.com\/questions\/tagged\/spring-cloud-azure\">StackOverflow<\/a> or <a href=\"https:\/\/github.com\/Azure\/azure-sdk-for-java\/issues?q=is%3Aissue+is%3Aopen+label%3Aazure-spring\">GitHub<\/a>.<\/p>\n<h2>Resources<\/h2>\n<p>Here&#8217;s a list of links that are helpful to learn more about Spring Cloud Azure:<\/p>\n<ul>\n<li><a href=\"https:\/\/aka.ms\/spring\/docs\">Reference documentation<\/a><\/li>\n<li><a href=\"https:\/\/aka.ms\/spring\/msdocs\">Conceptual documentation<\/a><\/li>\n<li><a href=\"https:\/\/aka.ms\/spring\/samples\">Code samples<\/a><\/li>\n<li><a href=\"https:\/\/aka.ms\/spring\/versions\">Spring versions mapping<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This post announces the release of the Spring Cloud Azure 4.4.0 and 4.5.0 Beta 1.<\/p>\n","protected":false},"author":103258,"featured_media":2255,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[160,871,872],"class_list":["post-2250","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure-sdk","tag-java","tag-spring","tag-spring-cloud-azure"],"acf":[],"blog_post_summary":"<p>This post announces the release of the Spring Cloud Azure 4.4.0 and 4.5.0 Beta 1.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/posts\/2250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/users\/103258"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/comments?post=2250"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/posts\/2250\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/media\/2255"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/media?parent=2250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/categories?post=2250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/tags?post=2250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}