Hello Drew Stevens,
It sounds like you're trying to track Device Twin updates in Azure but are running into difficulty with event types. While you're correct that Device Twin updates don't directly trigger events in Event Hubs, you can still receive notifications about these changes by setting up some functionality with Azure Digital Twins.
Here's a solution you can try:
- Implement Twin-to-Twin Event Handling: Azure Digital Twins can emit events when a twin is updated, allowing you to trigger your Azure Function. Set up an Azure Function that connects to Event Grid, which can handle twin lifecycle events. You can subscribe your Azure Function to an Event Grid topic that receives these dual updates.
- Create Azure Function:
- Follow the documentation to create your Azure Function to listen for these events.
- Use packages like
Azure.DigitalTwins.CoreandMicrosoft.Azure.WebJobs.Extensions.EventGridto help with integration.
- Event Subscription: Use an Azure CLI command to create an Event Grid subscription that will send the twin events to your Azure Function. This ensures your function knows when a device twin is updated.
- Testing: Test it by making updates to the twin and checking if your Azure Function triggers as expected.
Here’s a high-level step for your Azure Function to update twins using the Event Grid connection:
az eventgrid event-subscription create --name <your-subscription-name> --source-resource-id <event-grid-topic-resource-id> --endpoint-type azurefunction --endpoint <your-function-endpoint>
Hope this helps!
Thank you!