does anyone have a sample for how to set up an eve...
# azure
a
does anyone have a sample for how to set up an event-grid subscription to a web hook (not an Azure Function) for writes to a storage account?
@tall-librarian-49374 You have helped me already so often, maybe you can with this, too? 🙂
one thing I don't get is the source parameter: it ought to be the storage account,but it's a string. When I look at the JSON of a manually created SystemTopic+Subscription, then I see that this parameter seems to point at the storage account, but not just the name:
/subscriptions/<our-subid>/resourceGroups/experiments/providers/Microsoft.Storage/storageAccounts/prototypeaksantivirus
is there an easy way to generate that string from within Pulumi? Or do I have to create it via interpolation? if the later, can I somehow get the subscriptionId under which I am running?
t
is there an easy way to generate that string from within Pulumi?
I suspect this is just the resource ID, so
storageAccount.id
a
ah, I can try that. thx!
the next question: when I create the SystemTopicEventSubscription, I want to set filter.includedEventTypes - however, where do I get the list of legal strings to use here? In the portal, while I can see JSON for the topic, I cannot see it for the subscription, so I can't just copy the values from there. And when I create the subscription manually in the portal, the value I choose looks human-friendly, but not like an identifier: "Blob Created"
(btw, re id: you are right, I just checked, the storage account's id is exactly that)
t
I’m not sure about includedEventTypes - maybe you can find Microsoft’s docs about that. They are the same for ARM templates etc.
👍 1
a
found it, I link it here because maybe you wanna add the link to your docs so others like me have it easier: https://docs.microsoft.com/en-us/azure/event-grid/event-schema-blob-storage?tabs=event-grid-event-schema
(the link is to the event types for blob-storage, but from there it's easy to navigate to others, too)
last question: we host the webhook in a ASP NET Core webapi. when creating the subscription in the portal, the webhook has to be running so the portal accepts the subscription. However, said webapi is deployed via Pulumi, too. So I'd need to somehow create a dependency for the
new eventgrid.SystemTopicEventSubscription
on the webapi running. I know I can add dependencies with
dependsOn
, but how can I make sure the webapi has started before the evengrid-subscription is created?
(on second thought, I don't even need dependsOn because I'll construct the endpointUrl from the appservice, but that doesn't change that I need to appservice to be actually up and running when the subscription is being created)