I have a Java Spring boot Application that I wish to connect to an Azure Storage account through a private link. The app in question is connected to a Virtual Network called "trecappstestvn" and there is a private link available to the storage account connected to the same virtual network (though a different subnet).
When editing the "STORAGE_ACCOUNT_ENDPOINT" Variable for my app, I tried using "https://trecappstest.privatelink.blob.core.windows.net" and "10.0.14" as values.
At this point, I should probably explain my Spring Boot app. It uses Gradle as a dependency manager and as of right now it uses
implementation 'com.azure.spring:azure-spring-boot-starter-storage:+'
to connect to the storage account. Here is the Bean method I wrote to set up a BlobServiceClient
@Configuration
public class Beans {
@Value("${azure.storage.blob-endpoint}")
String endpoint;
@Value("${azure.storage.account-name}")
String accountName;
@Value("${azure.storage.account-key}")
String accountKey;
@Bean
public BlobServiceClient getBlobServiceClient() {
BlobServiceClientBuilder builder = new BlobServiceClientBuilder();
return builder.credential(new StorageSharedKeyCredential(accountName, accountKey)).
endpoint(endpoint).buildClient();
}
}
Here is a full Message of the Application Insights Log that tells me that this isn't working:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fileController': Unsatisfied dependency expressed through field 'fileService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fileService': Unsatisfied dependency expressed through field 'storageRepo'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'storageRepo' defined in URL [jar:file:/local/site/wwwroot/app.jar!/BOOT-INF/classes!/com/trecapps/internal/storage/repos/StorageRepo.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getBlobServiceClient' defined in class path resource [com/trecapps/internal/storage/config/Beans.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.azure.storage.blob.BlobServiceClient]: Factory method 'getBlobServiceClient' threw exception; nested exception is java.lang.IllegalArgumentException: The Azure Storage endpoint url is malformed.
In short, the "Azure Storage endpoint is malformed".
What should I do to get this to work?