Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.24k stars 4.58k forks source link

Trigger permission issue causes the application to be terminated #43940

Open xuehongg opened 4 months ago

xuehongg commented 4 months ago

Library name and version

Azure.Storage.Blob 5.x

Describe the bug

Some times users may not set the correct permission on blob for the blog trigger, on queue for the queue trigger, sb for the sb trigger etc. It is expected that the trigger will fail with access denied error. But we do not expect the application to be terminated. The termination has big impact if the logic app is the application, because logic app workflow attempts to run the trigger periodically, and there are other workflows in the same logic apps.,

======================================================== Azure.RequestFailedException : This request is not authorized to perform this operation. RequestId:8c00bd60-001e-00e1-7a1d-cd94ee000000 Time:2022-09-20T18:21:04.3001620Z Status: 403 (This request is not authorized to perform this operation.) ErrorCode: AuthorizationFailure

Content: <?xml version="1.0" encoding="utf-8"?>AuthorizationFailureThis request is not authorized to perform this operation. RequestId:8c00bd60-001e-00e1-7a1d-cd94ee000000 Time:2022-09-20T18:21:04.3001620Z

Headers: Server: Microsoft-HTTPAPI/2.0 x-ms-request-id: 8c00bd60-001e-00e1-7a1d-cd94ee000000 x-ms-client-request-id: 9291d924-6e2e-4a4c-b60e-e5f0e4a7e956 x-ms-error-code: AuthorizationFailure Date: Tue, 20 Sep 2022 18:21:03 GMT Content-Length: 246 Content-Type: application/xml

at async Azure.Storage.Blobs.ContainerRestClient.ListBlobFlatSegmentAsync(String prefix,String marker,Nullable1 maxresults,IEnumerable1 include,Nullable1 timeout,CancellationToken cancellationToken) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Azure.Storage.Blobs.BlobContainerClient.GetBlobsInternal(String marker,BlobTraits traits,BlobStates states,String prefix,Nullable1 pageSizeHint,Boolean async,CancellationToken cancellationToken) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Azure.Storage.Blobs.Models.GetBlobsAsyncCollection.GetNextPageAsync(String continuationToken,Nullable1 pageSizeHint,Boolean async,CancellationToken cancellationToken) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.ValueTask1.get_Result() at async Azure.Storage.StorageCollectionEnumerator1.StorageAsyncPageable.AsPages[T](String continuationToken,Nullable1 pageHintSize) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore1.GetResult(Int16 token) at async Azure.Storage.StorageCollectionEnumerator1.StorageAsyncPageable.AsPages[T](String continuationToken,Nullable1 pageHintSize) at async Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Listeners.ScanBlobScanLogHybridPollingStrategy.PollNewBlobsAsync(BlobContainerClient container,ContainerScanInfo containerScanInfo,String clientRequestId,CancellationToken cancellationToken) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Listeners.ScanBlobScanLogHybridPollingStrategy.PollAndNotify(BlobContainerClient container,ContainerScanInfo containerScanInfo,List1 failedNotifications,CancellationToken cancellationToken) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Extensions.Storage.Blobs.Listeners.ScanBlobScanLogHybridPollingStrategy.ExecuteAsync(CancellationToken cancellationToken) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Extensions.Storage.Common.Timers.TaskSeriesTimer.RunAsync(CancellationToken cancellationToken)

Expected behavior

The AuthorizationFailure is logged, but the application should not be terminated.

Actual behavior

The application is terminated.

Reproduction Steps

  1. Create a logic app
  2. Create a workflow in the logic app to use a blob trigger
  3. Remove the permission on the blob trigger
  4. Now you will the logic app repeatedly starts and terminates.

Environment

No response

github-actions[bot] commented 4 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.