Muokkaa

Jaa


Subscribe to events raised by Azure Resource Notifications - ContainerService Event Resources system topic (Preview)

This article explains the steps needed to subscribe to events published by Azure Resource Notifications - ContainerService Event Resources. For detailed information about these events, see Azure Resource Notifications - ContainerService Event Resources.

Create Health Resources system topic

  1. Set the account to the Azure subscription where you wish to create the system topic.

    az account set –s AZURESUBSCRIPTIONID
    
  2. Create a system topic of type microsoft.resourcenotifications.containerserviceeventresources using the az eventgrid system-topic create command.

    az eventgrid system-topic create --name SYSTEMTOPICNAME --resource-group RESOURCEGROUPNAME --source /subscriptions/AZURESUBSCRIPTIONID --topic-type microsoft.resourcenotifications.containerserviceeventresources --location Global        
    

Subscribe to events

Create an event subscription for the above topic by using the az eventgrid system-topic event-subscription create command.

The following sample command creates an event subscription for the ScheduledEventEmitted event.

az eventgrid system-topic event-subscription create --name EVENTSUBSCRIPTIONNAME --resource-group RESOURCEGROUPNAME --system-topic-name SYSTEMTOPICNAME –included-event-types Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted --endpoint /subscriptions/AZURESUBSCRIPTIONID/resourceGroups/RESOURCEGROUPNAME/providers/Microsoft.EventHub/namespaces/MYEVENTHUBSNAMESPACE/eventhubs/MYEVENTHUB --endpoint-type eventhub        

If you don't specify included-event-types, all the event types are included by default.

To filter events from a specific resource, use the --subject-begins-with parameter. The example shows how to subscribe to ScheduledEventsEmitted events for resources in a specified resource group.

az eventgrid system-topic event-subscription create --name EVENTSUBSCRIPTIONNAME --resource-group RESOURCEGROUPNAME --system-topic-name SYSTEMTOPICNAME –included-event-types Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted --endpoint /subscriptions/AZURESUBSCRIPTIONID/resourceGroups/RESOURCEGROUPNAME/providers/Microsoft.EventHub/namespaces/MYEVENTHUBSNAMESPACE/eventhubs/MYEVENTHUB --endpoint-type eventhub --subject-begins-with /subscriptions/AZURESUBSCRIPTIONID/resourceGroups/SOURCERESOURCEGROUP/  

Delete event subscription and system topic

To delete the event subscription, use the az eventgrid system-topic event-subscription delete command. Here's an example:

az eventgrid system-topic event-subscription delete --name EVENTSUBSCRIPTIONNAME --resourcegroup RESOURCEGROUPNAME --system-topic-name SYSTEMTOPICNAME

To delete the system topic, use the az eventgrid system-topic delete command. Here's an example:

az eventgrid system-topic delete --name SYSTEMTOPICNAME --resource-group RESOURCEGROUPNAME

Filtering examples

Subscribe to Azure Kubernetes Cluster Scheduled Events by a Specific Cluster

You might want to filter the Azure Kubernetes Cluster Scheduled Events by a specific cluster on the subscriber end. This filtering helps ensure that you only receive notifications from clusters that are of interest to you.

az eventgrid system-topic event-subscription create \
 --name EVENTSUBSCRIPTIONNAME \
 --resource-group RESOURCEGROUPNAME \
 --system-topic-name SYSTEMTOPICNAME \
 --included-event-types Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted \
 --endpoint /subscriptions/000000000-0000-0000-0000-0000000000000/resourceGroups/RESOURCEGROUPNAME/providers/Microsoft.EventHub/namespaces/EVENTHUBNAMESPACE/eventhubs/EVENTHUBNAME \
 --endpoint-type evenhub \
 --advanced-filter data.resourceInfo.properties.resources StringContains clusterName

Subscribe to Azure Kubernetes Cluster Scheduled Events by "Completed" Event Status

You might want to filter the Azure Kubernetes Cluster Scheduled Events by a specific status, for example, "Completed" on the subscriber end. This filtering helps ensure that you only receive notifications from events that are of interest to you.

az eventgrid system-topic event-subscription create \
 --name EVENTSUBSCRIPTIONNAME \
 --resource-group RESOURCEGROUPNAME \
 --system-topic-name SYSTEMTOPICNAME \
 --included-event-types Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted \
 --endpoint /subscriptions/000000000-0000-0000-0000-0000000000000/resourceGroups/RESOURCEGROUPNAME/providers/Microsoft.EventHub/namespaces/EVENTHUBNAMESPACE/eventhubs/EVENTHUBNAME \
 --endpoint-type evenhub \
 --advanced-filter data.resourceInfo.properties.eventStatus StringContains Completed

Contact us

If you have any questions or feedback on this feature, don't hesitate to reach us at arnsupport@microsoft.com.

To better assist you with specific feedback about a certain event, provide the following information:

For missing events:

  • System topic type name
  • Approximate timestamp in UTC when the operation was executed
  • Base resource ID for which the notification was generated
  • Navigate to your resource in Azure portal and select JSON view at the far right corner. Resource ID is the first field on the JSON view page.
  • Expected event type
  • Operation executed (for example, VM started or stopped, Storage account created etc.)
  • Description of issue encountered (for example, VM started and no Microsoft.ResourceNotifications.HealthResources.AvailabilityStatusChanged event generated)
  • If possible, provide the correlation ID of operation executed

For event that was delayed or has unexpected content

  • System topic type name
  • Entire contents of the notification excluding data.resourceInfo.properties
  • Description of issue encountered and impacted field values

Ensure that you aren't providing any end user identifiable information while you're sharing this data.

Next steps

For detailed information about these events, see Azure Resource Notifications - Container Service Events.