System topics in Azure Event Grid
A system topic in Event Grid represents one or more events published by Azure services such as Azure Storage and Azure Event Hubs. For example, a system topic may represent all blob events or only blob created and blob deleted events published for a specific storage account. In this example, when a blob is uploaded to the storage account, the Azure Storage service publishes a blob created event to the system topic in Event Grid, which then forwards the event to topic's subscribers that receive and process the event.
Note
Only Azure services can publish events to system topics. Therefore, you don't get an endpoint or access keys that you can use to publish events like you do for custom topics or event domains.
Azure services that support system topics
Here's the current list of Azure services that support creation of system topics on them.
- Azure API Center
- Azure API Management
- Azure App Configuration
- Azure App Service
- Azure Blob Storage
- Azure Cache for Redis
- Azure Communication Services
- Azure Container Registry
- Azure Data Box
- Azure Data Manager for Agriculture
- Azure Event Grid
- Azure Event Hubs
- Azure Health Data Services
- Azure IoT Hub
- Azure Key Vault
- Azure Kubernetes Service
- Azure Machine Learning
- Azure Maintenance Configuration
- Azure Maps
- Azure Media Services
- Azure Policy
- Azure Resource Notifications
- Azure resource groups
- Azure Service Bus
- Azure SignalR
- Azure Storage Actions
- Azure subscriptions
System topics as Azure resources
System topics are visible as Azure resources and provide the following capabilities:
- View system topics in the Azure portal
- Export Resource Manager templates for system topics and event subscriptions in the Azure portal
- Set up diagnostic logs for system topics
- Set up alerts on publish and delivery failures
Note
- Only one Azure Event Grid system topic is allowed per source (like subscription, resource group, etc.).
- A resource group is required for subscription-level system topic and can't be changed until deleted or moved to another subscription.
- Event Grid creates a system topic resource in the same Azure subscription that has the event source. For example, if you create a system topic for a storage account
ContosoStorage
in an Azure subscriptionContosoSubscription
, Event Grid creates the system topic in theContosoSubscription
. It's not possible to create a system topic in an Azure subscription that's different from the event source's Azure subscription.
Lifecycle of system topics
You can create a system topic in two ways:
Create an event subscription on an Azure resource as an extension resource, which automatically creates a system topic with the name in the format:
<Azure resource name>-<GUID>
. The system topic created in this way is automatically deleted when the last event subscription for the topic is deleted.Create a system topic for an Azure resource, and then create an event subscription for that system topic. When you use this method, you can specify a name for the system topic. The system topic isn't deleted automatically when the last event subscription is deleted. You need to manually delete it.
When you use the Azure portal, you're always using this method. When you create an event subscription using the Events page of an Azure resource, the system topic is created first and then the subscription for the topic is created. You can explicitly create a system topic first by using the Event Grid System Topics page and then create a subscription for that topic.
When you use CLI, REST, or Azure Resource Manager template, you can choose either of the above methods.
Important
We recommend that you create a system topic first and then create a subscription on the topic, as it's the latest way of creating system topics.
Failure to create system topics
The system topic creation fails if you have set up Azure policies in such a way that the Event Grid service can't create it. For example, you may have a policy that allows creation of only certain types of resources (for example: Azure Storage, Azure Event Hubs, and so on.) in the subscription.
In such cases, event flow functionality is preserved. However, metrics and diagnostic functionalities of system topics are unavailable.
If you require this functionality, allow creation of resources of the system topic type, and create the missing system topic as described in the Lifecycle of system topics section.
Location and resource group for a system topic
For Azure event sources that are in a specific region/location, system topic is created in the same location as the Azure event source. For example, if you create an event subscription for an Azure blob storage in East US, the system topic is created in East US. For global Azure event sources such as Azure subscriptions, resource groups, or Azure Maps, Event Grid creates the system topic in global location.
In general, system topic is created in the same resource group that the Azure event source is in. For event subscriptions created at Azure subscription scope, system topic is created in the Default-EventGrid resource group in the West US 2 region. If the resource group doesn't exist, Azure Event Grid creates it before creating the system topic.
Next steps
See the following articles: