az eventgrid system-topic event-subscription
管理系统主题的事件订阅。
命令
名称 | 说明 | 类型 | Status |
---|---|---|---|
az eventgrid system-topic event-subscription create |
为系统主题创建新的事件订阅。 |
Core | GA |
az eventgrid system-topic event-subscription delete |
删除系统主题的事件订阅。 |
Core | GA |
az eventgrid system-topic event-subscription list |
列出特定系统主题的事件订阅。 |
Core | GA |
az eventgrid system-topic event-subscription show |
获取系统主题的事件订阅的详细信息。 |
Core | GA |
az eventgrid system-topic event-subscription update |
更新系统主题的事件订阅。 |
Core | GA |
az eventgrid system-topic event-subscription create
为系统主题创建新的事件订阅。
az eventgrid system-topic event-subscription create --name
--resource-group
--system-topic-name
[--aad-tenant-id --azure-active-directory-tenant-id]
[--advanced-filter]
[--azure-active-directory-application-id-or-uri]
[--deadletter-endpoint]
[--delivery-attribute-mapping]
[--enable-advanced-filtering-on-arrays --enable-af-arr {false, true}]
[--endpoint]
[--endpoint-type {azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook}]
[--event-delivery-schema {cloudeventschemav1_0, custominputschema, eventgridschema}]
[--event-ttl]
[--expiration-date]
[--included-event-types]
[--labels]
[--max-delivery-attempts]
[--max-events-per-batch]
[--preferred-batch-size-in-kilobytes]
[--qttl --storage-queue-msg-ttl]
[--subject-begins-with]
[--subject-case-sensitive {false, true}]
[--subject-ends-with]
示例
使用默认筛选器为事件网格系统主题创建新的事件订阅。
az eventgrid system-topic event-subscription create --name es1 \
-g rg1 --system-topic-name systemtopic1 \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code
为事件网格系统主题创建新的事件订阅,其中包含指定主题前缀的筛选器。
az eventgrid system-topic event-subscription create --name es4 \
-g rg1 --system-topic-name systemtopic1 \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code \
--subject-begins-with mysubject_prefix
使用默认筛选器和 CloudEvent V 1.0 作为传递架构,为事件网格系统主题创建新的事件订阅。
az eventgrid system-topic event-subscription create -n es2 \
-g rg1 --system-topic-name systemtopic1 \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code \
--event-delivery-schema cloudeventschemav1_0
为事件网格系统主题创建新的事件订阅,其死信目标和自定义重试策略最大为 10 次传递尝试,事件 TTL 为 2 小时(以较早时间为准)和到期日期。
az eventgrid system-topic event-subscription create --name es2 \
-g rg1 --system-topic-name systemtopic1 \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code \
--deadletter-endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/s2/blobServices/default/containers/blobcontainer1 \
--max-delivery-attempts 10 --event-ttl 120 --expiration-date "2022-10-31"
使用已启用 Azure Active Directory 的 Webhook 作为目标,为事件网格系统主题创建新的事件订阅。
az eventgrid system-topic event-subscription create --name es1 \
-g rg1 --system-topic-name systemtopic1 \
--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 system-topic event-subscription create -n es1 \
-g rg1 --system-topic-name systemtopic1 \
--endpoint /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Web/sites/{functionappname}/functions/{functionname} --endpoint-type azurefunction
使用存储队列作为目标(ttl 为 5 分钟)为事件网格系统主题创建新的事件订阅
az eventgrid system-topic event-subscription create -n es1 \
-g rg1 --system-topic-name systemtopic1 \
--endpoint-type storagequeue \
--endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/queueservices/default/queues/q1 \
--storage-queue-msg-ttl 300
为事件网格系统主题创建新的事件订阅,并在数组上启用高级筛选
az eventgrid system-topic event-subscription create -n es1 \
-g rg1 --system-topic-name systemtopic1 \
--endpoint /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.Web/sites/{functionappname}/functions/{functionname} --endpoint-type azurefunction \
--enable-advanced-filtering-on-arrays true
必需参数
事件订阅的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
系统主题的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
用于获取将作为传递请求中的持有者令牌包含的访问令牌的 Azure Active Directory 租户 ID。 仅适用于 Webhook 作为目标。
高级筛选器允许基于特定事件属性筛选事件。
用法:--advanced-filter KEY[.INNERKEY] FILTEROPERATOR 值 [VALUE ...]StringIn:--advanced-filter 数据。颜色 StringIn 蓝色红色橙色黄色 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
参数来指定。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
用于获取访问令牌的 Azure Active Directory 应用程序 ID 或 URI,该令牌将作为持有者令牌包含在传递请求中。 仅适用于 Webhook 作为目标。
Azure 存储 Blob 容器目标的 Azure 资源 ID,EventGrid 应为此事件订阅删除无法传送的事件。
示例:--deadletter-endpoint /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/sa1/blobServices/default/containers/containerName。
添加传递属性映射,以在传递事件时通过 HTTP 标头发送其他信息。 此属性对所有目标类型(StorageQueue 除外)有效。 可以使用多个 --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.
允许针对值数组(而不是期望一个单一值)评估高级筛选器。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
接受的值: | false, true |
EventGrid 应提供匹配此事件订阅的事件的终结点。 对于 Webhook 终结点类型,应为相应的 Webhook URL。 对于其他终结点类型,这应该是终结点的 Azure 资源标识符。 预期目标终结点已在执行任何事件网格命令之前创建并可供使用。
目标终结点的类型。
属性 | 值 |
---|---|
默认值: | webhook |
接受的值: | azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook |
应为此事件订阅传递事件的架构。 默认情况下,事件将以发布它们的同一架构(基于相应主题的输入架构)传送。
属性 | 值 |
---|---|
接受的值: | cloudeventschemav1_0, custominputschema, eventgridschema |
活动生存时间(以分钟为单位)。 必须是介于 1 和 1440 之间的数字。
属性 | 值 |
---|---|
默认值: | 1440 |
日期或日期/时间(UTC,例如“2018-11-30T11:59:59+00:00”或“2018-11-30”),之后事件订阅将过期。 默认情况下,事件订阅没有过期时间。
事件类型的空格分隔列表(例如,Microsoft.Storage.BlobCreated 和 Microsoft.Storage.BlobDeleted)。 若要订阅所有默认事件类型,请不要为此参数指定任何值。 对于事件网格主题,事件类型是客户定义的。 对于 Azure 事件,例如存储帐户、IoT 中心等,可以使用此 CLI 命令“az eventgrid topic-type list-event-types”查询其事件类型。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
要与此事件订阅关联的标签的空格分隔列表。
最大传递尝试次数。 必须是介于 1 和 30 之间的数字。
属性 | 值 |
---|---|
默认值: | 30 |
批处理中的最大事件数。 必须是介于 1 和 5000 之间的数字。
首选批大小(以 KB 为单位)。 必须是介于 1 和 1024 之间的数字。
存储队列消息生存时间(以秒为单位)。
一个可选字符串,用于根据前缀筛选事件订阅的事件。 不支持通配符。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
指定以指示是否应以区分大小写的方式比较主题字段。 如此 如果存在标志。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
默认值: | False |
接受的值: | false, true |
一个可选字符串,用于根据后缀筛选事件订阅的事件。 不支持通配符。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az eventgrid system-topic event-subscription delete
删除系统主题的事件订阅。
az eventgrid system-topic event-subscription delete --name
--resource-group
--system-topic-name
[--yes]
示例
删除事件网格系统主题的事件订阅。
az eventgrid system-topic event-subscription delete --name es1 \
-g rg1 --system-topic-name systemtopic1 \
必需参数
事件订阅的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
系统主题的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
不要提示确认。
属性 | 值 |
---|---|
默认值: | False |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az eventgrid system-topic event-subscription list
列出特定系统主题的事件订阅。
az eventgrid system-topic event-subscription list --resource-group
--system-topic-name
[--odata-query]
示例
列出为事件网格系统主题创建的所有事件订阅。
az eventgrid system-topic event-subscription list -g rg1 --system-topic-name systemtopic1
必需参数
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
系统主题的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
用于筛选列表结果的 OData 查询。 目前仅允许对 Name 属性进行筛选。 支持的操作包括:CONTAINS、eq(等于)、ne(不等于)、AND、OR 和 NOT。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az eventgrid system-topic event-subscription show
获取系统主题的事件订阅的详细信息。
az eventgrid system-topic event-subscription show --name
--resource-group
--system-topic-name
[--include-attrib-secret --include-static-delivery-attribute-secret {false, true}]
[--include-full-endpoint-url {false, true}]
示例
显示事件网格系统主题的事件订阅的详细信息。
az eventgrid system-topic event-subscription show --name es1 \
-g rg1 --system-topic-name systemtopic1
显示事件网格系统主题的事件订阅的详细信息包括任何静态传递属性机密。
az eventgrid system-topic event-subscription show --name es1 \
-g rg1 --system-topic-name systemtopic1 --include-attrib-secret
必需参数
事件订阅的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
系统主题的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
指示是否应返回任何静态传递属性机密。 如此 如果存在标志。
属性 | 值 |
---|---|
默认值: | False |
接受的值: | false, true |
指定以指示是否应返回完整的终结点 URL。 如此 如果存在标志。
属性 | 值 |
---|---|
默认值: | False |
接受的值: | false, true |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az eventgrid system-topic event-subscription update
更新系统主题的事件订阅。
az eventgrid system-topic event-subscription update --name
--resource-group
--system-topic-name
[--advanced-filter]
[--deadletter-endpoint]
[--delivery-attribute-mapping]
[--enable-advanced-filtering-on-arrays --enable-af-arr {false, true}]
[--endpoint]
[--endpoint-type {azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook}]
[--included-event-types]
[--labels]
[--qttl --storage-queue-msg-ttl]
[--subject-begins-with]
[--subject-ends-with]
示例
更新事件网格系统主题的事件订阅以指定新的终结点。
az eventgrid system-topic event-subscription update --name es1 \
-g rg1 --system-topic-name systemtopic1 --endpoint https://contoso.azurewebsites.net/api/f1?code=code
更新事件网格系统主题的事件订阅,以指定具有筛选器的新主题端。
az eventgrid system-topic event-subscription update --name es2 \
-g rg1 --system-topic-name systemtopic1 \
--subject-ends-with .jpg
更新事件网格系统主题的事件订阅,以指定新的终结点和新的主题端,并筛选包含的事件类型的新列表。
az eventgrid system-topic event-subscription update --name es3 \
-g rg1 --system-topic-name systemtopic1 \
--subject-ends-with .png \
--endpoint https://contoso.azurewebsites.net/api/f1?code=code
--included-event-types Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted
更新 Azure 事件网格系统主题的事件订阅,以包含死信目标。
az eventgrid system-topic event-subscription update --name es2 \
-g rg1 --system-topic-name systemtopic1 \
--deadletter-endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/blobServices/default/containers/blobcontainer1
使用高级筛选器更新 Azure 事件网格系统主题的事件订阅。
az eventgrid system-topic event-subscription update --name es3 \
-g rg1 --system-topic-name systemtopic1 \
--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
使用存储队列作为目标的事件网格系统主题更新事件订阅,ttl 为 5 分钟
az eventgrid system-topic event-subscription update -n es1 \
-g rg1 --system-topic-name systemtopic1 \
--storage-queue-msg-ttl 300
更新启用了数组的高级筛选的事件网格系统主题的事件订阅
az eventgrid system-topic event-subscription update -n es1 \
-g rg1 --system-topic-name systemtopic1 \
--enable-advanced-filtering-on-arrays true
必需参数
事件订阅的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
系统主题的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
高级筛选器允许基于特定事件属性筛选事件。
用法:--advanced-filter KEY[.INNERKEY] FILTEROPERATOR 值 [VALUE ...]StringIn:--advanced-filter 数据。颜色 StringIn 蓝色红色橙色黄色 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
参数来指定。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
Azure 存储 Blob 容器目标的 Azure 资源 ID,EventGrid 应为此事件订阅删除无法传送的事件。
添加传递属性映射,以在传递事件时通过 HTTP 标头发送其他信息。 此属性对所有目标类型(StorageQueue 除外)有效。 可以使用多个 --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.
允许针对值数组(而不是期望一个单一值)评估高级筛选器。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
接受的值: | false, true |
EventGrid 应提供匹配此事件订阅的事件的终结点。 对于 Webhook 终结点类型,应为相应的 Webhook URL。 对于其他终结点类型,这应该是终结点的 Azure 资源标识符。 预期目标终结点已在执行任何事件网格命令之前创建并可供使用。
目标终结点的类型。
属性 | 值 |
---|---|
默认值: | webhook |
接受的值: | azurefunction, eventhub, hybridconnection, servicebusqueue, servicebustopic, storagequeue, webhook |
事件类型的空格分隔列表(例如,Microsoft.Storage.BlobCreated 和 Microsoft.Storage.BlobDeleted)。 若要订阅所有默认事件类型,请不要为此参数指定任何值。 对于事件网格主题,事件类型是客户定义的。 对于 Azure 事件,例如存储帐户、IoT 中心等,可以使用此 CLI 命令“az eventgrid topic-type list-event-types”查询其事件类型。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
要与此事件订阅关联的标签的空格分隔列表。
存储队列消息生存时间(以秒为单位)。
一个可选字符串,用于根据前缀筛选事件订阅的事件。 不支持通配符。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
一个可选字符串,用于根据后缀筛选事件订阅的事件。 不支持通配符。
属性 | 值 |
---|---|
Parameter group: | Filtering Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |