Skip to main content

Azure Event Hook (Event Grid)

Send Toggly feature flag events to Azure Event Grid (custom topic) so you can trigger workflows (Functions, Logic Apps, Event Handlers) whenever flags change.

What you'll need​

  • Azure Event Grid Topic Endpoint (custom topic), including /api/events
  • Azure Event Grid access key (key1 or key2)
  • A Toggly user with permission to manage integrations for the application

Step-by-step setup​

1) Create an Event Grid custom topic​

In Azure Portal:

  • Go to Event Grid Topics
  • Create a Custom Topic
  • Copy the Topic endpoint (it should look like: https://<topic>.<region>-1.eventgrid.azure.net/api/events)
  • Open Access keys and copy Key 1 (or Key 2)

2) Create the integration in Toggly​

In Toggly:

  • Open your Application
  • Go to Integrations
  • Choose Azure Event Hook
  • Select the Toggly Environment (e.g., Production)
  • Paste:
    • Event Grid Topic Endpoint
    • Access Key
  • Select which events you want to send
  • Click Continue

After creating, you'll be taken to the integration's configuration page.

3) Send a test event​

On the integration's page:

  • Click Send Test Event
  • Confirm the request is accepted in Azure (or in your downstream handler)

4) Verify real events (toggle a flag)​

Now toggle a flag (or change rollout percentage) in that environment and confirm you see the event in your handler.

Events sent​

Toggly sends an Event Grid event array (application/json) to your topic endpoint. Each item follows Event Grid’s expected shape:

  • eventType: Toggly.FeatureFlags.<EventName>
    Example: Toggly.FeatureFlags.FlagStatusChanged
  • subject: /toggly/apps/<appId>/environments/<env>/flags/<featureKey>
  • data: includes the Toggly flag event fields (app/env/feature, previous/new value, tags, changedBy, timestamp, filters snapshot, etc.)

Supported Toggly event types​

  • FlagCreated
  • FlagStatusChanged
  • RolloutPercentageUpdated
  • FlagDeleted

Authentication​

Toggly authenticates requests to Event Grid custom topics using the aeg-sas-key header (your topic access key).

Key rotation​

To rotate keys safely:

  1. In Azure, switch to the other key (Key1 ⇄ Key2) or regenerate one.
  2. In Toggly, open the integration page and paste the new value into New Access Key, then Save Changes.

Metrics​

The integration records:

  • Deliveries
  • Error rate
  • Average latency

These are shown on the integration page under Metrics (last 30 days).

Troubleshooting​

  • 401/403 from Event Grid: verify the aeg-sas-key value is correct (topic key, not subscription key).
  • 404: ensure the endpoint includes /api/events.
  • No events: confirm the integration is enabled and the correct events are checked for that environment.