az eventgrid domain event-subscription

Manage event subscriptions of domain.

Commands

Name Description Type Status
az eventgrid domain event-subscription create

Create a new event subscription for a domain.

Core GA
az eventgrid domain event-subscription delete

Delete an event subscription of a domain.

Core GA
az eventgrid domain event-subscription list

List event subscriptions of a specific domain.

Core GA
az eventgrid domain event-subscription show

Get the details of an event subscription of a domain.

Core GA
az eventgrid domain event-subscription update

Update an event subscription of a domain.

Core GA

az eventgrid domain event-subscription create

Create a new event subscription for a domain.

az eventgrid domain event-subscription create --domain-name
                                              --name
                                              --resource-group
                                              [--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 domain, using default filters.

az eventgrid domain event-subscription create --name es1 \
    -g rg1 --domain-name domain1 \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription for an Event Grid domain, with a filter specifying a subject prefix.

az eventgrid domain event-subscription create --name es4 \
    -g rg1 --domain-name domain1 \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code \
    --subject-begins-with mysubject_prefix

Create a new event subscription for an Event Grid domain, using default filters, and CloudEvent V 1.0 as the delivery schema.

az eventgrid domain event-subscription create -n es2 \
    -g rg1 --domain-name domain1 \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code \
    --event-delivery-schema cloudeventschemav1_0

Create a new event subscription for an Event Grid domain, 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 domain event-subscription create --name es2 \
    -g rg1 --domain-name domain1 \
    --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 domain, using Azure Active Directory enabled Webhook as a destination.

az eventgrid domain event-subscription create --name es1 \
    -g rg1 --domain-name domain1 \
    --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 domain, using Azure Function as destination.

az eventgrid domain event-subscription create -n es1 \
    -g rg1 --domain-name domain1 \
    --endpoint /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Web/sites/{functionappname}/functions/{functionname} --endpoint-type azurefunction

Create a new event subscription for an Event Grid domain using Storage Queue as destination with a ttl of 5 mins

az eventgrid domain event-subscription create -n es1 \
    -g rg1 --domain-name domain1 \
    --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 domain and enable advanced filtering on arrays

az eventgrid domain event-subscription create -n es1 \
    -g rg1 --domain-name domain1 \
    --endpoint /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Web/sites/{functionappname}/functions/{functionname} --endpoint-type azurefunction \
    --enable-advanced-filtering-on-arrays true

Required Parameters

--domain-name

Name of the domain.

--name -n

Name of the event subscription.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--aad-app-id --azure-active-directory-application-id-or-uri

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.

--aad-tenant-id --azure-active-directory-tenant-id

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.

--advanced-filter

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.

--deadletter-endpoint

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.

--delivery-attribute-mapping -d

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.

--enable-advanced-filtering-on-arrays --enable-af-arr

Allows advanced filters to be evaluated against an array of values instead of expecting a singular value.

accepted values: false, true
--endpoint

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.

--endpoint-type

The type of the destination endpoint.

accepted values: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
default value: webhook
--event-delivery-schema

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).

accepted values: cloudeventschemav1_0, custominputschema, eventgridschema
--event-ttl

Event time to live (in minutes). Must be a number between 1 and 1440.

default value: 1440
--expiration-date

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.

--included-event-types

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'.

--labels

A space-separated list of labels to associate with this event subscription.

--max-delivery-attempts

Maximum number of delivery attempts. Must be a number between 1 and 30.

default value: 30
--max-events-per-batch

Maximum number of events in a batch. Must be a number between 1 and 5000.

--pref-batch-size-kb --preferred-batch-size-in-kilobytes

Preferred batch size in kilobytes. Must be a number between 1 and 1024.

--qttl --storage-queue-msg-ttl

Storage queue message time to live in seconds.

--subject-begins-with

An optional string to filter events for an event subscription based on a prefix. Wildcard characters are not supported.

--subject-case-sensitive

Specify to indicate whether the subject fields should be compared in a case sensitive manner. True if flag present.

accepted values: false, true
default value: False
--subject-ends-with

An optional string to filter events for an event subscription based on a suffix. Wildcard characters are not supported.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az eventgrid domain event-subscription delete

Delete an event subscription of a domain.

az eventgrid domain event-subscription delete --domain-name
                                              --name
                                              --resource-group
                                              [--yes]

Examples

Delete an event subscription for an Event Grid domain.

az eventgrid domain event-subscription delete --name es1 \
    -g rg1 --domain-name domain1 \

Required Parameters

--domain-name

Name of the domain.

--name -n

Name of the event subscription.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--yes -y

Do not prompt for confirmation.

default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az eventgrid domain event-subscription list

List event subscriptions of a specific domain.

az eventgrid domain event-subscription list --domain-name
                                            --resource-group
                                            [--odata-query]

Examples

List all event subscriptions created for an Event Grid domain.

az eventgrid domain event-subscription list -g rg1 --domain-name domain1

Required Parameters

--domain-name

Name of the domain.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--odata-query

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
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az eventgrid domain event-subscription show

Get the details of an event subscription of a domain.

az eventgrid domain event-subscription show --domain-name
                                            --name
                                            --resource-group
                                            [--full-ed-url {false, true}]
                                            [--include-attrib-secret {false, true}]

Examples

Show the details of an event subscription for an Event Grid domain.

az eventgrid domain event-subscription show --name es1 \
     -g rg1 --domain-name domain1

Show the details of an event subscription for an Event Grid domain include any static delivery attribute secrets.

az eventgrid domain event-subscription show --name es1 \
     -g rg1 --domain-name domain1 --include-attrib-secret

Required Parameters

--domain-name

Name of the domain.

--name -n

Name of the event subscription.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--full-ed-url --include-full-endpoint-url

Specify to indicate whether the full endpoint URL should be returned. True if flag present.

accepted values: false, true
default value: False
--include-attrib-secret --include-static-delivery-attribute-secret

Indicate whether any static delivery attribute secrets should be returned. True if flag present.

accepted values: false, true
default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az eventgrid domain event-subscription update

Update an event subscription of a domain.

az eventgrid domain event-subscription update --domain-name
                                              --name
                                              --resource-group
                                              [--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 domain to specify a new endpoint.

az eventgrid domain event-subscription update --name es1 \
    -g rg1 --domain-name domain1 --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Update an event subscription for an Event Grid domain to specify a new subject-ends-with filter.

az eventgrid domain event-subscription update --name es2 \
    -g rg1 --domain-name domain1 \
    --subject-ends-with .jpg

Update an event subscription for an Event Grid domain to specify a new endpoint and a new subject-ends-with filter a new list of included event types.

az eventgrid domain event-subscription update --name es3 \
    -g rg1 --domain-name domain1 \
    --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 domain, to include a deadletter destination.

az eventgrid domain event-subscription update --name es2 \
    -g rg1 --domain-name domain1 \
    --deadletter-endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/blobServices/default/containers/blobcontainer1

Update an event subscription for an Azure Event Grid domain, using advanced filters.

az eventgrid domain event-subscription update --name es3 \
    -g rg1 --domain-name domain1 \
    --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 domain with Storage Queue as destination with ttl of 5 mins

az eventgrid domain event-subscription update -n es1 \
    -g rg1 --domain-name domain1 \
    --storage-queue-msg-ttl 300

Update an event subscription for an Event Grid domain with advanced filtering on arrays enabled

az eventgrid domain event-subscription update -n es1 \
    -g rg1 --domain-name domain1 \
    --enable-advanced-filtering-on-arrays true

Required Parameters

--domain-name

Name of the domain.

--name -n

Name of the event subscription.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--advanced-filter

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.

--deadletter-endpoint

The Azure resource ID of an Azure Storage blob container destination where EventGrid should deadletter undeliverable events for this event subscription.

--delivery-attribute-mapping -d

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.

--enable-advanced-filtering-on-arrays --enable-af-arr

Allows advanced filters to be evaluated against an array of values instead of expecting a singular value.

accepted values: false, true
--endpoint

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.

--included-event-types

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'.

--labels

A space-separated list of labels to associate with this event subscription.

--qttl --storage-queue-msg-ttl

Storage queue message time to live in seconds.

--subject-begins-with

An optional string to filter events for an event subscription based on a prefix. Wildcard characters are not supported.

--subject-ends-with

An optional string to filter events for an event subscription based on a suffix. Wildcard characters are not supported.

--update-endpoint-type

The type of the destination endpoint.

accepted values: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.