MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.25k stars 21.42k forks source link

Insufficient RBAC roles for a queue trigger with a managed identity #120932

Open mderriey opened 7 months ago

mderriey commented 7 months ago

Hi 👋

The feedback applied specifically to the "Grant permissions to the identity" section.

The RBAC roles listed for a queue trigger are Storage Queue Data Reader and Storage Queue Data Message Processor.

However, these are not sufficient for the case where a message fails processing and is released to the queue. This is an update message operation which is not covered by the roles mentioned in the documentation. The behavior of releasing the message to the queue is baked in the Storage Queues extension, my application doesn't have any custom code using the Storage Queues client library.

The stack trace looks something like:

Azure.RequestFailedException: This request is not authorized to perform this operation using this permission.
  at Azure.Storage.Queues.MessageIdRestClient+<UpdateAsync>
  at Azure.Storage.Queues.QueueClient+<UpdateMessageInternal>
  at Azure.Storage.Queues.QueueClient+<UpdateMessageAsync>
  at Microsoft.Azure.WebJobs.Host.Queues.QueueProcessor+<ReleaseMessageAsync>
  at Microsoft.Azure.WebJobs.Host.Queues.QueueProcessor+<CompleteProcessingMessageAsync>
  at Microsoft.Azure.WebJobs.Extensions.Storage.Common.Listeners.QueueListener+<ProcessMessageAsync>

The issue is that this exception bubbles up to the WebScriptHostExceptionHandler which shuts down the host, meaning the app is down and doesn't process messages for a couple of minutes in our case.

Some details:

For us, the workaround is to assign the Storage Queue Data Contributor role to the identity we're using.


Document Details

⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Naveenommi-MSFT commented 7 months ago

@mderriey Thanks for your feedback! We will investigate and update as appropriate.

ggailey777 commented 7 months ago

Thanks @mderriey for the feedback. @mattchenderson can you verify this and I'll update the article?

RyanHill-MSFT commented 7 months ago

Thanks for looking into this @ggailey777 and @mattchenderson.