Edit

Share via


Quickstart: Connect Azure Spring Apps to databases and services with Service Connector

Get started with Service Connector to connect your Azure Spring Apps to databases, storage accounts, and other Azure services. Service Connector simplifies authentication and configuration, enabling you to connect to resources using managed identities other authentication methods.

This article provides step-by-step instructions for both the Azure portal and Azure CLI. Choose your preferred method using the tabs above.

Note

The Basic, Standard, and Enterprise plans entered a retirement period on March 17, 2025. For more information, see the Azure Spring Apps retirement announcement.

The Standard consumption and dedicated plan entered a retirement period on September 30, 2024, with a complete shutdown by the end of March 2025. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.

Prerequisites

  • Version 2.37.0 or higher of the Azure CLI. To upgrade to the latest version, run az upgrade. If using Azure Cloud Shell, the latest version is already installed.
  • The Azure Spring Apps extension must be installed in the Azure CLI or the Cloud Shell. To install it, run az extension add --name spring.

Initial setup

  1. If you're using Service Connector for the first time, start by running the command az provider register to register the Service Connector resource provider.

    az provider register -n Microsoft.ServiceLinker
    

    Tip

    You can check if the resource provider has already been registered by running the command az provider show -n "Microsoft.ServiceLinker" --query registrationState. If the output is Registered, then Service Connector has already been registered.

  2. Optionally, run the following command to get a list of supported target services for Azure Spring Apps.

    az spring connection list-support-types --output table
    

    Tip

    If the az spring command isn't recognized by the system, check that you have installed the required extension by running az extension add --name spring.

Create a service connection

Use Service Connector to create a secure service connection between your Azure Spring Apps and Azure Blob Storage. This example demonstrates connecting to Blob Storage, but you can use the same process for other supported Azure services.

  1. Select the Search resources, services and docs (G +/) search bar at the top of the Azure portal, type Azure Spring Apps in the filter and select Azure Spring Apps.

    Screenshot of the Azure portal, selecting Azure Spring Apps.

  2. Select the name of the Azure Spring Apps instance you want to connect to a target resource.

  3. Under Settings, select Apps and select the application from the list.

    Screenshot of the Azure portal, selecting an app.

  4. Select Service Connector from the service menu and select Create. Screenshot of the Azure portal, selecting the button to create a connection.

  5. On the Basics tab, select or enter the following settings. Screenshot of the Azure portal, fill basic info to create a connection.

    Setting Example Description
    Service type Key Vault The type of service you're going to connect your app to.
    Connection name keyvault_17d38 The connection name that identifies the connection between your app and target service. Use the connection name provided by Service Connector or enter your own connection name.
    Subscription my-subscription The subscription that contains your target service (the service you want to connect to). The default value is the subscription that contains the app deployed to Azure Spring Apps.
    Key vault my-keyvault-name The target Key Vault you want to connect to. If you choose a different service type, select the corresponding target service instance.
    Client type SpringBoot The application stack that works with the selected target service. Besides SpringBoot and Java, other stacks are also supported.
  6. Select Next: Authentication to select the authentication type. We recommend you use a system-assigned managed identity to connect to your Key Vault.

    Screenshot of the Azure portal, filling out the Authentication tab.

  7. Select Next: Networking to select the network configuration and select Configure firewall rules to enable access to target service so that your app can reach the Blob Storage.

    Screenshot of the Azure portal, filling out the Networking tab.

  8. Select Next: Review + Create to review the provided information. Wait a few seconds for Service Connector to validate the information and select Create to create the service connection.

Run the az spring connection create command to connect an application deployed to Azure Spring Apps to a Blob Storage resource, with a system-assigned managed identity. You can run this command in two different ways:

  • Generate the new connection step by step.

       az spring connection create storage-blob --system-identity
    
  • Generate the new connection at once. Replace the placeholders with your own information: <source-subscription>, <source_resource_group>, <azure-spring-apps-resource>, <app>, <target-subscription>, <target_resource_group>, and <account>.

       az containerapp connection create storage-blob \                         
       --source-id /subscriptions/<source-subscription>/resourceGroups/<source_resource_group>/providers/Microsoft.AppPlatform/Spring/<azure-spring-apps-resource>/apps/<app> \
       --target-id /subscriptions/<target-subscription>/resourceGroups/<target_resource_group>/providers/Microsoft.Storage/storageAccounts/<account>/blobServices/default \
       --system-identity
    

Tip

If you don't have a Blob Storage account, run az spring connection create storage-blob --new --system-identity to create one and connect it to your application hosted on Azure Spring Apps using a managed identity.

View service connections

Azure Spring Apps connections are displayed under Settings > Service Connector.

  1. Select > to expand the list and access the properties required by your application.

  2. Select Validate to check your connection status, and select Learn more to review the connection validation details.

    Screenshot of the Azure portal, get connection validation result.

Run az spring connection list command to list all of your Azure Spring Apps' provisioned connections.

Replace the placeholders <azure-spring-apps-resource-group>, <azure-spring-apps-resource-name>, and <app-name> from the command below with your own information. You can also remove the --output table option to view more information about your connections.

az spring connection list --resource-group <azure-spring-apps-resource-group> --service <azure-spring-resource-name> --app <app-name> --output table

The output also displays the provisioning state of your connections.

Check the guides below for more information about Service Connector and Azure Spring Apps: