Event grid filter events to all Azure functions in subscription

Dushyant Priyadarshee 121 Reputation points
2020-06-15T14:02:52.75+00:00

I am trying to filter events in event grid to be triggered only when an Azure function changes in my subscription (say configuration change, code updated or new function created/deleted).

The PowerShell script I am using is as follows:

# Provide an endpoint for handling the events. Must be formatted "https://your-endpoint-URL"
$myEndpoint = "https://myendpoint-function.azurewebsites.net"
$subscriptionId = "abcde-34df-4493-9477-notrealid980"

$eventSubscriptionName = "FunctionConfigChanges"

# Select the Azure subscription you want to subscribe to. You need this command only if the 
# current subscription is not the one you wish to subscribe to.
Set-AzContext -Subscription $subscriptionId

$includedEventTypes = "Microsoft.Resources.ResourceActionSuccess", "Microsoft.Resources.ResourceDeleteSuccess", "Microsoft.Resources.ResourceWriteSuccess"
$AdvancedFilters = @{operator="StringContains"; key="Subject"; Values=@("providers/Microsoft.Web/sites")}
New-AzEventGridSubscription -Endpoint $myEndpoint -EventSubscriptionName $eventSubscriptionName -IncludedEventType $includedEventTypes -AdvancedFilter $AdvancedFilters

This filters to all functions and websites (check $AdvancedFilters). Is there any way to get the event to be filtered to Azure functions only?
Any kind of solution help in Azure CLI, portal, Powershell or .net sdk is welcome.

Please note I had originally asked this question on stackoverflow.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,299 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
319 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful