แชร์ผ่าน


az eventgrid event-subscription

Note

This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.

Manage event subscriptions.

Manage event subscriptions for an Event Grid topic, domain, domain topic, Azure subscription, resource group or for any other Azure resource that supports event notifications.

Commands

Name Description Type Status
az eventgrid event-subscription create

Create a new event subscription.

Core GA
az eventgrid event-subscription create (eventgrid extension)

Create a new event subscription.

Extension Preview
az eventgrid event-subscription delete

Delete an event subscription.

Core GA
az eventgrid event-subscription delete (eventgrid extension)

Delete an event subscription.

Extension Preview
az eventgrid event-subscription list

List event subscriptions.

Core GA
az eventgrid event-subscription list (eventgrid extension)

List event subscriptions.

Extension Preview
az eventgrid event-subscription show

Get the details of an event subscription.

Core GA
az eventgrid event-subscription show (eventgrid extension)

Get the details of an event subscription.

Extension Preview
az eventgrid event-subscription update

Update an event subscription.

Core GA
az eventgrid event-subscription update (eventgrid extension)

Update an event subscription.

Extension Preview

az eventgrid event-subscription create

Create a new event subscription.

az eventgrid event-subscription create --name
                                       [--aad-tenant-id]
                                       [--advanced-filter]
                                       [--azure-active-directory-application-id-or-uri]
                                       [--deadletter-endpoint]
                                       [--deadletter-identity {systemassigned}]
                                       [--deadletter-identity-endpoint]
                                       [--delivery-attribute-mapping]
                                       [--delivery-identity {systemassigned}]
                                       [--delivery-identity-endpoint]
                                       [--delivery-identity-endpoint-type {azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook}]
                                       [--enable-advanced-filtering-on-arrays {false, true}]
                                       [--endpoint]
                                       [--endpoint-type]
                                       [--event-delivery-schema {cloudeventschemav1_0, custominputschema, eventgridschema}]
                                       [--event-ttl]
                                       [--expiration-date]
                                       [--included-event-types]
                                       [--labels]
                                       [--max-delivery-attempts]
                                       [--max-events-per-batch]
                                       [--preferred-batch-size-in-kilobytes]
                                       [--qttl]
                                       [--source-resource-id]
                                       [--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 event-subscription create --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription for an Azure subscription, using default filters.

az eventgrid event-subscription create --name es2 \
    --source-resource-id /subscriptions/{SubID} \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription for a resource group, using default filters.

az eventgrid event-subscription create --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG} \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription for a storage account, using default filters.

az eventgrid event-subscription create --name es3 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/s1"  \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription for a storage account, using advanced filters.

az eventgrid event-subscription create  --name es3 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/s1" \
    --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

Create a new event subscription for an Azure subscription, with a filter specifying a subject prefix.

az eventgrid event-subscription create --name es4 \
    --source-resource-id /subscriptions/{SubID} \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code \
    --subject-begins-with mysubject_prefix

Create a new event subscription for a resource group, with a filter specifying a subject suffix.

az eventgrid event-subscription create --name es5 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG} \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code \
    --subject-ends-with mysubject_suffix

Create a new event subscription for an Azure subscription, using default filters, and an EventHub as a destination.

az eventgrid event-subscription create --name es2 \
    --source-resource-id /subscriptions/{SubID} \
    --endpoint-type eventhub \
    --endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/n1/eventhubs/EH1

Create a new event subscription for an Azure subscription, using default filters, and an Azure Storage queue as a destination.

az eventgrid event-subscription create --name es2 \
    --source-resource-id /subscriptions/{SubID} \
    --endpoint-type storagequeue \
    --endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/queueservices/default/queues/q1

Create a new event subscription for an Azure subscription, using default filters, and an Azure ServiceBusQueue as a destination.

az eventgrid event-subscription create --name es2 \
    --source-resource-id /subscriptions/{SubID} \
    --endpoint-type servicebusqueue \
    --endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ns1/queues/queue1

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

az eventgrid event-subscription create --name es2 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1 \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code \
    --event-delivery-schema cloudeventschemav1_0

Create a new event subscription for a storage account, with a deadletter destination and custom retry policy of maximum 10 delivery attempts and an Event TTL of 2 hours (whichever happens earlier).

az eventgrid event-subscription create --name es2 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/s1" \
    --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

Create a new event subscription for a domain topic.

az eventgrid event-subscription create --name es2 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/domain1/topics/t1" \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription (for a storage account) with an expiration date.

az eventgrid event-subscription create --name es2 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/sa1" \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code
    --expiration-date "2018-10-31"

Create a new event subscription for an Event Grid topic, using Azure Active Directory enabled Webhook as a destination .

az eventgrid event-subscription create --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/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 event-subscription create --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/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 Eventhub with systemassigned MSI identity as destination and with deadletter with MSI identity

az eventgrid event-subscription create --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
    --delivery-identity-endpoint-type eventhub --delivery-identity systemassigned --delivery-identity-endpoint /subscriptions/{SubId2|}/resourceGroups/{RG2}/providers/Microsoft.eventhub/namespaces/{EventHubNamespace}/eventhubs/{EventhubName} \
    --deadletter-identity-endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/s2/blobServices/default/containers/blobcontainer1 --deadletter-identity systemassigned -n {EventSubscriptionName}

Create a new event subscription for an Event Grid topic using Storage Queue as destination with message ttl at 5 mins

az eventgrid event-subscription create -n es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/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 using StorageQueue with systemassigned MSI identity as destination

az eventgrid event-subscription create -n {EventSubscriptionName} --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
    --delivery-identity-endpoint-type StorageQueue --delivery-identity systemassigned --delivery-identity-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 with advanced filtering enabled on arrays

az eventgrid event-subscription create -n es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1
    --endpoint-type storagequeue \
    --endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/queueservices/default/queues/q1 \
    --enable-advanced-filtering-on-arrays true

Required Parameters

--name -n

Name of the event subscription.

Optional Parameters

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

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

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

--deadletter-identity
Preview

The identity type of the deadletter destination resource.

Accepted values: systemassigned
--deadletter-identity-endpoint

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

--delivery-attribute-mapping

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.

--delivery-identity
Preview

The identity type of the delivery destination resource (e.g., storage queue, or eventhub).

Accepted values: systemassigned
--delivery-identity-endpoint
Preview

Endpoint with identity 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.

--delivery-identity-endpoint-type
Preview

The type of the destination endpoint with resource identity.

Accepted values: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
--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.

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.

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

--source-resource-id

Fully qualified identifier of the Azure resource to which the event subscription needs to be created.

Usage: --source-resource-id Azure-Resource-ID For Azure subscription: --source-resource-id /subscriptions/{SubID} For resource group: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1 For EventGrid domain: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1 For EventGrid domain topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1/topics/t1.

--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 event-subscription create (eventgrid extension)

Preview

Command group 'az eventgrid' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Create a new event subscription.

az eventgrid event-subscription create --name
                                       [--advanced-filter]
                                       [--azure-active-directory-application-id-or-uri]
                                       [--azure-active-directory-tenant-id]
                                       [--deadletter-endpoint]
                                       [--deadletter-identity {systemassigned}]
                                       [--deadletter-identity-endpoint]
                                       [--delivery-identity {systemassigned}]
                                       [--delivery-identity-endpoint]
                                       [--delivery-identity-endpoint-type {azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook}]
                                       [--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]
                                       [--preferred-batch-size-in-kilobytes]
                                       [--source-resource-id]
                                       [--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 event-subscription create --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription for an Azure subscription subscription, using default filters.

az eventgrid event-subscription create --name es2 \
    --source-resource-id /subscriptions/{SubID} \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription for a resource group, using default filters.

az eventgrid event-subscription create --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG} \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription for a storage account, using default filters.

az eventgrid event-subscription create --name es3 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/s1"  \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription for a storage account, using advanced filters.

az eventgrid event-subscription create  --name es3 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/s1" \
    --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

Create a new event subscription for an Azure subscription, with a filter specifying a subject prefix.

az eventgrid event-subscription create --name es4 \
    --source-resource-id /subscriptions/{SubID} \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code \
    --subject-begins-with mysubject_prefix

Create a new event subscription for a resource group, with a filter specifying a subject suffix.

az eventgrid event-subscription create --name es5 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG} \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code \
    --subject-ends-with mysubject_suffix

Create a new event subscription for an Azure subscription, using default filters, and an EventHub as a destination.

az eventgrid event-subscription create --name es2 \
    --source-resource-id /subscriptions/{SubID} \
    --endpoint-type eventhub \
    --endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/n1/eventhubs/EH1

Create a new event subscription for an Azure subscription, using default filters, and an Azure Storage queue as a destination.

az eventgrid event-subscription create --name es2 \
    --source-resource-id /subscriptions/{SubID} \
    --endpoint-type storagequeue \
    --endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/queueservices/default/queues/q1

Create a new event subscription for an Azure subscription, using default filters, and an Azure ServiceBusQueue as a destination.

az eventgrid event-subscription create --name es2 \
    --source-resource-id /subscriptions/{SubID} \
    --endpoint-type servicebusqueue \
    --endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ns1/queues/queue1

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

az eventgrid event-subscription create --name es2 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1 \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code \
    --event-delivery-schema cloudeventschemav1_0

Create a new event subscription for a storage account, with a deadletter destination and custom retry policy of maximum 10 delivery attempts and an Event TTL of 2 hours (whichever happens earlier).

az eventgrid event-subscription create --name es2 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/s1" \
    --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

Create a new event subscription for a domain topic.

az eventgrid event-subscription create --name es2 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/domain1/topics/t1" \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Create a new event subscription (for a storage account) with an expiration date.

az eventgrid event-subscription create --name es2 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/sa1" \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code
    --expiration-date "2018-10-31"

Create a new event subscription for an Event Grid topic, using Azure Active Directory enabled Webhook as a destination .

az eventgrid event-subscription create --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/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 event-subscription create --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/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 Eventhub with systemassigned MSI identity as destination and with deadletter with MSI identity

az eventgrid event-subscription create --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
    --delivery-identity-endpoint-type eventhub --delivery-identity systemassigned --delivery-identity-endpoint /subscriptions/{SubId2|}/resourceGroups/{RG2}/providers/Microsoft.eventhub/namespaces/{EventHubNamespace}/eventhubs/{EventhubName} \
    --deadletter-identity-endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/s2/blobServices/default/containers/blobcontainer1 --deadletter-identity systemassigned -n {EventSubscriptionName}

Required Parameters

--name -n

Name of the event subscription.

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 StringBeginsWith: --advanced-filter subject StringBeginsWith Blue Red StringEndsWith: --advanced-filter subject StringEndsWith img png jpg NumberIn: --advanced-filter data.property1 NumberIn 5 10 20 NumberNotIn: --advanced-filter data.property2 NumberNotIn 100 200 300 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 Multiple advanced filters can be specified by using more than one --advanced-filter argument.

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

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

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

--deadletter-identity

The identity type of the deadletter destination resource.

Accepted values: systemassigned
--deadletter-identity-endpoint

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

--delivery-identity

The identity type of the delivery destination resource (e.g., storage queue, or eventhub).

Accepted values: systemassigned
--delivery-identity-endpoint

Endpoint with identity 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.

--delivery-identity-endpoint-type

The type of the destination endpoint with resource identity.

Accepted values: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
--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.

--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. Example: Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted. To subscribe to all default event types, do not specify any value for this argument.

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

--preferred-batch-size-in-kilobytes

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

--source-resource-id

Fully qualified identifier of the Azure resource to which the event subscription needs to be created.

Usage: --source-resource-id Azure-Resource-ID For Azure subscription: --source-resource-id /subscriptions/{SubID} For resource group: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1 For EventGrid domain: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1 For EventGrid domain topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1/topics/t1.

--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 event-subscription delete

Delete an event subscription.

az eventgrid event-subscription delete --name
                                       [--source-resource-id]

Examples

Delete an event subscription for an Event Grid topic.

az eventgrid event-subscription delete --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1

Delete an event subscription for an Event Grid domain topic.

az eventgrid event-subscription delete --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/domain1/topics/topic1

Delete an event subscription for an Event Grid domain.

az eventgrid event-subscription delete --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/domain1

Delete an event subscription for an Azure subscription.

az eventgrid event-subscription delete --name es2 \
    --source-resource-id /subscriptions/{SubID}

Delete an event subscription for a resource group.

az eventgrid event-subscription delete --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}

Delete an event subscription for a storage account.

az eventgrid event-subscription delete --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/microsoft.storage/storageaccounts/kalsegblob

Required Parameters

--name -n

Name of the event subscription.

Optional Parameters

--source-resource-id

Fully qualified identifier of the Azure resource whose event subscription needs to be deleted.

Usage: --source-resource-id Azure-Resource-ID For Azure subscription: --source-resource-id /subscriptions/{SubID} For resource group: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1 For EventGrid domain: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1 For EventGrid domain topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1/topics/t1.

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 event-subscription delete (eventgrid extension)

Preview

Command group 'az eventgrid' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Delete an event subscription.

az eventgrid event-subscription delete --name
                                       [--source-resource-id]

Examples

Delete an event subscription for an Event Grid topic.

az eventgrid event-subscription delete --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1

Delete an event subscription for an Event Grid domain topic.

az eventgrid event-subscription delete --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/domain1/topics/topic1

Delete an event subscription for an Event Grid domain.

az eventgrid event-subscription delete --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/domain1

Delete an event subscription for an Azure subscription.

az eventgrid event-subscription delete --name es2 \
    --source-resource-id /subscriptions/{SubID}

Delete an event subscription for a resource group.

az eventgrid event-subscription delete --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}

Delete an event subscription for a storage account.

az eventgrid event-subscription delete --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/microsoft.storage/storageaccounts/kalsegblob

Required Parameters

--name -n

Name of the event subscription.

Optional Parameters

--source-resource-id

Fully qualified identifier of the Azure resource whose event subscription needs to be deleted.

Usage: --source-resource-id Azure-Resource-ID For Azure subscription: --source-resource-id /subscriptions/{SubID} For resource group: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1 For EventGrid domain: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1 For EventGrid domain topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1/topics/t1.

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 event-subscription list

List event subscriptions.

Event Grid supports both regional and global event subscriptions: Event subscriptions on regional resources (such as Storage accounts or Event Grid topics) are regional, while event subscriptions on global resources (such as an Azure subscription or resource group) are global. Hence, you can list event subscriptions in a few different ways:

  1. To list by the resource ID of the resource whose event subscriptions you want to list, specify the --source-resource-id parameter. No other parameters must be specified.
  2. To list by a topic-type (e.g. storage accounts), specify the --topic-type parameter along with --location (e.g. "westus2") parameter. For global topic types (e.g. "Microsoft.Resources.Subscriptions"), specify the location value as "global".
  3. To list all event subscriptions in a region (across all topic types), specify only the --location parameter.
  4. For both #2 and #3 above, to filter only by a resource group, you can additionally specify the --resource-group parameter.
az eventgrid event-subscription list [--location]
                                     [--odata-query]
                                     [--resource-group]
                                     [--source-resource-id]
                                     [--topic-type-name]

Examples

List all event subscriptions created for an Event Grid topic.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1

List all event subscriptions created for a storage account.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/kalsegblob

List all event subscriptions created for an Azure subscription.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}

List all event subscriptions created for a resource group.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}

List all event subscriptions for an Event Grid domain.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1

List all event subscriptions for an Event Grid domain topic.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1/topics/topic1

List all Storage event subscriptions (under the currently selected Azure subscription) in westus2.

az eventgrid event-subscription list --topic-type Microsoft.Storage.StorageAccounts --location westus2

List all Storage event subscriptions (under the given resource group) in westus2.

az eventgrid event-subscription list --topic-type Microsoft.Storage.StorageAccounts --location westus2 --resource-group {RG}

List all regional or global event subscriptions (under the currently selected Azure subscription).

az eventgrid event-subscription list --location westus2
az eventgrid event-subscription list --location global

List all regional or global event subscriptions under a specified resource group.

az eventgrid event-subscription list --location westus2 --resource-group {RG}
az eventgrid event-subscription list --location global --resource-group {RG}

List all event subscriptions for an Event Grid domain whose name contains the pattern "XYZ"

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1 --odata-query "Contains(name, 'XYZ')"

List all event subscriptions for an Event Grid domain except the event subscription with name "name1"

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1 --odata-query "NOT (name eq 'name1')"

Optional Parameters

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

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

--resource-group -g

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

--source-resource-id

Fully qualified identifier of the Azure resource whose event subscription needs to be listed.

Usage: --source-resource-id Azure-Resource-ID For Azure subscription: --source-resource-id /subscriptions/{SubID} For resource group: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1 For EventGrid domain: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1 For EventGrid domain topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1/topics/t1.

--topic-type-name

Name of the topic-type whose event subscriptions need to be listed. When this is specified, you must also specify --location.

Example 1: List all Storage event subscriptions in WestUS2 --resource-group TestRG --topic-type-name Microsoft.Storage.StorageAccounts --location westus2 Example 2: List all event subscriptions on Azure subscriptions --topic-type-name Microsoft.Resources.Subscriptions --location global.

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 event-subscription list (eventgrid extension)

Preview

Command group 'az eventgrid' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

List event subscriptions.

Event Grid supports both regional and global event subscriptions: Event subscriptions on regional resources (such as Storage accounts or Event Grid topics) are regional, while event subscriptions on global resources (such as an Azure subscription or resource group) are global. Hence, you can list event subscriptions in a few different ways:

  1. To list by the resource ID of the resource whose event subscriptions you want to list, specify the --source-resource-id parameter. No other parameters must be specified.
  2. To list by a topic-type (e.g. storage accounts), specify the --topic-type parameter along with --location (e.g. "westus2") parameter. For global topic types (e.g. "Microsoft.Resources.Subscriptions"), specify the location value as "global".
  3. To list all event subscriptions in a region (across all topic types), specify only the --location parameter.
  4. For both #2 and #3 above, to filter only by a resource group, you can additionally specify the --resource-group parameter.
az eventgrid event-subscription list [--location]
                                     [--odata-query]
                                     [--resource-group]
                                     [--source-resource-id]
                                     [--topic-type-name]

Examples

List all event subscriptions created for an Event Grid topic.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1

List all event subscriptions created for a storage account.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/kalsegblob

List all event subscriptions created for an Azure subscription.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}

List all event subscriptions created for a resource group.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}

List all event subscriptions for an Event Grid domain.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1

List all event subscriptions for an Event Grid domain topic.

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1/topics/topic1

List all Storage event subscriptions (under the currently selected Azure subscription) in westus2.

az eventgrid event-subscription list --topic-type Microsoft.Storage.StorageAccounts --location westus2

List all Storage event subscriptions (under the given resource group) in westus2.

az eventgrid event-subscription list --topic-type Microsoft.Storage.StorageAccounts --location westus2 --resource-group {RG}

List all regional or global event subscriptions (under the currently selected Azure subscription).

az eventgrid event-subscription list --location westus2
az eventgrid event-subscription list --location global

List all regional or global event subscriptions under a specified resource group.

az eventgrid event-subscription list --location westus2 --resource-group {RG}
az eventgrid event-subscription list --location global --resource-group {RG}

List all event subscriptions for an Event Grid domain whose name contains the pattern "XYZ"

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1 --odata-query "Contains(name, 'XYZ')"

List all event subscriptions for an Event Grid domain except the event subscription with name "name1"

az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1 --odata-query "NOT (name eq 'name1')"

Optional Parameters

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--odata-query

The query used to filter the results using OData syntax.

--resource-group -g

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

--source-resource-id

Fully qualified identifier of the Azure resource whose event subscription needs to be listed.

Usage: --source-resource-id Azure-Resource-ID For Azure subscription: --source-resource-id /subscriptions/{SubID} For resource group: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1 For EventGrid domain: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1 For EventGrid domain topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1/topics/t1.

--topic-type-name

Name of the topic-type whose event subscriptions need to be listed. When this is specified, you must also specify --location.

Example 1: List all Storage event subscriptions in WestUS2 --resource-group TestRG --topic-type-name Microsoft.Storage.StorageAccounts --location westus2 Example 2: List all event subscriptions on Azure subscriptions --topic-type-name Microsoft.Resources.Subscriptions --location global.

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 event-subscription show

Get the details of an event subscription.

az eventgrid event-subscription show --name
                                     [--include-attrib-secret {false, true}]
                                     [--include-full-endpoint-url {false, true}]
                                     [--source-resource-id]

Examples

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

az eventgrid event-subscription show --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/topic1

Show the details of an event subscription for an Azure subscription.

az eventgrid event-subscription show --name es2 \
    --source-resource-id /subscriptions/{SubID}

Show the details of an event subscription for a resource group.

az eventgrid event-subscription show --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1

Show the details of an event subscription for a storage account.

az eventgrid event-subscription show --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/microsoft.storage/storageaccounts/kalsegblob

Show the details of an event subscription for a resource group including any static delivery attribute secrets.

az eventgrid event-subscription show --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 \
    --include-static-delivery-attribute-secret

Required Parameters

--name -n

Name of the event subscription.

Optional Parameters

--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
--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
--source-resource-id

Fully qualified identifier of the Azure resource whose event subscription needs to be shown.

Usage: --source-resource-id Azure-Resource-ID For Azure subscription: --source-resource-id /subscriptions/{SubID} For resource group: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1 For EventGrid domain: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1 For EventGrid domain topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1/topics/t1.

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 event-subscription show (eventgrid extension)

Preview

Command group 'az eventgrid' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Get the details of an event subscription.

az eventgrid event-subscription show --name
                                     [--include-full-endpoint-url {false, true}]
                                     [--source-resource-id]

Examples

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

az eventgrid event-subscription show --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/topic1

Show the details of an event subscription for an Azure subscription.

az eventgrid event-subscription show --name es2 \
    --source-resource-id /subscriptions/{SubID}

Show the details of an event subscription for a resource group.

az eventgrid event-subscription show --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1

Show the details of an event subscription for a storage account.

az eventgrid event-subscription show --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/microsoft.storage/storageaccounts/kalsegblob

Required Parameters

--name -n

Name of the event subscription.

Optional Parameters

--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
--source-resource-id

Fully qualified identifier of the Azure resource whose event subscription needs to be shown.

Usage: --source-resource-id Azure-Resource-ID For Azure subscription: --source-resource-id /subscriptions/{SubID} For resource group: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1 For EventGrid domain: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1 For EventGrid domain topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1/topics/t1.

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 event-subscription update

Update an event subscription.

az eventgrid event-subscription update --name
                                       [--add]
                                       [--advanced-filter]
                                       [--deadletter-endpoint]
                                       [--deadletter-identity {systemassigned}]
                                       [--deadletter-identity-endpoint]
                                       [--delivery-attribute-mapping]
                                       [--delivery-identity {systemassigned}]
                                       [--delivery-identity-endpoint]
                                       [--delivery-identity-endpoint-type {azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook}]
                                       [--enable-advanced-filtering-on-arrays {false, true}]
                                       [--endpoint]
                                       [--endpoint-type]
                                       [--force-string]
                                       [--included-event-types]
                                       [--labels]
                                       [--qttl]
                                       [--remove]
                                       [--set]
                                       [--source-resource-id]
                                       [--subject-begins-with]
                                       [--subject-ends-with]

Examples

Update an event subscription for an Event Grid topic to specify a new endpoint.

az eventgrid event-subscription update --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Update an event subscription for an Azure subscription to specify a new subject-ends-with filter.

az eventgrid event-subscription update --name es2 \
    --source-resource-id /subscriptions/{SubID} \
    --subject-ends-with .jpg

Update an event subscription for a resource group to specify a new endpoint and a new subject-ends-with filter.

az eventgrid event-subscription update --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG} \
    --subject-ends-with .png \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Update an event subscription for a storage account to specify a new list of included event types.

az eventgrid event-subscription update --name es3 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/microsoft.storage/storageaccounts/kalsegblob" \
    --included-event-types Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted

Update an event subscription for a storage account, to include a deadletter destination.

az eventgrid event-subscription update --name es2 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/kalsegblob" \
    --deadletter-endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/blobServices/default/containers/blobcontainer1

Update an event subscription for a storage account, using advanced filters.

az eventgrid event-subscription update --name es3 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/s1" \
    --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 a storage account to include message ttl set to 5 mins.

az eventgrid event-subscription update --name es2 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/kalsegblob" \
    --storage-queue-msg-ttl 300

Update an event subscription with advanced filtering enabled on arrays

az eventgrid event-subscription update --name es2 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/kalsegblob" \
    --enable-advanced-filtering-on-arrays true

Required Parameters

--name -n

Name of the event subscription.

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

Default value: []
--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.

--deadletter-identity
Preview

The identity type of the deadletter destination resource.

Accepted values: systemassigned
--deadletter-identity-endpoint

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

--delivery-attribute-mapping

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.

--delivery-identity
Preview

The identity type of the delivery destination resource (e.g., storage queue, or eventhub).

Accepted values: systemassigned
--delivery-identity-endpoint
Preview

Endpoint with identity 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.

--delivery-identity-endpoint-type
Preview

The type of the destination endpoint with resource identity.

Accepted values: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
--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.

Default value: webhook
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

Default value: False
--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.

--remove

Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove.

Default value: []
--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>.

Default value: []
--source-resource-id

Fully qualified identifier of the Azure resource whose event subscription needs to be updated.

Usage: --source-resource-id Azure-Resource-ID For Azure subscription: --source-resource-id /subscriptions/{SubID} For resource group: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1 For EventGrid domain: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1 For EventGrid domain topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1/topics/t1.

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

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 event-subscription update (eventgrid extension)

Preview

Command group 'az eventgrid' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Update an event subscription.

az eventgrid event-subscription update --name
                                       [--add]
                                       [--advanced-filter]
                                       [--deadletter-endpoint]
                                       [--deadletter-identity {systemassigned}]
                                       [--deadletter-identity-endpoint]
                                       [--delivery-identity {systemassigned}]
                                       [--delivery-identity-endpoint]
                                       [--delivery-identity-endpoint-type {azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook}]
                                       [--endpoint]
                                       [--endpoint-type {azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook}]
                                       [--force-string]
                                       [--included-event-types]
                                       [--labels]
                                       [--remove]
                                       [--set]
                                       [--source-resource-id]
                                       [--subject-begins-with]
                                       [--subject-ends-with]

Examples

Update an event subscription for an Event Grid topic to specify a new endpoint.

az eventgrid event-subscription update --name es1 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Update an event subscription for an Azure subscription to specify a new subject-ends-with filter.

az eventgrid event-subscription update --name es2 \
    --source-resource-id /subscriptions/{SubID} \
    --subject-ends-with .jpg

Update an event subscription for a resource group to specify a new endpoint and a new subject-ends-with filter.

az eventgrid event-subscription update --name es3 \
    --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG} \
    --subject-ends-with .png \
    --endpoint https://contoso.azurewebsites.net/api/f1?code=code

Update an event subscription for a storage account to specify a new list of included event types.

az eventgrid event-subscription update --name es3 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/microsoft.storage/storageaccounts/kalsegblob" \
    --included-event-types Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted

Update an event subscription for a storage account, to include a deadletter destination.

az eventgrid event-subscription update --name es2 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/kalsegblob" \
    --deadletter-endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/blobServices/default/containers/blobcontainer1

Update an event subscription for a storage account, using advanced filters.

az eventgrid event-subscription update --name es3 \
    --source-resource-id "/subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Storage/storageaccounts/s1" \
    --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

Required Parameters

--name -n

Name of the event subscription.

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

Default value: []
--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 StringBeginsWith: --advanced-filter subject StringBeginsWith Blue Red StringEndsWith: --advanced-filter subject StringEndsWith img png jpg NumberIn: --advanced-filter data.property1 NumberIn 5 10 20 NumberNotIn: --advanced-filter data.property2 NumberNotIn 100 200 300 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 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.

--deadletter-identity

The identity type of the deadletter destination resource.

Accepted values: systemassigned
--deadletter-identity-endpoint

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

--delivery-identity

The identity type of the delivery destination resource (e.g., storage queue, or eventhub).

Accepted values: systemassigned
--delivery-identity-endpoint

Endpoint with identity 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.

--delivery-identity-endpoint-type

The type of the destination endpoint with resource identity.

Accepted values: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
--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.

--endpoint-type

The type of the destination endpoint.

Accepted values: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
Default value: webhook
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

Default value: False
--included-event-types

A space-separated list of event types. Example: Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted. To subscribe to all default event types, do not specify any value for this argument.

--labels

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

--remove

Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove.

Default value: []
--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>.

Default value: []
--source-resource-id

Fully qualified identifier of the Azure resource whose event subscription needs to be updated.

Usage: --source-resource-id Azure-Resource-ID For Azure subscription: --source-resource-id /subscriptions/{SubID} For resource group: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageaccounts/sa1 For EventGrid domain: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1 For EventGrid domain topic: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/domains/d1/topics/t1.

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

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.