From 6bd952060d86cde382fb73523a78e9c2960bb4c8 Mon Sep 17 00:00:00 2001 From: Oliver-CI <67435562+Oliver-CI@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:36:28 +0200 Subject: [PATCH 1/2] update: check all possible env variables when determining blob connection is configured --- .../sdktype/blob/BlobClientHydrator.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/azure-functions-java-sdktypes/src/main/java/com/microsoft/azure/functions/sdktype/blob/BlobClientHydrator.java b/azure-functions-java-sdktypes/src/main/java/com/microsoft/azure/functions/sdktype/blob/BlobClientHydrator.java index d88e67e..23d251a 100644 --- a/azure-functions-java-sdktypes/src/main/java/com/microsoft/azure/functions/sdktype/blob/BlobClientHydrator.java +++ b/azure-functions-java-sdktypes/src/main/java/com/microsoft/azure/functions/sdktype/blob/BlobClientHydrator.java @@ -25,7 +25,7 @@ public Object createInstance(BlobClientMetaData metaData) throws Exception { String envVar = metaData.getConnectionEnvVar(); String configValue = System.getenv(envVar); - if (configValue == null || configValue.isEmpty()) { + if (!environmentVariablesArePresent(envVar)) { throw new SdkHydrationException("No environment variable set for: " + envVar); } @@ -35,7 +35,7 @@ public Object createInstance(BlobClientMetaData metaData) throws Exception { Object blobBuilder = blobBuilderClass.getDeclaredConstructor().newInstance(); // Step 2: If configValue is a connection string, do the existing approach - if (isConnectionString(configValue)) { + if (configValue != null && isConnectionString(configValue)) { LOGGER.info("Detected connection string usage from: " + envVar); Method conn = blobBuilderClass.getMethod("connectionString", String.class); @@ -87,6 +87,24 @@ public Object createInstance(BlobClientMetaData metaData) throws Exception { return blobClient; } + private boolean environmentVariablesArePresent(String envVar){ + final String configValue = System.getenv(envVar); + final String accountName = System.getenv(envVar + "__accountName"); + final String blobServiceUri = System.getenv(envVar + "__blobServiceUri"); + final String serviceUri = System.getenv(envVar + "__serviceUri"); + + if(configValue != null && !configValue.isEmpty()){ + return true; + } + if( (accountName != null && !accountName.isEmpty()) || + (blobServiceUri != null && !blobServiceUri.isEmpty()) || + (serviceUri != null && !serviceUri.isEmpty()) + ){ + return true; + } + return false; + } + /** * Decide if configValue is likely a connection string by checking for well-known keywords. */ From aa34583152c79dcb1f1e1afda86860d6d63cd915 Mon Sep 17 00:00:00 2001 From: Oliver-CI <67435562+Oliver-CI@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:41:07 +0200 Subject: [PATCH 2/2] update: changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1f2d93..afeeea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Updates * Updated the BrokerProtocol type for Kafka Extension. +* Add check for all connection env variables to configure managed identity ### Breaking changes * to be update