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.
5,109 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
394 questions
0 comments No comments
{count} votes

Accepted answer
  1. Roman Kiss 2,246 Reputation points
    2020-06-17T15:53:38.603+00:00

    Hi,

    see my answer on stackoverflow.

    Thanks

    Roman

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.