-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Using Blobclient with managed identity
Currently it is not possible to use managed identity in combination with the use_sdk_type feature.
As in the Hydrator we always check for the AzureWebJobsStorage env to be present. Whilst using managed identity this property is not used as it only accepts formatting for a connectionString.
Example
I have the following function trigger
@FunctionName("BlobFunction")
fun handle(
@BlobTrigger(
name = "content",
path = "container/{fileName}.json"
) blob: BlobClient,
@BindingName("fileName") fileName: String,
context: ExecutionContext
) {
logger.info { "received $fileName" }
}With the following environment variables defined:
AzureWebJobsStorage__accountName = mystorageaccount
JAVA_ENABLE_SDK_TYPES = true
Problem
Yet when starting this function the BlobClientHydrator will complain the AzureWebJobsStorage is not set.
https://github.com/Azure/azure-functions-java-additions/blob/dev/azure-functions-java-sdktypes/src/main/java/com/microsoft/azure/functions/sdktype/blob/BlobClientHydrator.java#L29
If you then also configure the AzureWebJobsStorage with a dummyvalue "foo=bar"
The default net sdk will then fail as the AzureWebJobsStorage is not correctly formatted.
Suggestion
I believe we could resolve this by not specifically checking the envVar but also checking if any of the 3 suffix variants are defined.
- System.getenv(envVar + "__accountName");
- System.getenv(envVar + "__serviceUri");
- System.getenv(envVar + "__blobServiceUri");
final note
If my assumptions mentioned above are incorrect please advise towards a working example.