I ran into an issue today while trying to publish a storage event trigger in Azure Synapse Analytics. After publishing, I got error messages that said “failed to subscribe” and “failed to activate”. The storage event trigger had been published, but it wouldn’t start. Help! 😱
The Error Messages
The error messages hinted at access control or permission issues:
Error: Failed to subscribe to events for event trigger [Trigger Name] (Trigger).
“The received access token is not valid: at least one of the claims ‘puid’ or ‘altsecid’ or ‘oid’ should be present. If you are accessing as application please make sure service principal is properly created in the tenant."
Error: Failed to activate [Trigger Name] (Trigger).
“The client ‘[GUID]’ with object id ‘[GUID]’ does not have authorization to perform action ‘Microsoft.EventGrid/eventSubscriptions/write’ over scope ‘/subscriptions/[Subscription ID]/resourceGroups/[Resource Group Name]/providers/Microsoft.Storage/storageAccounts/[Storage Account Name]/providers/Microsoft.EventGrid/eventSubscriptions/[GUID]’ or the scope is invalid. If access was recently granted, please refresh your credentials."
How I didn’t fix the errors
First, I re-read all the important purple notes in the documentation.
Then, I double-checked and triple-checked all the role-based access control settings.
Finally, I managed to dig up a Microsoft Q&A thread from August 2020. The last answer from FMSFT-4369 contained the solution!
How I fixed the failed to subscribe / failed to activate errors
Since we were only using Azure Synapse Analytics, we hadn’t registered the Data Factory resource provider. Once we registered Microsoft.DataFactory, everything worked perfectly! 🥳
TL;DR: Even if you are not using Azure Data Factory, you need to register the Microsoft.DataFactory resource provider for storage event triggers to work properly in Azure Synapse Analytics.
(Don’t ask me why! But at least it works now 😄)
About the Author
Cathrine Wilhelmsen is a Microsoft Data Platform MVP, BimlHero Certified Expert, international speaker, author, blogger, organizer, and chronic volunteer. She loves data and coding, as well as teaching and sharing knowledge - oh, and sci-fi, coffee, chocolate, and cats 🤓