You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
moarychan opened this issue
Jul 30, 2021
· 2 comments
Labels
ClientThis issue points to a problem in the data-plane of the library.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatStorageStorage Service (Queues, Blobs, Files)
Query/Question
Output stream to azure storage blob service based on service principal authentication, I have assigned the service principal owner role to the azure storage account. The container can be created successfully, 'When committing the stream(com.azure.storage.blob.specialized.BlobOutputStream.BlockBlobOutputStream#commit) in the close method, then found the following exception:
15:40:59.000 [reactor-http-nio-3] DEBUG reactor.netty.resources.PooledConnectionProvider - [id:1f1db122, L:/100.64.171.203:52846 - R:moarycstorage3.blob.core.windows.net/52.239.224.228:443] Channel cleaned, now: 0 active connections, 1 inactive connections and 0 pending acquire requests.
java.io.IOException: com.azure.storage.blob.models.BlobStorageException: If you are using a StorageSharedKeyCredential, and the server returned an error message that says 'Signature did not match', you can compare the string to sign with the one generated by the SDK. To log the string to sign, pass in the context key value pair 'Azure-Storage-Log-String-To-Sign': true to the appropriate method call.
If you are using a SAS token, and the server returned an error message that says 'Signature did not match', you can compare the string to sign with the one generated by the SDK. To log the string to sign, pass in the context key value pair 'Azure-Storage-Log-String-To-Sign': true to the appropriate generateSas method call.
Please remember to disable 'Azure-Storage-Log-String-To-Sign' before going to production as this string can potentially contain PII.
Status code 403, "<?xml version="1.0" encoding="utf-8"?><Error><Code>AuthorizationPermissionMismatch</Code><Message>This request is not authorized to perform this operation using this permission.
RequestId:9e81284c-001e-0035-7616-8588ad000000
Time:2021-07-30T07:40:54.6472081Z</Message></Error>"
at com.azure.storage.blob.specialized.BlobOutputStream$BlockBlobOutputStream.lambda$new$0(BlobOutputStream.java:228)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onError(Operators.java:2062)
at reactor.core.publisher.MonoNext$NextSubscriber.onError(MonoNext.java:93)
at reactor.core.publisher.FluxSwitchOnFirst$SwitchOnFirstControlSubscriber.onError(FluxSwitchOnFirst.java:877)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondError(MonoFlatMap.java:192)
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onError(MonoFlatMap.java:259)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onError(FluxMapFuseable.java:140)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:172)
at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onError(FluxContextWrite.java:121)
at reactor.core.publisher.FluxDoOnEach$DoOnEachSubscriber.onError(FluxDoOnEach.java:195)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondError(MonoFlatMap.java:192)
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onError(MonoFlatMap.java:259)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onError(Operators.java:2062)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondError(MonoFlatMap.java:192)
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onError(MonoFlatMap.java:259)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onError(Operators.java:2062)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:142)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1815)
at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.signalCached(MonoCacheTime.java:337)
at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.onNext(MonoCacheTime.java:354)
at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2397)
at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.onSubscribe(MonoCacheTime.java:293)
at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:192)
at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
at reactor.core.publisher.MonoCacheTime.subscribeOrReturn(MonoCacheTime.java:143)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157)
at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:130)
at reactor.core.publisher.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:118)
at reactor.core.publisher.FluxMap$MapConditionalSubscriber.onNext(FluxMap.java:220)
at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:130)
at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:184)
at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1815)
at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:128)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:259)
at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:142)
at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:401)
at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:416)
at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:470)
at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:685)
at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:94)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1368)
at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1245)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1282)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:446)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
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.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.azure.storage.blob.models.BlobStorageException: If you are using a StorageSharedKeyCredential, and the server returned an error message that says 'Signature did not match', you can compare the string to sign with the one generated by the SDK. To log the string to sign, pass in the context key value pair 'Azure-Storage-Log-String-To-Sign': true to the appropriate method call.
If you are using a SAS token, and the server returned an error message that says 'Signature did not match', you can compare the string to sign with the one generated by the SDK. To log the string to sign, pass in the context key value pair 'Azure-Storage-Log-String-To-Sign': true to the appropriate generateSas method call.
Please remember to disable 'Azure-Storage-Log-String-To-Sign' before going to production as this string can potentially contain PII.
Status code 403, "<?xml version="1.0" encoding="utf-8"?><Error><Code>AuthorizationPermissionMismatch</Code><Message>This request is not authorized to perform this operation using this permission.
RequestId:9e81284c-001e-0035-7616-8588ad000000
Time:2021-07-30T07:40:54.6472081Z</Message></Error>"
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.azure.core.http.rest.RestProxy.instantiateUnexpectedException(RestProxy.java:343)
at com.azure.core.http.rest.RestProxy.lambda$ensureExpectedStatus$5(RestProxy.java:382)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:125)
... 59 more
Disconnected from the target VM, address: '127.0.0.1:52828', transport: 'socket'
Process finished with exit code 0
Here's the test code.
publicclassStorageBlobDemo {
publicstaticvoidmain(String[] args) {
finalClientSecretCredentialBuilderbuilder = newClientSecretCredentialBuilder()
.tenantId("tenant id")
.clientId("service principal id")
.clientSecret("service principal secert");
BlobServiceClientblobServiceClient = newBlobServiceClientBuilder()
.endpoint("https://xxx.blob.core.windows.net/")
.credential(builder.build())
.buildClient();
// storageClient.createBlobContainer("from-idea")System.out.println("Successfully setup client using the Azure Identity, please check the service version: "
+ blobServiceClient.getProperties().getDefaultServiceVersion());
Stringlocation = "azure-blob://container/blob-test";
// BlobStorageResource code is from the below link,// https://github.com/Azure/azure-sdk-for-java/blob/4a4be12b6f35923a78528c33c777cdcc68ac8cd2/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/autoconfigure/storage/resource/BlobStorageResource.java#L44BlobStorageResourceasr = newBlobStorageResource(blobServiceClient, location, true);
try (OutputStreamos = ((WritableResource) asr).getOutputStream()) {
os.write("test".getBytes());
} catch (IOExceptione) {
e.printStackTrace();
}
}
}
Why is this not a Bug or a feature Request?
Maybe it's a bug, or I used it wrong.
Setup (please complete the following information if applicable):
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
Query Added
Setup information Added
The text was updated successfully, but these errors were encountered:
ghost
added
the
needs-triage
Workflow: This is a new issue that needs to be triaged to the appropriate team.
label
Jul 30, 2021
alzimmermsft
added
Client
This issue points to a problem in the data-plane of the library.
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Storage
Storage Service (Queues, Blobs, Files)
labels
Jul 30, 2021
ghost
removed
the
needs-triage
Workflow: This is a new issue that needs to be triaged to the appropriate team.
label
Jul 30, 2021
The Owner role doesn't grant access to blobs. You need one of Storage roles to access blob data see here
I.e. one of these three (depending on other operations you need, please pick one with least privilege that works for you).
[Hub Generated] Review request for Microsoft.Consumption to add version stable/2023-03-01 (Azure#23264)
* Adds base for updating Microsoft.Consumption from version stable/2022-09-01 to version 2023-03-01
* Updates readme
* Updates API version in new specs and examples
* Adding new API version contract changes to 2023-03-01 (Azure#22644)
* Added RI Tranastions query parameters to billing account scope. Updat… (Azure#22963)
* Added RI Tranastions query parameters to billing account scope. Updated example. Added documentation around size response limit
* Ran prettify and fixed typo
* Adding suppression for valid formats
* Single directives (Azure#23014)
---------
Co-authored-by: MattEberhart-MSFTE <[email protected]>
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
ClientThis issue points to a problem in the data-plane of the library.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatStorageStorage Service (Queues, Blobs, Files)
Query/Question
Output stream to azure storage blob service based on service principal authentication, I have assigned the service principal
owner
role to the azure storage account. The container can be created successfully, 'When committing the stream(com.azure.storage.blob.specialized.BlobOutputStream.BlockBlobOutputStream#commit
) in the close method, then found the following exception:Here's the test code.
Why is this not a Bug or a feature Request?
Maybe it's a bug, or I used it wrong.
Setup (please complete the following information if applicable):
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
The text was updated successfully, but these errors were encountered: