Open paulbatum opened 6 years ago
I have successfully gotten this to work, but requires two arm templates with a powershell script in between to extract the eventgrid key from https://
This is definitely a must!
We're making some progress on enabling this, using key vault as the mechanism of key storage. We have most of the pieces in PR and we're doing some end to end testing. @mattchenderson is going to post an example here once he has an ARM template using this that works.
Any update on this?
The ARM key management portion of this issue has been addressed - there are now APIs for getting the required system key for the EventGrid subscription. However, there is still a race condition issue tracked by https://github.com/Azure/azure-functions-host/issues/4661 which still needs to be addressed.
Seems like race condition issue is now closed? Couldn't find documentation on the topic raised.
@mattchenderson Have you taken another look at this now that all the pending issues have been resolved?
This should be unblocked now. The API doc for host keys is here: Web Apps - List Host Keys. That API returns both master key and system keys. Also, @jcbrooks92 has published a sample template here which shows how to use these APIs to create an EventGrid subscription. I think we're good to close this now.
@mathewc The sample from @jcbrooks92 only appears to work if the Function is already deployed and running (which appears to generate the event grid system key). The original request from @paulbatum is requesting the ability to create the Function and Subscription in the same ARM template - is that possible yet? If so, is there an example ARM template that demonstrates how?
@briandunnington this behavior is what's expected with Eventgrid (@mathewc can confirm). By default v2 functions do not have all the extensions installed so they must be installed manually or have code deployed that contains the extensions. In my sample I use run from package to deploy the default Eventgrid function. Something I haven't tried yet was using bundles but this would still require a code deployment.
@jcbrooks92 Understood that this is currently how it works. I think this issue is more of a feature request to change the behavior so that it is possible to deploy the Event Grid subscription at the same time (in the same ARM template) as the Function app.
What if the ARM template configured the function app to use run-from-package via an appsetting, pointing at a blob. That way the content including the eventgrid extension would already be present. Anyone had a chance to try this?
@paulbatum I've tested this out in my example template. As long as the correct dependency flow is setup (Eventgrid dependsOn function app), I believe it should deploy in time. Granted I've only used a very simple function with one eventgrid trigger.
It needs to be possible to create a V2 function app, along with an Event Grid subscription that is configured to deliver events to the function app, all within a single ARM template. Today this is difficult to due limitations with the functions ARM keys API (discussed here).