Serverless Architecture Conference Blog

A framework in the cloud

Introduction to Azure Spring Cloud

Jun 20, 2022

What is Azure Spring Cloud and what can it do? Let's take a closer look at Spring Cloud. The framework allows developers to add cloud patterns and connections to cloud infrastructures in their Spring application.

Azure Spring Cloud is a SaaS solution in the Azure Cloud. It offers three main things:

  1. a build environment that can build and deploy applications
  2. a runtime environment that runs applications
  3. components in the runtime environment can connect directly to Spring Cloud counterparts, enabling cloud patterns such as service discovery


Learn more about Serverless Architecture Conference

Dependency management made easy with Spring starters

Anyone who wants to develop microservices in Azure can benefit from a wide range of integrated services and advantages. The first contact is facilitated by special Spring Starters, which offer several integration features for working with Microsoft Azure. Basically, Spring Boot Starters were developed to help simplify dependency management for virtually any application. Adding these starters in Maven provides a set of useful dependency descriptors that can be included in the respective application. This way, Java developers get helpful default configurations that group multiple dependencies together, simplifying the project’s configuration.

Now, Azure Spring Cloud provides special Spring Boot starter options for Azure that offer better interaction with Azure services such as Azure Cosmos DB, Azure Active Directory, and Key Vault. For example, when adding the Azure Support starter option to a Spring Boot project, some changes are made to the pom.xml file. The default spring-boot-starter dependency is replaced with the following:


The section shown in Listing 1 is added to the file.

Listing 1

      <version>${azure.version}</version> <!-- Current version: 0.2.0 -->

Integration with Azure DevOps

In order to deliver updates to existing applications quickly, without much effort or risk, every developer needs continuous integration and continuous delivery (CI/CD) tooling. Azure Spring Cloud can integrate with many CI/CD tools, including Azure DevOps. Although Azure Spring Cloud does not currently offer a dedicated Azure DevOps plug-in, developers can submit their Spring Cloud applications to Azure Spring Cloud using an Azure CLI task. The code snippet in Listing 2 shows how this works: After defining a Maven task to build the application, a second task in the form of the Azure CLI extension can be used to deploy the JAR file to Azure Spring Cloud.

Listing 2
- task: Maven@3
mavenPomFile: 'pom.xml'
- task: AzureCLI@1
scriptLocation: inlineScript
inlineScript: |
az extension add -y --name spring-cloud
az spring-cloud app deploy --resource-group  --service  --name  --jar-path ./target/your-result-jar.jar
# deploy other app

Likewise, deployments can be done directly in Azure without a separate build step (Listing 3).

Listing 3
- task: AzureCLI@1
scriptLocation: inlineScript
inlineScript: |
az extension add -y --name spring-cloud
az spring-cloud app deploy --resource-group  --service  --name
# or if it is a multi-module project
az spring-cloud app deploy --resource-group --service --name --target-module relative/path/to/module


DevOps solutions in Azure help implement DevOps methodologies in application planning, development and deployment, and application operations. It allows for better team collaboration and faster code delivery. The development services provided include:

  • Azure Boards – Agile tools to plan, track, and discuss work within teams.
  • Azure Pipelines – Create, test, and deploy code with CI/CD
  • Azure Repos – Private Git repositories hosted in the cloud where code can be created in teams with pull requests and advanced file management.
  • Azure Test Plans – Tool for manual and exploratory testing
  • Azure Artifacts – Create, host, and share packages and artifacts.


Build up a serverless-first mindset

Explore the Serverless Architecture & Design Track

Integration with Tanzu Build Service

Azure DevOps already provides a holistic solution for developers at every stage of the software lifecycle. But when it comes to building the application, Tanzu Build Service offers even more advanced and special assistance. The service uses cloud-native buildpacks, which are also used in the Tanzu Application Service. It automatically creates and updates OCI-compliant containers, so the developer does not have to create configurations such as Dockerfiles. Instead, the desired build configuration is defined only once. Tanzu Build Service retains this and automatically creates, modifies, and patches the required containers. Updates for each application component – from the code itself to the dependencies and operating system – won’t cause any more work for the developer.

In keeping with the spirit of cloud-native software engineering, Tanzu Build Service is built on a foundation of open source software that VMware actively contributes to and supports. Two open source projects serve as primary components:

  • kpack, Kubernetes-native image configuration – kpack allows automatic creation and maintenance of container images based on a declarative configuration specific to each application. Its features include a proprietary offline installation and a Build WebHook, which enables the use of self-signed certificates.
  • Buildpacks for VMware Tanzu – Tanzu Buildpacks are based on an open source implementation of the cloud-native Buildpacks specification known as Paketo Buildpack. kpack controls Tanzu Buildpacks using image configurations to centrally manage the creation and update of container images via source code. Buildpacks for VMware Tanzu extends Paketo Buildpack’s functionality with the ability to create containers in offline environments.

In addition to kpack and Buildpacks for VMware, Tanzu offers a number of other open source resources, including ClusterStack and ClusterStore: While ClusterStack is used to manage OS images, ClusterStore allows IT administrators to define Buildpack collections.

Spring Cloud Configuration Server

Since “The Twelve-Factor App” manifesto, every developer knows: Configurations should be stored outside of the code and in environmental variables instead. This makes the application more portable. The Azure Spring Cloud Configuration Server is available to fill these variables with values in Azure. Like a spider in its web, it provides a central place to manage configurations for all environments and instances. For externalized configuration in a distributed system with server-side and client-side support, it uses an exchangeable repository layer that supports local storage, Git, and Subversion. Developers can simply continue to work against a code repository – and the configuration is versioned directly and is always consistently available as the application moves down the pipeline through the various environments towards production. The concepts on both the client and server side match the Spring Environment and PropertySource abstractions, so the binding fits Spring applications out of the box. It can also be used with any application in any language.

Spring Cloud Configuration Server features include:

  • HTTP, resource-based API for external configuration (name-value pairs or equivalent YAML content).
  • Encryption and decryption of property values (symmetric or asymmetric)
  • Easy embedding in a Spring boot application with @EnableConfigServer

Service Registry and Discovery

In a microservices-based architecture, each new instance of an application should be able to automatically find the services it wants to communicate with in the environment. This allows it to integrate into the application environment without manual configuration – which not only saves time, but also avoids human error. The Azure Spring Cloud Service Registry is available for this purpose. Like a phone book for services, it controls service registration and discovery for the microservices and tells the application where to “call”. This way,  it is easy to implement cloud patterns such as the circuit breaker or client-side load balancing. For Spring Boot applications, The Spring Framework provides direct support for this in the Spring Cloud project. But since the interfaces are based on well-known Netflix projects and APIs, other languages and frameworks also provide support.

To use the managed Azure Service Registry, the spring-cloud-starter-netflix-eureka-client and spring-cloud-starter-azure-spring-cloud-client dependencies must be included in the pom.xml file (Listing 4).

Listing 4

Application scaling

In order for optimal application performance in Azure Spring Cloud when demand changes, they must scale accordingly. Azure Spring Cloud allows developers to easily scale microservices through the Azure Spring Cloud dashboard. Both the amount of memory available and the number of vCPUs can be reduced or increased vertically as needed. The number of application instances can also be changed horizontally. Thanks to dashboard control, no code needs to be changed or redeployed, and scaling takes effect within seconds.

If you do not want to manage scaling manually, you can also use Azure Spring Cloud’s built-in autoscaling, which significantly increases cost efficiency and productivity. Once autoscaling is enabled, the service manages the underlying infrastructure and app load and automatically scales up or down accordingly. Maximum and minimum limits can be set, which the service will neither exceed nor fall below.

Application monitoring

Azure Application Insights is available to help developers monitor and debug the complex connections between microservices in an application. This toolset helps users aggregate metrics. Detailed insights into application dependencies and telemetry data can be obtained directly from the Azure portal. Reliability issues and performance bottlenecks can be identified, understood, and resolved faster. Of course, a suitable Spring Boot Starter is available to make integration into your own application as efficient as possible. Spring Cloud Sleuth is integrated into Azure Application Insights. It provides auto-configuration for distributed tracing of Spring Boot applications. Sleuth automatically configures where to report trace data, how many traces to keep, and which libraries to track. In doing so, Spring Cloud Sleuth adds trace and span IDs to the SLF4J MDC so developers can aggregate all logs from a given trace or span into one log aggregator, allowing a request to be traced end-to-end through the entire application landscape.

Blue-green deployment

Azure Spring Cloud also supports blue-green deployments to release and update code for production environments. The blue-green approach is a common change management model in which two systems are maintained: a “blue” system and a “green” system. At any given time, only one system handles requests. For example, public requests can be forwarded to the blue environment, making it the production server. The green environment is the staging server, accessible only on a private network. Changes are installed on the non-live server and verified over the private network. After verification, the load balancer switches the active environment, which causes deployed changes to go live. This method makes it possible to quickly return to a previous state if something goes wrong.

Rollback is achieved by routing traffic back to the previously deployed system, which does not have the deployed changes yet. Another benefit of blue-green deployment is reduced server downtime. Since requests are immediately routed from one server to another, ideally, there is no period of time where requests go unanswered.

If this model is operated in the cloud, it still benefits from the elasticity of the environment. The inactive strand can be completely dismantled at any time when it is no longer needed and rebuilt easily, quickly, and automatically at the next upcoming deployment.


Learn more about Serverless Architecture Conference


Ultimately, Azure Spring Cloud’s individual components described in this article provide support spanning the entire application lifecycle. Since many best practices are already cast in code, the Spring Framework already provides assistance in the design phase. Together with Azure Spring Cloud as a target runtime environment, which answers further design questions, you can quickly move to implementation. During implementation, familiar subjects are on hand to help developers quickly turn around and deploy test versions in a production-like environment. This environment changes only in name and configuration, thanks to Spring and Azure Spring Cloud, as the application makes its way toward production.

Once in production, the solution won’t let down either the application or developers during operation. Monitoring and elastic scaling help keep the application responsive and available in the face of challenges. The next version will be able to roll out without downtime thanks to flexible deployment strategies such as blue-green, starting the cycle all over again.

reen, starting the cycle all over again.

Stay tuned!
Learn more about Serverless
Architecture Conference 2020

Behind the Tracks

Software Architecture & Design
Software innovation & more
Architecture structure & more
Agile & Communication
Methodologies & more
Emerging Technologies
Everything about the latest technologies
DevOps & Continuous Delivery
Delivery Pipelines, Testing & more
Cloud & Modern Infrastructure
Everything about new tools and platforms
Big Data & Machine Learning
Saving, processing & more