[BUG] The BlobServiceClient.getAccountInfo() method always returns a 404 response
See original GitHub issueDescribe the bug I’m trying to retrieve the replication settings for an Azure Blob Storage Account. I can create a BlobServiceClient, and use that to retrieve the name and URL of the account, but not the StorageAccountInfo.
Exception or Stack Trace
com.azure.storage.blob.models.BlobStorageException: Status code 404, "<?xml version="1.0" encoding="utf-8"?><Error><Code>ResourceNotFound</Code><Message>The specified resource does not exist.
RequestId:0ee4f937-c01e-0022-369f-1f1e25000000
Time:2020-05-01T10:01:00.9294905Z</Message></Error>"
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.azure.core.http.rest.RestProxy.instantiateUnexpectedException(RestProxy.java:357)
at com.azure.core.http.rest.RestProxy.lambda$ensureExpectedStatus$3(RestProxy.java:400)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:118)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1592)
at reactor.core.publisher.MonoProcessor.onNext(MonoProcessor.java:317)
at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2148)
at reactor.core.publisher.MonoProcessor.onSubscribe(MonoProcessor.java:325)
at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:191)
at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:48)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
at reactor.core.publisher.Mono.subscribe(Mono.java:4087)
at reactor.core.publisher.MonoProcessor.add(MonoProcessor.java:457)
at reactor.core.publisher.MonoProcessor.subscribe(MonoProcessor.java:370)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:55)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)
at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:123)
at reactor.core.publisher.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:112)
at reactor.core.publisher.FluxMap$MapConditionalSubscriber.onNext(FluxMap.java:213)
at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:123)
at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:178)
at reactor.core.publisher.FluxContextStart$ContextStartSubscriber.onNext(FluxContextStart.java:103)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1592)
at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:121)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:252)
at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136)
at reactor.netty.channel.FluxReceive.terminateReceiver(FluxReceive.java:419)
at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:209)
at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:367)
at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:363)
at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:412)
at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:572)
at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:90)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:316)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1470)
at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1231)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1268)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:493)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:432)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:271)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.handler.proxy.ProxyHandler.channelRead(ProxyHandler.java:253)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:93)
at reactor.core.publisher.Mono.block(Mono.java:1663)
at com.azure.storage.common.implementation.StorageImplUtils.blockWithOptionalTimeout(StorageImplUtils.java:99)
at com.azure.storage.blob.BlobServiceClient.getAccountInfoWithResponse(BlobServiceClient.java:370)
at com.azure.storage.blob.BlobServiceClient.getAccountInfo(BlobServiceClient.java:356)
at com.microfocus.digitalsafe.azure.immutabilitypolicy.ImmutabilityPolicyApp.getStorageAccountSku(ImmutabilityPolicyApp.java:125)
at com.microfocus.digitalsafe.azure.immutabilitypolicy.ImmutabilityPolicyApp.main(ImmutabilityPolicyApp.java:58)
To Reproduce I created a new instance of BlobServiceClient, using BlobServiceClientBuilder. Then tried to call getAccountInfo() with no parameters on that instance and I get the error mentioned above.
Code Snippet
String clientId = <my client ID>;
String clientSecret = <my client secret>;;
String tenant = <my tenant>;
String azureStorageURL = <my client ID>;
String storageProxyHost = <My proxy settings>;
int storageProxyPort = 8080;
final ProxyOptions proxyOptions;
if (storageProxyHost != null && !storageProxyHost.isEmpty()) {
proxyOptions = new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress(storageProxyHost, storageProxyPort));
} else {
proxyOptions = null;
}
HttpClient client = new NettyAsyncHttpClientBuilder().proxy(proxyOptions).build();
final BlobServiceClient blobServiceClient = new BlobServiceClientBuilder().credential(new ClientSecretCredentialBuilder()
.clientId(clientId)
.clientSecret(clientSecret)
.tenantId(tenant)
.proxyOptions(proxyOptions)
.build()).endpoint(String.valueOf(azureStorageURL)).httpClient(client).buildClient();
System.out.printf("blobServiceClient = %s%n", blobServiceClient); // This works
System.out.printf("blobServiceClient.getAccountName() = %s%n", blobServiceClient.getAccountName()); // This works
System.out.printf("blobServiceClient.getAccountUrl() = %s%n", blobServiceClient.getAccountUrl()); // This works
System.out.printf("blobServiceClient.getAccountInfo() = %s%n", blobServiceClient.getAccountInfo()); // This fails with 404
StorageAccountInfo storageAccountInfo = blobServiceClient.getAccountInfo(); // This fails with 404
Expected behavior A StorageAccountInfo should be returned
Screenshots If applicable, add screenshots to help explain your problem.
Setup (please complete the following information):
- OS: Windows 10
- IDE : IntelliJ IDEA Ultimate 2020.1
- 12.5.0
Additional context Add any other context about the problem here.
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- Bug Description Added
- Repro Steps Added
- Setup information Added
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (7 by maintainers)
@AndresManuel1 Can I ask you to please create a new issue and reference this one? It looks like your issue may be spring related, so creating a new issue for triage should pull in the appropriate team for that
Hello, I am currently experiencing pretty much the same problem, could you please re-open this issue?
I introduced the com.azure.spring:azure-spring-boot-starter-storage:3.10.0 dependency to my project to access a Blob Storage Account on Azure.
The Spring Boot Starter provides the BlobStorageHealthIndicator which ends up calling the BlobServiceAsyncClient.getAccountInfo().block() to check whether the storage account is accessible.
This works completely fine when using StorageSharedKeyCredential (Account Name + Account Key), however, when using the DefaultAzureCredential (TokenCredentials?) in the BlobServiceClientBuilder, the getAccountInfo() call will result in a HTTP 404 Resource not found error.
I tried 2 cases - once using EnvironmentCredentials (and a service principal) locally and once using ManagedIdentityCredentials (in combination with App Service). I tried to give my service principal all possible roles, such as Owner of the whole subscription, any kind of storage blob owner roles and everything I could find - nothing worked.
If you need any more information, please let me know and I will supply it as soon as possible!