Configuration

Configuration for each Azure Service SDK

Most of Azure SDKs could be divided into two categories by transport type, HTTP-based and AMQP-based. There are properties that are common to all SDKs such as authentication principals and Azure environment settings. Or common to HTTP-based clients, such as logging level to log HTTP requests and responses. Spring Cloud Azure 4.0 provides five common categories of configuration properties, which could be specified to each Azure service.

Table 1. Service common properties
Property Description

spring.cloud.azure.<azure-service>.client

To configure the transport clients underneath one Azure service SDK.

spring.cloud.azure.<azure-service>.credential

To configure how to authenticate with Azure Active Directory for one Azure service SDK.

spring.cloud.azure.<azure-service>.profile

To configure the Azure cloud environment for one Azure service SDK.

spring.cloud.azure.<azure-service>.proxy

To configure the proxy options for one Azure service SDK.

spring.cloud.azure.<azure-service>.retry

To configure the retry options apply to one Azure service SDK. The retry options has supported part of the SDKs, there’s no spring.cloud.azure.cosmos.retry.

There are some properties that could be shared among different Azure services, for example using the same service principal to access Azure Cosmos DB and Azure Event Hubs. Spring Cloud Azure 4.0 allows application developers to specify properties that apply to all Azure SDKs with the prefix spring.cloud.azure.

Table 2. Global properties
Property Description

spring.cloud.azure.client

To configure the transport clients apply to all Azure SDKs by default.

spring.cloud.azure.credential

To configure how to authenticate with Azure Active Directory for all Azure SDKs by default.

spring.cloud.azure.profile

To configure the Azure cloud environment for all Azure SDKs by default.

spring.cloud.azure.proxy

To configure the proxy options apply to all Azure SDK clients by default.

spring.cloud.azure.retry

To configure the retry options apply to all Azure SDK clients by default.

Properties configured under each Azure service will override the global configurations.

Global configuration for Azure Service SDKs

Spring Cloud Azure unifies configuration properties' prefixes to spring.cloud.azure since 4.0, which will make configuration properties more consistent and more intuitive. Here’s a quick review of the serivce specific properties.

Table 3. Service specific properties
Azure Service Configuration Property Prefix Configuration Properties Link

Azure App Configuration

spring.cloud.azure.appconfiguration

App Configuration Properties

Azure Cosmos DB

spring.cloud.azure.cosmos

Cosmos Properties

Azure Event Hubs

spring.cloud.azure.eventhubs

Event Hubs Properties

Azure Key Vault Certificates

spring.cloud.azure.keyvault.certificate

Key Vault Certificates Properties

Azure Key Vault Secrets

spring.cloud.azure.keyvault.secret

Key Vault Secrets Properties

Azure Service Bus

spring.cloud.azure.servicebus

Service Bus Properties

Azure Storage Blob

spring.cloud.azure.storage.blob

Storage Blob Properties

Azure Storage File Share

spring.cloud.azure.storage.fileshare

Storage File Share Properties

Azure Storage Queue

spring.cloud.azure.storage.queue

Storage Queue Properties

Configuration examples

Global retry configuration for Azure Service SDKs

spring.cloud.azure:
  retry:
    mode: exponential
    exponential:
      max-retries: 4
      base-delay: PT0.0801S
      max-delay: PT9S

Retry configuration for Key Vault property source

The following configuration example shows you how to configure the retry behavior for the Azure Key Vault Secret client:

spring.cloud.azure:
  keyvault:
    secret:
      credential:
        client-id: <your-client-ID>
        client-secret: <your client key>
      profile:
        tenant-id: <your-tenant-ID>
      property-source-enabled: true
      property-sources:
        - endpoint: <your-Azure-Key-Vault-endpoint>
          retry:
            mode: exponential
            exponential:
              max-retries: 4
              base-delay: PT0.0801S
              max-delay: PT9S