az eventgrid topic event-subscription
Manage event subscriptions of topic.
Commands
Name | Description | Type | Status |
---|---|---|---|
az eventgrid topic event-subscription create |
Create a new event subscription for a topic. |
Core | GA |
az eventgrid topic event-subscription delete |
Delete an event subscription of a topic. |
Core | GA |
az eventgrid topic event-subscription list |
List event subscriptions of a specific topic. |
Core | GA |
az eventgrid topic event-subscription show |
Get the details of an event subscription of a topic. |
Core | GA |
az eventgrid topic event-subscription update |
Update an event subscription of a topic. |
Core | GA |
az eventgrid topic event-subscription create
Create a new event subscription for a topic.
az eventgrid topic event-subscription create --name
--resource-group
--topic-name
[--aad-app-id]
[--aad-tenant-id]
[--advanced-filter]
[--deadletter-endpoint]
[--delivery-attribute-mapping]
[--enable-advanced-filtering-on-arrays {false, true}]
[--endpoint]
[--endpoint-type {azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook}]
[--event-delivery-schema {cloudeventschemav1_0, custominputschema, eventgridschema}]
[--event-ttl]
[--expiration-date]
[--included-event-types]
[--labels]
[--max-delivery-attempts]
[--max-events-per-batch]
[--pref-batch-size-kb]
[--qttl]
[--subject-begins-with]
[--subject-case-sensitive {false, true}]
[--subject-ends-with]
Examples
Create a new event subscription for an Event Grid topic, using default filters.
az eventgrid topic event-subscription create --name es1 \
-g rg1 --topic-name topic1 \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code
Create a new event subscription for an Event Grid topic, with a filter specifying a subject prefix.
az eventgrid topic event-subscription create --name es4 \
-g rg1 --topic-name topic1 \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code \
--subject-begins-with mysubject_prefix
Create a new event subscription for an Event Grid topic, using default filters, and CloudEvent V 1.0 as the delivery schema.
az eventgrid topic event-subscription create -n es2 \
-g rg1 --topic-name topic1 \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code \
--event-delivery-schema cloudeventschemav1_0
Create a new event subscription for an Event Grid topic, with a deadletter destination and custom retry policy of maximum 10 delivery attempts and an Event TTL of 2 hours (whichever happens earlier) and expiration date.
az eventgrid topic event-subscription create --name es2 \
-g rg1 --topic-name topic1 \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code \
--deadletter-endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/s2/blobServices/default/containers/blobcontainer1 \
--max-delivery-attempts 10 --event-ttl 120 --expiration-date "2022-10-31"
Create a new event subscription for an Event Grid topic, using Azure Active Directory enabled Webhook as a destination.
az eventgrid topic event-subscription create --name es1 \
-g rg1 --topic-name topic1 \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code
--azure-active-directory-tenant-id azureactivedirectorytenantid
--azure-active-directory-application-id-or-uri azureactivedirectoryapplicationidoruri
Create a new event subscription for an Event Grid topic, using Azure Function as destination.
az eventgrid topic event-subscription create -n es1 \
-g rg1 --topic-name topic1 \
--endpoint /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Web/sites/{functionappname}/functions/{functionname} --endpoint-type azurefunction
Create a new event subscription for an Event Grid topic using Storage Queue as destination with a ttl of 5 mins
az eventgrid topic event-subscription create -n es1 \
-g rg1 --topic-name topic1 \
--endpoint-type storagequeue \
--endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/queueservices/default/queues/q1 \
--storage-queue-msg-ttl 300
Create a new event subscription for an Event Grid topic and enable advanced filtering on arrays
az eventgrid topic event-subscription create -n es1 \
-g rg1 --topic-name topic1 \
--endpoint /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Web/sites/{functionappname}/functions/{functionname} --endpoint-type azurefunction \
--enable-advanced-filtering-on-arrays true
Required Parameters
Name of the event subscription.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the topic.
Optional Parameters
The Azure Active Directory Application Id or Uri to get the access token that will be included as the bearer token in delivery requests. Applicable only for webhook as a destination.
The Azure Active Directory Tenant Id to get the access token that will be included as the bearer token in delivery requests. Applicable only for webhook as a destination.
An advanced filter enables filtering of events based on a specific event property.
Usage: --advanced-filter KEY[.INNERKEY] FILTEROPERATOR VALUE [VALUE ...]
StringIn: --advanced-filter data.Color StringIn Blue Red Orange Yellow
StringNotIn: --advanced-filter data.Color StringNotIn Blue Red Orange Yellow
StringContains: --advanced-filter subject StringContains Blue Red
StringNotContains: --advanced-filter subject StringNotContains Blue Red
StringBeginsWith: --advanced-filter subject StringBeginsWith Blue Red
StringNotBeginsWith: --advanced-filter subject StringNotBeginsWith Blue Red
StringEndsWith: --advanced-filter subject StringEndsWith img png jpg
StringNotEndsWith: --advanced-filter subject StringNotEndsWith img png jpg
NumberIn: --advanced-filter data.property1 NumberIn 5 10 20
NumberInRange --advanced-filter data.property1 NumberInRange 5,10 20,30 40,50
NumberNotIn: --advanced-filter data.property2 NumberNotIn 100 200 300
NumberNotInRange: --advanced-filter data.property2 NumberNotInRange 100,110 200,210 300,310
NumberLessThan: --advanced-filter data.property3 NumberLessThan 100
NumberLessThanOrEquals: --advanced-filter data.property2 NumberLessThanOrEquals 100
NumberGreaterThan: --advanced-filter data.property3 NumberGreaterThan 100
NumberGreaterThanOrEquals: --advanced-filter data.property2 NumberGreaterThanOrEquals 100
BoolEquals: --advanced-filter data.property3 BoolEquals true
IsNullOrUndefined: --advanced-filter data.property3 IsNullOrUndefined
IsNotNull: --advanced-filter data.property3 IsNotNull
Multiple advanced filters can be specified by using more than one --advanced-filter
argument.
The Azure resource ID of an Azure Storage blob container destination where EventGrid should deadletter undeliverable events for this event subscription.
Example: --deadletter-endpoint /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/sa1/blobServices/default/containers/containerName.
Add delivery attribute mapping to send additional information via HTTP headers when delivering events. This attribute is valid for all destination types except StorageQueue. Multiple attributes can be specified by using more than one --delivery-attribute-mapping
argument.
Usage: --delivery-attribute-mapping attribute-name attribute-type attribute-value [attribute-is-secret] Static Attribute Mapping: --delivery-attribute-mapping somename static somevalue Static Attribute Mapping: --delivery-attribute-mapping somename static somevalue false Static Attribute Mapping: --delivery-attribute-mapping somename static somevalue true Dynamic Attribute Mapping: --delivery-attribute-mapping somename dynamic somevalue Both Static and Dynamic: --delivery-attribute-mapping somename dynamic somevalue --delivery-attribute-mapping somename2 static somevalue.
Allows advanced filters to be evaluated against an array of values instead of expecting a singular value.
Endpoint where EventGrid should deliver events matching this event subscription. For webhook endpoint type, this should be the corresponding webhook URL. For other endpoint types, this should be the Azure resource identifier of the endpoint. It is expected that the destination endpoint to be already created and available for use before executing any Event Grid command.
The type of the destination endpoint.
The schema in which events should be delivered for this event subscription. By default, events will be delivered in the same schema in which they are published (based on the corresponding topic's input schema).
Event time to live (in minutes). Must be a number between 1 and 1440.
Date or datetime (in UTC, e.g. '2018-11-30T11:59:59+00:00' or '2018-11-30') after which the event subscription would expire. By default, there is no expiration for the event subscription.
A space-separated list of event types (e.g., Microsoft.Storage.BlobCreated and Microsoft.Storage.BlobDeleted). In order to subscribe to all default event types, do not specify any value for this argument. For event grid topics, event types are customer defined. For Azure events, e.g., Storage Accounts, IoT Hub, etc., you can query their event types using this CLI command 'az eventgrid topic-type list-event-types'.
A space-separated list of labels to associate with this event subscription.
Maximum number of delivery attempts. Must be a number between 1 and 30.
Maximum number of events in a batch. Must be a number between 1 and 5000.
Preferred batch size in kilobytes. Must be a number between 1 and 1024.
Storage queue message time to live in seconds.
An optional string to filter events for an event subscription based on a prefix. Wildcard characters are not supported.
Specify to indicate whether the subject fields should be compared in a case sensitive manner. True if flag present.
An optional string to filter events for an event subscription based on a suffix. Wildcard characters are not supported.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az eventgrid topic event-subscription delete
Delete an event subscription of a topic.
az eventgrid topic event-subscription delete --name
--resource-group
--topic-name
[--yes]
Examples
Delete an event subscription for an Event Grid topic.
az eventgrid topic event-subscription delete --name es1 \
-g rg1 --topic-name topic1 \
Required Parameters
Name of the event subscription.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the topic.
Optional Parameters
Do not prompt for confirmation.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az eventgrid topic event-subscription list
List event subscriptions of a specific topic.
az eventgrid topic event-subscription list --resource-group
--topic-name
[--odata-query]
Examples
List all event subscriptions created for an Event Grid topic.
az eventgrid topic event-subscription list -g rg1 --topic-name topic1
Required Parameters
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the topic.
Optional Parameters
The OData query used for filtering the list results. Filtering is currently allowed on the Name property only. The supported operations include: CONTAINS, eq (for equal), ne (for not equal), AND, OR and NOT.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az eventgrid topic event-subscription show
Get the details of an event subscription of a topic.
az eventgrid topic event-subscription show --name
--resource-group
--topic-name
[--full-ed-url {false, true}]
[--include-attrib-secret {false, true}]
Examples
Show the details of an event subscription for an Event Grid topic.
az eventgrid topic event-subscription show --name es1 \
-g rg1 --topic-name topic1
Show the details of an event subscription for an Event Grid topic include any static delivery attribute secrets.
az eventgrid topic event-subscription show --name es1 \
-g rg1 --topic-name topic1 --include-attrib-secret
Required Parameters
Name of the event subscription.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the topic.
Optional Parameters
Specify to indicate whether the full endpoint URL should be returned. True if flag present.
Indicate whether any static delivery attribute secrets should be returned. True if flag present.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az eventgrid topic event-subscription update
Update an event subscription of a topic.
az eventgrid topic event-subscription update --name
--resource-group
--topic-name
[--advanced-filter]
[--deadletter-endpoint]
[--delivery-attribute-mapping]
[--enable-advanced-filtering-on-arrays {false, true}]
[--endpoint]
[--included-event-types]
[--labels]
[--qttl]
[--subject-begins-with]
[--subject-ends-with]
[--update-endpoint-type {azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook}]
Examples
Update an event subscription for an Event Grid topic to specify a new endpoint.
az eventgrid topic event-subscription update --name es1 \
-g rg1 --topic-name topic1 --endpoint https://contoso.azurewebsites.net/api/f1?code=code
Update an event subscription for an Event Grid topic to specify a new subject-ends-with filter.
az eventgrid topic event-subscription update --name es2 \
-g rg1 --topic-name topic1 \
--subject-ends-with .jpg
Update an event subscription for an Event Grid topic to specify a new endpoint and a new subject-ends-with filter a new list of included event types.
az eventgrid topic event-subscription update --name es3 \
-g rg1 --topic-name topic1 \
--subject-ends-with .png \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code
--included-event-types Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted
Update an event subscription for an Azure Event Grid topic, to include a deadletter destination.
az eventgrid topic event-subscription update --name es2 \
-g rg1 --topic-name topic1 \
--deadletter-endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/blobServices/default/containers/blobcontainer1
Update an event subscription for an Azure Event Grid topic, using advanced filters.
az eventgrid topic event-subscription update --name es3 \
-g rg1 --topic-name topic1 \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code
--advanced-filter data.blobType StringIn BlockBlob
--advanced-filter data.url StringBeginsWith https://myaccount.blob.core.windows.net
Update an event subscription for an Event Grid topic with Storage Queue as destination with ttl of 5 mins
az eventgrid topic event-subscription update -n es1 \
-g rg1 --topic-name topic1 \
--storage-queue-msg-ttl 300
Update an event subscription for an Event Grid topic with advanced filtering on arrays enabled
az eventgrid topic event-subscription update -n es1 \
-g rg1 --topic-name topic1 \
--enable-advanced-filtering-on-arrays true
Required Parameters
Name of the event subscription.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the topic.
Optional Parameters
An advanced filter enables filtering of events based on a specific event property.
Usage: --advanced-filter KEY[.INNERKEY] FILTEROPERATOR VALUE [VALUE ...]
StringIn: --advanced-filter data.Color StringIn Blue Red Orange Yellow
StringNotIn: --advanced-filter data.Color StringNotIn Blue Red Orange Yellow
StringContains: --advanced-filter subject StringContains Blue Red
StringNotContains: --advanced-filter subject StringNotContains Blue Red
StringBeginsWith: --advanced-filter subject StringBeginsWith Blue Red
StringNotBeginsWith: --advanced-filter subject StringNotBeginsWith Blue Red
StringEndsWith: --advanced-filter subject StringEndsWith img png jpg
StringNotEndsWith: --advanced-filter subject StringNotEndsWith img png jpg
NumberIn: --advanced-filter data.property1 NumberIn 5 10 20
NumberInRange --advanced-filter data.property1 NumberInRange 5,10 20,30 40,50
NumberNotIn: --advanced-filter data.property2 NumberNotIn 100 200 300
NumberNotInRange: --advanced-filter data.property2 NumberNotInRange 100,110 200,210 300,310
NumberLessThan: --advanced-filter data.property3 NumberLessThan 100
NumberLessThanOrEquals: --advanced-filter data.property2 NumberLessThanOrEquals 100
NumberGreaterThan: --advanced-filter data.property3 NumberGreaterThan 100
NumberGreaterThanOrEquals: --advanced-filter data.property2 NumberGreaterThanOrEquals 100
BoolEquals: --advanced-filter data.property3 BoolEquals true
IsNullOrUndefined: --advanced-filter data.property3 IsNullOrUndefined
IsNotNull: --advanced-filter data.property3 IsNotNull
Multiple advanced filters can be specified by using more than one --advanced-filter
argument.
The Azure resource ID of an Azure Storage blob container destination where EventGrid should deadletter undeliverable events for this event subscription.
Add delivery attribute mapping to send additional information via HTTP headers when delivering events. This attribute is valid for all destination types except StorageQueue. Multiple attributes can be specified by using more than one --delivery-attribute-mapping
argument.
Usage: --delivery-attribute-mapping attribute-name attribute-type attribute-value [attribute-is-secret] Static Attribute Mapping: --delivery-attribute-mapping somename static somevalue Static Attribute Mapping: --delivery-attribute-mapping somename static somevalue false Static Attribute Mapping: --delivery-attribute-mapping somename static somevalue true Dynamic Attribute Mapping: --delivery-attribute-mapping somename dynamic somevalue Both Static and Dynamic: --delivery-attribute-mapping somename dynamic somevalue --delivery-attribute-mapping somename2 static somevalue.
Allows advanced filters to be evaluated against an array of values instead of expecting a singular value.
Endpoint where EventGrid should deliver events matching this event subscription. For webhook endpoint type, this should be the corresponding webhook URL. For other endpoint types, this should be the Azure resource identifier of the endpoint. It is expected that the destination endpoint to be already created and available for use before executing any Event Grid command.
A space-separated list of event types (e.g., Microsoft.Storage.BlobCreated and Microsoft.Storage.BlobDeleted). In order to subscribe to all default event types, do not specify any value for this argument. For event grid topics, event types are customer defined. For Azure events, e.g., Storage Accounts, IoT Hub, etc., you can query their event types using this CLI command 'az eventgrid topic-type list-event-types'.
A space-separated list of labels to associate with this event subscription.
Storage queue message time to live in seconds.
An optional string to filter events for an event subscription based on a prefix. Wildcard characters are not supported.
An optional string to filter events for an event subscription based on a suffix. Wildcard characters are not supported.
The type of the destination endpoint.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Azure CLI