az eventgrid event-subscription

注意

此命令群組具有 Azure CLI 和至少一個擴充功能中定義的命令。 安裝每個擴充功能以受益於其擴充功能。 深入了解擴充功能。

管理事件訂閱。

管理事件方格主題、網域、網域主題、Azure 訂用帳戶、資源群組,或支援事件通知的任何其他 Azure 資源的事件訂用帳戶。

命令

名稱 Description 類型 狀態
az eventgrid event-subscription create

建立新的事件訂用帳戶。

核心 GA
az eventgrid event-subscription create (eventgrid 擴充功能)

建立新的事件訂用帳戶。

副檔名 預覽
az eventgrid event-subscription delete

刪除事件訂閱。

核心 GA
az eventgrid event-subscription delete (eventgrid 擴充功能)

刪除事件訂閱。

副檔名 預覽
az eventgrid event-subscription list

列出事件訂閱。

核心 GA
az eventgrid event-subscription list (eventgrid 擴充功能)

列出事件訂閱。

副檔名 預覽
az eventgrid event-subscription show

取得事件訂用帳戶的詳細數據。

核心 GA
az eventgrid event-subscription show (eventgrid 擴充功能)

取得事件訂用帳戶的詳細數據。

副檔名 預覽
az eventgrid event-subscription update

更新事件訂閱。

核心 GA
az eventgrid event-subscription update (eventgrid 擴充功能)

更新事件訂閱。

副檔名 預覽

az eventgrid event-subscription create

建立新的事件訂用帳戶。

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]

範例

使用預設篩選,為事件方格主題建立新的事件訂用帳戶。

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 訂用帳戶建立新的事件訂用帳戶。

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

使用預設篩選,為資源群組建立新的事件訂用帳戶。

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

使用預設篩選,為記憶體帳戶建立新的事件訂用帳戶。

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

使用進階篩選,為記憶體帳戶建立新的事件訂用帳戶。

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

為 Azure 訂用帳戶建立新的事件訂用帳戶,並指定主旨前置詞的篩選條件。

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

為資源群組建立新的事件訂用帳戶,並指定主旨後綴的篩選條件。

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

使用預設篩選和 EventHub 作為目的地,為 Azure 訂用帳戶建立新的事件訂用帳戶。

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

使用預設篩選和 Azure 儲存體 佇列作為目的地,為 Azure 訂用帳戶建立新的事件訂用帳戶。

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

使用預設篩選和 Azure ServiceBusQueue 作為目的地,為 Azure 訂用帳戶建立新的事件訂用帳戶。

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

使用預設篩選條件和 CloudEvent V 1.0 作為傳遞架構,為事件方格網域建立新的事件訂用帳戶。

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

為記憶體帳戶建立新的事件訂用帳戶,其目的地和自定義重試原則上限為 10 次傳遞嘗試,且事件 TTL 為 2 小時(無論稍早發生)。

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

建立網域主題的新事件訂用帳戶。

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

建立具有到期日的新事件訂用帳戶(適用於記憶體帳戶)。

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"

使用已啟用 Azure Active Directory 的 Webhook 作為目的地,為 Event Grid 主題建立新的事件訂用帳戶。

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

使用 Azure Function 作為目的地,為事件方格主題建立新的事件訂用帳戶。

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

建立事件方格主題的新事件訂用帳戶,使用 Eventhub 搭配系統指派的 MSI 身分識別作為目的地,並使用具有 MSI 身分識別的死因

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}

使用 儲存體 佇列作為目的地,在 5 分鐘時建立事件方格主題的新事件訂用帳戶

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

使用 儲存體 Queue 搭配系統指派的 MSI 身分識別作為目的地,為 Event Grid 主題建立新的事件訂用帳戶

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

為事件方格主題建立新的事件訂用帳戶,並在陣列上啟用進階篩選

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

必要參數

--name -n

事件訂閱的名稱。

選擇性參數

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

Azure Active Directory 租使用者識別碼,以取得存取令牌,這些令牌將包含在傳遞要求中作為持有人令牌。 僅適用於 Webhook 作為目的地。

--advanced-filter

進階篩選會根據特定事件屬性來篩選事件。

使用方式:--advanced-filter KEY[。INNERKEY] FILTEROPERATOR 值 [VALUE ...]StringIn:-advanced-filter 數據。Color StringIn Blue Red Orange Yellow StringNotIn: --advanced-filter 數據。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-filterdata.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.property3NumberGreaterThan 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 多個進階篩選可以使用多個 --advanced-filter 自變數來指定。

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

Azure Active Directory 應用程式識別碼或 URI,以取得存取令牌,這些令牌將包含在傳遞要求中作為持有人令牌。 僅適用於 Webhook 作為目的地。

--deadletter-endpoint

Azure 儲存體 Blob 容器目的地的 Azure 資源識別符,其中 EventGrid 應該為此事件訂用帳戶造成無法傳遞的事件。

範例:-deadletter-endpoint /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft。儲存體/storageAccounts/sa1/blobServices/default/containers/containerName。

--deadletter-identity
預覽

死者目的地資源的識別類型。

接受的值: systemassigned
--deadletter-identity-endpoint

具有身分識別之 Azure 儲存體 Blob 容器目的地的 Azure 資源識別符,其中 EventGrid 應該為此事件訂用帳戶造成無法傳遞的事件。

--delivery-attribute-mapping

新增傳遞屬性對應,以在傳遞事件時透過 HTTP 標頭傳送其他資訊。 此屬性適用於所有目的地類型,但 儲存體 Queue 除外。 您可以使用多個 --delivery-attribute-mapping 自變數來指定多個屬性。

使用方式:--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
預覽

傳遞目的地資源的識別類型(例如記憶體佇列或 eventhub)。

接受的值: systemassigned
--delivery-identity-endpoint
預覽

具有身分識別的端點,其中 EventGrid 應該傳遞符合此事件訂用帳戶的事件。 針對 Webhook 端點類型,這應該是對應的 Webhook URL。 對於其他端點類型,這應該是端點的 Azure 資源識別碼。

--delivery-identity-endpoint-type
預覽

具有資源識別的目的地端點類型。

接受的值: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
--enable-advanced-filtering-on-arrays --enable-af-arr

允許針對值的數位評估進階篩選,而不是預期單一值。

接受的值: false, true
--endpoint

EventGrid 應傳遞符合此事件訂用帳戶的事件的端點。 針對 Webhook 端點類型,這應該是對應的 Webhook URL。 對於其他端點類型,這應該是端點的 Azure 資源識別碼。 預期目的地端點已建立並可供使用,再執行任何事件方格命令。

--endpoint-type

目的地端點的類型。

預設值: webhook
--event-delivery-schema

應該為此事件訂閱傳遞事件的架構。 根據預設,事件會以發行的相同架構傳遞(根據對應主題的輸入架構)。

接受的值: cloudeventschemav1_0, custominputschema, eventgridschema
--event-ttl

活動存留時間(以分鐘為單位)。 必須是介於 1 到 1440 之間的數位。

預設值: 1440
--expiration-date

日期或日期時間 (UTC,例如 '2018-11-30T11:59:59+00:00' 或 '2018-11-30'),之後事件訂閱將會到期。 根據預設,事件訂用帳戶沒有到期日。

--included-event-types

以空格分隔的事件類型清單(例如 Microsoft.儲存體。BlobCreated 和 Microsoft。儲存體。BlobDeleted)。 若要訂閱所有預設事件類型,請勿為此自變數指定任何值。 針對事件方格主題,事件類型是客戶定義的。 針對 Azure 事件,例如,儲存體 帳戶、IoT 中樞 等,您可以使用此 CLI 命令 'az eventgrid topic-type list-event-types' 查詢其事件類型。

--labels

與這個事件訂用帳戶相關聯的標籤以空格分隔的清單。

--max-delivery-attempts

傳遞嘗試次數上限。 必須是介於 1 到 30 之間的數位。

預設值: 30
--max-events-per-batch

批次中的事件數目上限。 必須是介於 1 到 5000 之間的數位。

--preferred-batch-size-in-kilobytes

慣用的批次大小以 KB 為單位。 必須是介於 1 到 1024 之間的數位。

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

儲存體 佇列訊息存留時間以秒為單位。

--source-resource-id

需要建立事件訂用帳戶之 Azure 資源的完整標識碼。

使用量: --source-resource-id Azure-Resource-ID For Azure 訂用帳戶: --source-resource-id /subscriptions/{SubID} 針對資源群組: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid 主題: --source--resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.儲存體/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

選擇性字串,可根據前置詞篩選事件訂閱的事件。 不支援萬用字元。

--subject-case-sensitive

指定 以指出是否應該以區分大小寫的方式比較主旨欄位。 如果旗標存在,則為 True。

接受的值: false, true
預設值: False
--subject-ends-with

選擇性字串,可根據後綴篩選事件訂閱的事件。 不支援萬用字元。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az eventgrid event-subscription create (eventgrid 擴充功能)

預覽

命令群組 'az eventgrid' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

建立新的事件訂用帳戶。

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]

範例

使用預設篩選,為事件方格主題建立新的事件訂用帳戶。

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 訂用帳戶訂用帳戶建立新的事件訂用帳戶。

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

使用預設篩選,為資源群組建立新的事件訂用帳戶。

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

使用預設篩選,為記憶體帳戶建立新的事件訂用帳戶。

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

使用進階篩選,為記憶體帳戶建立新的事件訂用帳戶。

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

為 Azure 訂用帳戶建立新的事件訂用帳戶,並指定主旨前置詞的篩選條件。

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

為資源群組建立新的事件訂用帳戶,並指定主旨後綴的篩選條件。

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

使用預設篩選和 EventHub 作為目的地,為 Azure 訂用帳戶建立新的事件訂用帳戶。

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

使用預設篩選和 Azure 儲存體 佇列作為目的地,為 Azure 訂用帳戶建立新的事件訂用帳戶。

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

使用預設篩選和 Azure ServiceBusQueue 作為目的地,為 Azure 訂用帳戶建立新的事件訂用帳戶。

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

使用預設篩選條件和 CloudEvent V 1.0 作為傳遞架構,為事件方格網域建立新的事件訂用帳戶。

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

為記憶體帳戶建立新的事件訂用帳戶,其目的地和自定義重試原則上限為 10 次傳遞嘗試,且事件 TTL 為 2 小時(無論稍早發生)。

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

建立網域主題的新事件訂用帳戶。

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

建立具有到期日的新事件訂用帳戶(適用於記憶體帳戶)。

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"

使用已啟用 Azure Active Directory 的 Webhook 作為目的地,為 Event Grid 主題建立新的事件訂用帳戶。

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

使用 Azure Function 作為目的地,為事件方格主題建立新的事件訂用帳戶。

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

建立事件方格主題的新事件訂用帳戶,使用 Eventhub 搭配系統指派的 MSI 身分識別作為目的地,並使用具有 MSI 身分識別的死因

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}

必要參數

--name -n

事件訂閱的名稱。

選擇性參數

--advanced-filter

進階篩選會根據特定事件屬性來篩選事件。

使用方式:--advanced-filter KEY[。INNERKEY] FILTEROPERATOR 值 [VALUE ...]StringIn:-advanced-filter 數據。Color StringIn Blue Red Orange Yellow StringNotIn: --advanced-filter 數據。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 subject StringEndsWith 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-filterdata.property2 NumberLessThanOrEquals 100 NumberGreaterThan: --advanced-filter data.property3 NumberGreaterThan 100 NumberGreaterThanOrEquals: --advanced-filter data.property2 NumberGreaterThanOrEquals 100 BoolEquals: --advanced-filter data.property3 BoolEquals true 使用多個 --advanced-filter 自變數來指定多個進階篩選。

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

Azure Active Directory 應用程式識別碼或 URI,以取得存取令牌,這些令牌將包含在傳遞要求中作為持有人令牌。 僅適用於 Webhook 作為目的地。

--azure-active-directory-tenant-id

Azure Active Directory 租使用者識別碼,以取得存取令牌,這些令牌將包含在傳遞要求中作為持有人令牌。 僅適用於 Webhook 作為目的地。

--deadletter-endpoint

Azure 儲存體 Blob 容器目的地的 Azure 資源識別符,其中 EventGrid 應該為此事件訂用帳戶造成無法傳遞的事件。

範例:-deadletter-endpoint /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft。儲存體/storageAccounts/sa1/blobServices/default/containers/containerName。

--deadletter-identity

死者目的地資源的識別類型。

接受的值: systemassigned
--deadletter-identity-endpoint

具有身分識別之 Azure 儲存體 Blob 容器目的地的 Azure 資源識別符,其中 EventGrid 應該為此事件訂用帳戶造成無法傳遞的事件。

--delivery-identity

傳遞目的地資源的識別類型(例如記憶體佇列或 eventhub)。

接受的值: systemassigned
--delivery-identity-endpoint

具有身分識別的端點,其中 EventGrid 應該傳遞符合此事件訂用帳戶的事件。 針對 Webhook 端點類型,這應該是對應的 Webhook URL。 對於其他端點類型,這應該是端點的 Azure 資源識別碼。

--delivery-identity-endpoint-type

具有資源識別的目的地端點類型。

接受的值: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
--endpoint

EventGrid 應傳遞符合此事件訂用帳戶的事件的端點。 針對 Webhook 端點類型,這應該是對應的 Webhook URL。 對於其他端點類型,這應該是端點的 Azure 資源識別碼。

--endpoint-type

目的地端點的類型。

接受的值: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
預設值: webhook
--event-delivery-schema

應該為此事件訂閱傳遞事件的架構。 根據預設,事件會以發行的相同架構傳遞(根據對應主題的輸入架構)。

接受的值: cloudeventschemav1_0, custominputschema, eventgridschema
--event-ttl

活動存留時間(以分鐘為單位)。 必須是介於 1 到 1440 之間的數位。

預設值: 1440
--expiration-date

日期或日期時間 (UTC,例如 '2018-11-30T11:59:59+00:00' 或 '2018-11-30'),之後事件訂閱將會到期。 根據預設,事件訂用帳戶沒有到期日。

--included-event-types

以空格分隔的事件類型清單。 範例:Microsoft。儲存體。BlobCreated Microsoft。儲存體。BlobDeleted。 若要訂閱所有預設事件類型,請勿為此自變數指定任何值。

--labels

與這個事件訂用帳戶相關聯的標籤以空格分隔的清單。

--max-delivery-attempts

傳遞嘗試次數上限。 必須是介於 1 到 30 之間的數位。

預設值: 30
--max-events-per-batch

批次中的事件數目上限。 必須是介於 1 到 5000 之間的數位。

--preferred-batch-size-in-kilobytes

慣用的批次大小以 KB 為單位。 必須是介於 1 到 1024 之間的數位。

--source-resource-id

需要建立事件訂用帳戶之 Azure 資源的完整標識碼。

使用量: --source-resource-id Azure-Resource-ID For Azure 訂用帳戶: --source-resource-id /subscriptions/{SubID} 針對資源群組: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid 主題: --source--resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 適用於記憶體帳戶:--source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.儲存體/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

選擇性字串,可根據前置詞篩選事件訂閱的事件。 不支援萬用字元。

--subject-case-sensitive

指定 以指出是否應該以區分大小寫的方式比較主旨欄位。 如果旗標存在,則為 True。

接受的值: false, true
預設值: False
--subject-ends-with

選擇性字串,可根據後綴篩選事件訂閱的事件。 不支援萬用字元。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az eventgrid event-subscription delete

刪除事件訂閱。

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

範例

刪除事件方格主題的事件訂用帳戶。

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

刪除事件方格網域主題的事件訂用帳戶。

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

刪除事件方格網域的事件訂用帳戶。

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

刪除 Azure 訂用帳戶的事件訂用帳戶。

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

刪除資源群組的事件訂用帳戶。

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

刪除記憶體帳戶的事件訂用帳戶。

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

必要參數

--name -n

事件訂閱的名稱。

選擇性參數

--source-resource-id

必須刪除事件訂用帳戶的 Azure 資源完整識別碼。

使用量: --source-resource-id Azure-Resource-ID For Azure 訂用帳戶: --source-resource-id /subscriptions/{SubID} 針對資源群組: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid 主題: --source--resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 適用於記憶體帳戶:--source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.儲存體/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。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az eventgrid event-subscription delete (eventgrid 擴充功能)

預覽

命令群組 'az eventgrid' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

刪除事件訂閱。

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

範例

刪除事件方格主題的事件訂用帳戶。

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

刪除事件方格網域主題的事件訂用帳戶。

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

刪除事件方格網域的事件訂用帳戶。

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

刪除 Azure 訂用帳戶的事件訂用帳戶。

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

刪除資源群組的事件訂用帳戶。

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

刪除記憶體帳戶的事件訂用帳戶。

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

必要參數

--name -n

事件訂閱的名稱。

選擇性參數

--source-resource-id

必須刪除事件訂用帳戶的 Azure 資源完整識別碼。

使用量: --source-resource-id Azure-Resource-ID For Azure 訂用帳戶: --source-resource-id /subscriptions/{SubID} 針對資源群組: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid 主題: --source--resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.儲存體/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。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az eventgrid event-subscription list

列出事件訂閱。

Event Grid 同時支援區域和全域事件訂用帳戶:區域資源上的事件訂用帳戶(例如 儲存體 帳戶或事件方格主題)是區域性的,而全域資源的事件訂用帳戶(例如 Azure 訂用帳戶或資源群組)則為全域訂用帳戶。 因此,您可以透過幾種不同的方式列出事件訂閱:

  1. 若要依您想要列出其事件訂用帳戶之資源的資源標識符列出,請指定 --source-resource-id 參數。 沒有其他參數必須指定。
  2. 若要依主題類型列出 (例如記憶體帳戶),請指定 --topic-type 參數以及 --location (例如 “westus2”) 參數。 針對全域主題類型(例如 “Microsoft.Resources.Subscriptions”),請將位置值指定為 “global”。
  3. 若要列出區域中的所有事件訂閱(跨所有主題類型),請只指定 --location 參數。
  4. 針對上述 #2 和 #3,若要僅依資源群組進行篩選,您可以另外指定 --resource-group 參數。
az eventgrid event-subscription list [--location]
                                     [--odata-query]
                                     [--resource-group]
                                     [--source-resource-id]
                                     [--topic-type-name]

範例

列出為事件方格主題建立的所有事件訂用帳戶。

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

列出為記憶體帳戶建立的所有事件訂用帳戶。

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

列出針對 Azure 訂用帳戶建立的所有事件訂用帳戶。

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

列出為資源群組建立的所有事件訂用帳戶。

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

列出事件方格網域的所有事件訂用帳戶。

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

列出事件方格網域主題的所有事件訂用帳戶。

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

列出 westus2 中所有 儲存體 事件訂用帳戶(在目前選取的 Azure 訂用帳戶下)。

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

列出 westus2 中所有 儲存體 事件訂用帳戶(在指定的資源群組下)。

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

列出所有區域或全域事件訂用帳戶(在目前選取的 Azure 訂用帳戶底下)。

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

列出指定資源群組下的所有區域或全域事件訂用帳戶。

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

列出名稱包含 「XYZ」 模式的事件方格網域的所有事件訂用帳戶

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

列出事件方格網域的所有事件訂用帳戶,但名稱為 「name1」 的事件訂用帳戶除外

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

選擇性參數

--location -l

位置。​​ 來自的值: az account list-locations。 您可以使用 az configure --defaults location=<location> 設定預設位置。

--odata-query

用於篩選清單結果的 OData 查詢。 [名稱] 屬性目前只允許篩選。 支持的作業包括:CONTAINS、eq (等於)、ne (不等於)、AND、OR 和 NOT。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--source-resource-id

必須列出事件訂用帳戶的 Azure 資源完整標識碼。

使用量: --source-resource-id Azure-Resource-ID For Azure 訂用帳戶: --source-resource-id /subscriptions/{SubID} 針對資源群組: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid 主題: --source--resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 適用於記憶體帳戶:--source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.儲存體/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

需要列出其事件訂閱的主題類型名稱。 指定此選項時,您也必須指定 --location。

範例 1:列出 WestUS2 --resource-group TestRG --topic-type-name Microsoft.儲存體 中的所有 儲存體 事件訂用帳戶。儲存體 Accounts --location westus2 範例 2:列出 Azure 訂用帳戶上的所有事件訂用帳戶 --topic-type-name Microsoft.Resources.Subscriptions --location global。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az eventgrid event-subscription list (eventgrid 擴充功能)

預覽

命令群組 'az eventgrid' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

列出事件訂閱。

事件方格同時支援區域和全域事件訂用帳戶:區域資源上的事件訂用帳戶(例如 儲存體 帳戶或事件方格主題)是區域性的,而全域資源的事件訂用帳戶(例如 Azure 訂用帳戶或資源群組)則為全域。 因此,您可以透過幾種不同的方式列出事件訂閱:

  1. 若要依您想要列出其事件訂用帳戶之資源的資源標識符列出,請指定 --source-resource-id 參數。 沒有其他參數必須指定。
  2. 若要依主題類型列出 (例如記憶體帳戶),請指定 --topic-type 參數以及 --location (例如 “westus2”) 參數。 針對全域主題類型(例如 “Microsoft.Resources.Subscriptions”),請將位置值指定為 “global”。
  3. 若要列出區域中的所有事件訂閱(跨所有主題類型),請只指定 --location 參數。
  4. 針對上述 #2 和 #3,若要僅依資源群組進行篩選,您可以另外指定 --resource-group 參數。
az eventgrid event-subscription list [--location]
                                     [--odata-query]
                                     [--resource-group]
                                     [--source-resource-id]
                                     [--topic-type-name]

範例

列出為事件方格主題建立的所有事件訂用帳戶。

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

列出為記憶體帳戶建立的所有事件訂用帳戶。

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

列出針對 Azure 訂用帳戶建立的所有事件訂用帳戶。

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

列出為資源群組建立的所有事件訂用帳戶。

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

列出事件方格網域的所有事件訂用帳戶。

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

列出事件方格網域主題的所有事件訂用帳戶。

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

列出 westus2 中所有 儲存體 事件訂用帳戶(在目前選取的 Azure 訂用帳戶下)。

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

列出 westus2 中所有 儲存體 事件訂用帳戶(在指定的資源群組下)。

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

列出所有區域或全域事件訂用帳戶(在目前選取的 Azure 訂用帳戶底下)。

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

列出指定資源群組下的所有區域或全域事件訂用帳戶。

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

列出名稱包含 「XYZ」 模式的事件方格網域的所有事件訂用帳戶

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

列出事件方格網域的所有事件訂用帳戶,但名稱為 「name1」 的事件訂用帳戶除外

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

選擇性參數

--location -l

位置。​​ 來自的值: az account list-locations。 您可以使用 az configure --defaults location=<location> 設定預設位置。

--odata-query

用來使用 OData 語法篩選結果的查詢。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--source-resource-id

必須列出事件訂用帳戶的 Azure 資源完整標識碼。

使用量: --source-resource-id Azure-Resource-ID For Azure 訂用帳戶: --source-resource-id /subscriptions/{SubID} 針對資源群組: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid 主題: --source--resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 適用於記憶體帳戶:--source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.儲存體/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

需要列出其事件訂閱的主題類型名稱。 指定此選項時,您也必須指定 --location。

範例 1:列出 WestUS2 --resource-group TestRG --topic-type-name Microsoft.儲存體 中的所有 儲存體 事件訂用帳戶。儲存體 Accounts --location westus2 範例 2:列出 Azure 訂用帳戶上的所有事件訂用帳戶 --topic-type-name Microsoft.Resources.Subscriptions --location global。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az eventgrid event-subscription show

取得事件訂用帳戶的詳細數據。

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

範例

顯示事件方格主題的事件訂用帳戶詳細數據。

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

顯示 Azure 訂用帳戶的事件訂用帳戶詳細數據。

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

顯示資源群組的事件訂用帳戶詳細數據。

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

顯示記憶體帳戶的事件訂用帳戶詳細數據。

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

顯示資源群組的事件訂用帳戶詳細數據,包括任何靜態傳遞屬性秘密。

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

必要參數

--name -n

事件訂閱的名稱。

選擇性參數

--include-attrib-secret --include-static-delivery-attribute-secret

指出是否應該傳回任何靜態傳遞屬性秘密。 如果旗標存在,則為 True。

接受的值: false, true
預設值: False
--include-full-endpoint-url

指定 以指出是否應該傳回完整的端點 URL。 如果旗標存在,則為 True。

接受的值: false, true
預設值: False
--source-resource-id

必須顯示事件訂用帳戶的 Azure 資源完整識別碼。

使用量: --source-resource-id Azure-Resource-ID For Azure 訂用帳戶: --source-resource-id /subscriptions/{SubID} 針對資源群組: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid 主題: --source--resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 適用於記憶體帳戶:--source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.儲存體/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。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az eventgrid event-subscription show (eventgrid 擴充功能)

預覽

命令群組 'az eventgrid' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

取得事件訂用帳戶的詳細數據。

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

範例

顯示事件方格主題的事件訂用帳戶詳細數據。

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

顯示 Azure 訂用帳戶的事件訂用帳戶詳細數據。

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

顯示資源群組的事件訂用帳戶詳細數據。

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

顯示記憶體帳戶的事件訂用帳戶詳細數據。

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

必要參數

--name -n

事件訂閱的名稱。

選擇性參數

--include-full-endpoint-url

指定 以指出是否應該傳回完整的端點 URL。 如果旗標存在,則為 True。

接受的值: false, true
預設值: False
--source-resource-id

必須顯示事件訂用帳戶的 Azure 資源完整識別碼。

使用量: --source-resource-id Azure-Resource-ID For Azure 訂用帳戶: --source-resource-id /subscriptions/{SubID} 針對資源群組: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid 主題: --source--resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.儲存體/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。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az eventgrid event-subscription update

更新事件訂閱。

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]

範例

更新事件方格主題的事件訂用帳戶,以指定新的端點。

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

更新 Azure 訂用帳戶的事件訂用帳戶,以指定具有篩選條件的新主旨端。

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

更新資源群組的事件訂用帳戶,以指定新的端點和具有篩選條件的新主旨端。

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

更新記憶體帳戶的事件訂用帳戶,以指定包含事件類型的新清單。

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

更新記憶體帳戶的事件訂用帳戶,以包含寄不出的目的地。

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

使用進階篩選來更新記憶體帳戶的事件訂用帳戶。

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

更新記憶體帳戶的事件訂用帳戶,以包含設定為 5 分鐘的訊息 ttl。

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

使用在陣列上啟用進階篩選來更新事件訂閱

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

必要參數

--name -n

事件訂閱的名稱。

選擇性參數

--add

藉由指定路徑和索引鍵值組,將物件加入物件清單。 範例:--add property.listProperty <key=value, string or JSON string>

預設值: []
--advanced-filter

進階篩選會根據特定事件屬性來篩選事件。

使用方式:--advanced-filter KEY[。INNERKEY] FILTEROPERATOR 值 [VALUE ...]StringIn:-advanced-filter 數據。Color StringIn Blue Red Orange Yellow StringNotIn: --advanced-filter 數據。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-filterdata.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.property3NumberGreaterThan 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 多個進階篩選可以使用多個 --advanced-filter 自變數來指定。

--deadletter-endpoint

Azure 儲存體 Blob 容器目的地的 Azure 資源識別符,其中 EventGrid 應該為此事件訂用帳戶造成無法傳遞的事件。

--deadletter-identity
預覽

死者目的地資源的識別類型。

接受的值: systemassigned
--deadletter-identity-endpoint

具有身分識別之 Azure 儲存體 Blob 容器目的地的 Azure 資源識別符,其中 EventGrid 應該為此事件訂用帳戶造成無法傳遞的事件。

--delivery-attribute-mapping

新增傳遞屬性對應,以在傳遞事件時透過 HTTP 標頭傳送其他資訊。 此屬性適用於所有目的地類型,但 儲存體 Queue 除外。 您可以使用多個 --delivery-attribute-mapping 自變數來指定多個屬性。

使用方式:--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
預覽

傳遞目的地資源的識別類型(例如記憶體佇列或 eventhub)。

接受的值: systemassigned
--delivery-identity-endpoint
預覽

具有身分識別的端點,其中 EventGrid 應該傳遞符合此事件訂用帳戶的事件。 針對 Webhook 端點類型,這應該是對應的 Webhook URL。 對於其他端點類型,這應該是端點的 Azure 資源識別碼。

--delivery-identity-endpoint-type
預覽

具有資源識別的目的地端點類型。

接受的值: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
--enable-advanced-filtering-on-arrays --enable-af-arr

允許針對值的數位評估進階篩選,而不是預期單一值。

接受的值: false, true
--endpoint

EventGrid 應傳遞符合此事件訂用帳戶的事件的端點。 針對 Webhook 端點類型,這應該是對應的 Webhook URL。 對於其他端點類型,這應該是端點的 Azure 資源識別碼。 預期目的地端點已建立並可供使用,再執行任何事件方格命令。

--endpoint-type

目的地端點的類型。

預設值: webhook
--force-string

使用 'set' 或 'add' 時,請保留字串常值,而不是嘗試轉換成 JSON。

預設值: False
--included-event-types

以空格分隔的事件類型清單(例如 Microsoft.儲存體。BlobCreated 和 Microsoft。儲存體。BlobDeleted)。 若要訂閱所有預設事件類型,請勿為此自變數指定任何值。 針對事件方格主題,事件類型是客戶定義的。 針對 Azure 事件,例如,儲存體 帳戶、IoT 中樞 等,您可以使用此 CLI 命令 'az eventgrid topic-type list-event-types' 查詢其事件類型。

--labels

與這個事件訂用帳戶相關聯的標籤以空格分隔的清單。

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

儲存體 佇列訊息存留時間以秒為單位。

--remove

從清單中移除屬性或專案。 範例: --remove property.list <indexToRemove>--remove propertyToRemove

預設值: []
--set

指定要設定的屬性路徑和值,以更新物件。 範例:--set property1.property2=<value>

預設值: []
--source-resource-id

需要更新事件訂用帳戶的 Azure 資源完整標識碼。

使用量: --source-resource-id Azure-Resource-ID For Azure 訂用帳戶: --source-resource-id /subscriptions/{SubID} 針對資源群組: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid 主題: --source--resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 For storage account: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.儲存體/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

選擇性字串,可根據前置詞篩選事件訂閱的事件。 不支援萬用字元。

--subject-ends-with

選擇性字串,可根據後綴篩選事件訂閱的事件。 不支援萬用字元。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az eventgrid event-subscription update (eventgrid 擴充功能)

預覽

命令群組 'az eventgrid' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

更新事件訂閱。

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]

範例

更新事件方格主題的事件訂用帳戶,以指定新的端點。

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

更新 Azure 訂用帳戶的事件訂用帳戶,以指定具有篩選條件的新主旨端。

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

更新資源群組的事件訂用帳戶,以指定新的端點和具有篩選條件的新主旨端。

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

更新記憶體帳戶的事件訂用帳戶,以指定包含事件類型的新清單。

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

更新記憶體帳戶的事件訂用帳戶,以包含寄不出的目的地。

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

使用進階篩選來更新記憶體帳戶的事件訂用帳戶。

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

必要參數

--name -n

事件訂閱的名稱。

選擇性參數

--add

藉由指定路徑和索引鍵值組,將物件加入物件清單。 範例:--add property.listProperty <key=value, string or JSON string>

預設值: []
--advanced-filter

進階篩選會根據特定事件屬性來篩選事件。

使用方式:--advanced-filter KEY[。INNERKEY] FILTEROPERATOR 值 [VALUE ...]StringIn:-advanced-filter 數據。Color StringIn Blue Red Orange Yellow StringNotIn: --advanced-filter 數據。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 subject StringEndsWith 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-filterdata.property2 NumberLessThanOrEquals 100 NumberGreaterThan: --advanced-filter data.property3 NumberGreaterThan 100 NumberGreaterThanOrEquals: --advanced-filter data.property2 NumberGreaterThanOrEquals 100 BoolEquals: --advanced-filter data.property3 BoolEquals true 使用多個 --advanced-filter 自變數來指定多個進階篩選。

--deadletter-endpoint

Azure 儲存體 Blob 容器目的地的 Azure 資源識別符,其中 EventGrid 應該為此事件訂用帳戶造成無法傳遞的事件。

--deadletter-identity

死者目的地資源的識別類型。

接受的值: systemassigned
--deadletter-identity-endpoint

具有身分識別之 Azure 儲存體 Blob 容器目的地的 Azure 資源識別符,其中 EventGrid 應該為此事件訂用帳戶造成無法傳遞的事件。

--delivery-identity

傳遞目的地資源的識別類型(例如記憶體佇列或 eventhub)。

接受的值: systemassigned
--delivery-identity-endpoint

具有身分識別的端點,其中 EventGrid 應該傳遞符合此事件訂用帳戶的事件。 針對 Webhook 端點類型,這應該是對應的 Webhook URL。 對於其他端點類型,這應該是端點的 Azure 資源識別碼。

--delivery-identity-endpoint-type

具有資源識別的目的地端點類型。

接受的值: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
--endpoint

EventGrid 應傳遞符合此事件訂用帳戶的事件的端點。 針對 Webhook 端點類型,這應該是對應的 Webhook URL。 對於其他端點類型,這應該是端點的 Azure 資源識別碼。

--endpoint-type

目的地端點的類型。

接受的值: azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook
預設值: webhook
--force-string

使用 'set' 或 'add' 時,請保留字串常值,而不是嘗試轉換成 JSON。

預設值: False
--included-event-types

以空格分隔的事件類型清單。 範例:Microsoft。儲存體。BlobCreated Microsoft。儲存體。BlobDeleted。 若要訂閱所有預設事件類型,請勿為此自變數指定任何值。

--labels

與這個事件訂用帳戶相關聯的標籤以空格分隔的清單。

--remove

從清單中移除屬性或專案。 範例: --remove property.list <indexToRemove>--remove propertyToRemove

預設值: []
--set

指定要設定的屬性路徑和值,以更新物件。 範例:--set property1.property2=<value>

預設值: []
--source-resource-id

需要更新事件訂用帳戶的 Azure 資源完整標識碼。

使用量: --source-resource-id Azure-Resource-ID For Azure 訂用帳戶: --source-resource-id /subscriptions/{SubID} 針對資源群組: --source-resource-id /subscriptions/{SubID}/resourceGroups/rg1 For EventGrid 主題: --source--resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.EventGrid/topics/t1 適用於記憶體帳戶:--source-resource-id /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.儲存體/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

選擇性字串,可根據前置詞篩選事件訂閱的事件。 不支援萬用字元。

--subject-ends-with

選擇性字串,可根據後綴篩選事件訂閱的事件。 不支援萬用字元。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。