Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.
The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.
This article applies to: ❎ Basic ✅ Standard ✅ Enterprise
This quickstart describes how to use Terraform to deploy an Azure Spring Apps cluster into an existing virtual network.
Azure Spring Apps makes it easy to deploy Spring applications to Azure without any code changes. The service manages the infrastructure of Spring applications so developers can focus on their code. Azure Spring Apps provides lifecycle management using comprehensive monitoring and diagnostics, configuration management, service discovery, CI/CD integration, blue-green deployments, and more.
The Enterprise deployment plan includes the following Tanzu components:
The API Portal component will be included when it becomes available through the AzureRM Terraform provider.
For more customization including custom domain support, see the Azure Spring Apps Terraform provider documentation.
/16
each) that you've identified for use by the Azure Spring Apps cluster. These CIDR ranges won't be directly routable and will be used only internally by the Azure Spring Apps cluster. Clusters may not use 169.254.0.0/16
, 172.30.0.0/16
, 172.31.0.0/16
, or 192.0.2.0/24
for the internal Azure Spring Apps CIDR. Clusters also may not use any IP ranges included within the cluster virtual network address range.User Access Administrator
and Network Contributor
permissions to your virtual network in order to grant a dedicated and dynamic service principal on the virtual network for further deployment and maintenance. For instructions and more information, see the Grant service permission to the virtual network section of Deploy Azure Spring Apps in a virtual network.0.0.0.0/0
with a destination of your NVA before deploying the Azure Spring Apps cluster. For more information, see the Bring your own route table section of Deploy Azure Spring Apps in a virtual network.The configuration file used in this quickstart is from the Azure Spring Apps reference architecture.
# Azure provider version
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "= 3.21.1"
}
}
}
provider "azurerm" {
features {}
}
### Create Resource group
resource "azurerm_resource_group" "sc_corp_rg" {
name = var.resource_group_name
location = var.location
}
### Create Application Insights
resource "azurerm_application_insights" "sc_app_insights" {
name = var.app_insights_name
location = var.location
resource_group_name = var.resource_group_name
application_type = "web"
workspace_id = "/subscriptions/${var.subscription}/resourceGroups/${var.azurespringcloudvnetrg}/providers/Microsoft.OperationalInsights/workspaces/${var.sc_law_id}"
depends_on = [azurerm_resource_group.sc_corp_rg]
}
### Create Spring Cloud Service
resource "azurerm_spring_cloud_service" "sc" {
name = var.sc_service_name
resource_group_name = var.resource_group_name
location = var.location
sku_name = "S0"
network {
app_subnet_id = "/subscriptions/${var.subscription}/resourceGroups/${var.azurespringcloudvnetrg}/providers/Microsoft.Network/virtualNetworks/${var.vnet_spoke_name}/subnets/${var.app_subnet_id}"
service_runtime_subnet_id = "/subscriptions/${var.subscription}/resourceGroups/${var.azurespringcloudvnetrg}/providers/Microsoft.Network/virtualNetworks/${var.vnet_spoke_name}/subnets/${var.service_runtime_subnet_id}"
cidr_ranges = var.sc_cidr
}
timeouts {
create = "60m"
delete = "2h"
}
depends_on = [azurerm_resource_group.sc_corp_rg]
tags = var.tags
}
### Update Diags setting for Spring Cloud Service
resource "azurerm_monitor_diagnostic_setting" "sc_diag" {
name = "monitoring"
target_resource_id = azurerm_spring_cloud_service.sc.id
log_analytics_workspace_id = "/subscriptions/${var.subscription}/resourceGroups/${var.azurespringcloudvnetrg}/providers/Microsoft.OperationalInsights/workspaces/${var.sc_law_id}"
log {
category = "ApplicationConsole"
enabled = true
retention_policy {
enabled = false
}
}
metric {
category = "AllMetrics"
retention_policy {
enabled = false
}
}
}
To apply the Terraform plan, follow these steps:
Save the variables.tf file for the Standard plan or the Enterprise plan locally, then open it in an editor.
Edit the file to add the following values:
The subscription ID of the Azure account you'll be deploying to.
A deployment location from the regions where Azure Spring Apps is available, as shown in Products available by region. You'll need the short form of the location name. To get this value, use the following command to generate a list of Azure locations, then look up the Name value for the region you selected.
az account list-locations --output table
Edit the file to add the following new deployment information:
Edit the file to add the following existing infrastructure information:
Run the following command to initialize the Terraform modules:
terraform init
Run the following command to create the Terraform deployment plan:
terraform plan -out=springcloud.plan
Run the following command to apply the Terraform deployment plan:
terraform apply springcloud.plan
You can either use the Azure portal to check the deployed resources, or use Azure CLI or Azure PowerShell script to list the deployed resources.
If you plan to continue working with subsequent quickstarts and tutorials, you might want to leave these resources in place. When no longer needed, delete the resources created in this article by using the following command.
terraform destroy -auto-approve
In this quickstart, you deployed an Azure Spring Apps instance into an existing virtual network using Terraform, and then validated the deployment. To learn more about Azure Spring Apps, continue on to the resources below.
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Deploy Spring microservices to Azure - Training
Learn how to deploy Spring Boot microservices to Azure Spring Apps (ASA).
Certification
Microsoft Certified: Azure for SAP Workloads Specialty - Certifications
Demonstrate planning, migration, and operation of an SAP solution on Microsoft Azure while you leverage Azure resources.
Documentation
Quickstart - Build and Deploy Apps to Azure Spring Apps
Describes app deployment to Azure Spring Apps.
Deploy Azure Spring Apps in a Virtual Network
Deploy Azure Spring Apps in a virtual network (VNet injection).
Quickstart - Provision Azure Spring Apps Using Bicep
This quickstart shows you how to use Bicep to deploy an Azure Spring Apps cluster into an existing virtual network.