共用方式為


Microsoft.EventGrid event訂閱 2019-06-01

Bicep 資源定義

eventSubscriptions 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔

資源格式

若要建立 Microsoft.EventGrid/eventSubscriptions 資源,請將下列 Bicep 新增至範本。

resource symbolicname 'Microsoft.EventGrid/eventSubscriptions@2019-06-01' = {
  scope: resourceSymbolicName or scope
  name: 'string'
  properties: {
    deadLetterDestination: {
      endpointType: 'string'
      // For remaining properties, see DeadLetterDestination objects
    }
    destination: {
      endpointType: 'string'
      // For remaining properties, see EventSubscriptionDestination objects
    }
    expirationTimeUtc: 'string'
    filter: {
      advancedFilters: [
        {
          key: 'string'
          operatorType: 'string'
          // For remaining properties, see AdvancedFilter objects
        }
      ]
      includedEventTypes: [
        'string'
      ]
      isSubjectCaseSensitive: bool
      subjectBeginsWith: 'string'
      subjectEndsWith: 'string'
    }
    labels: [
      'string'
    ]
    retryPolicy: {
      eventTimeToLiveInMinutes: int
      maxDeliveryAttempts: int
    }
  }
}

AdvancedFilter 物件

設置 operatorType 屬性以指定物件的類型。

對於 BoolEquals,請使用:

{
  operatorType: 'BoolEquals'
  value: bool
}

對於 NumberGreaterThan,請使用:

{
  operatorType: 'NumberGreaterThan'
  value: int
}

對於 NumberGreaterThanOrEquals,請使用:

{
  operatorType: 'NumberGreaterThanOrEquals'
  value: int
}

對於 NumberIn,請使用:

{
  operatorType: 'NumberIn'
  values: [
    int
  ]
}

對於 NumberLessThan,請使用:

{
  operatorType: 'NumberLessThan'
  value: int
}

對於 NumberLessThanOrEquals,請使用:

{
  operatorType: 'NumberLessThanOrEquals'
  value: int
}

對於 NumberNotIn,請使用:

{
  operatorType: 'NumberNotIn'
  values: [
    int
  ]
}

對於 StringBeginsWith,請使用:

{
  operatorType: 'StringBeginsWith'
  values: [
    'string'
  ]
}

對於 StringContains,請使用:

{
  operatorType: 'StringContains'
  values: [
    'string'
  ]
}

對於 StringEndsWith,請使用:

{
  operatorType: 'StringEndsWith'
  values: [
    'string'
  ]
}

對於 StringIn,請使用:

{
  operatorType: 'StringIn'
  values: [
    'string'
  ]
}

對於 StringNotIn,請使用:

{
  operatorType: 'StringNotIn'
  values: [
    'string'
  ]
}

DeadLetterDestination 物件

設置 endpointType 屬性以指定對象的類型。

對於 StorageBlob,請使用:

{
  endpointType: 'StorageBlob'
  properties: {
    blobContainerName: 'string'
    resourceId: 'string'
  }
}

EventSubscriptionDestination 物件

設置 endpointType 屬性以指定對象的類型。

對於 EventHub,請使用:

{
  endpointType: 'EventHub'
  properties: {
    resourceId: 'string'
  }
}

對於 HybridConnection,請使用:

{
  endpointType: 'HybridConnection'
  properties: {
    resourceId: 'string'
  }
}

對於 ServiceBusQueue,請使用:

{
  endpointType: 'ServiceBusQueue'
  properties: {
    resourceId: 'string'
  }
}

對於 StorageQueue,請使用:

{
  endpointType: 'StorageQueue'
  properties: {
    queueName: 'string'
    resourceId: 'string'
  }
}

對於 WebHook,請使用:

{
  endpointType: 'WebHook'
  properties: {
    endpointUrl: 'string'
  }
}

屬性值

Microsoft.EventGrid/eventSubscriptions

Name Description Value
name 資源名稱 字串(必填)
properties 事件訂閱的屬性 EventSubscriptionProperties
範圍 在與部署範圍不同的範圍內建立資源時,請使用 。 將此屬性設定為資源的符號名稱,以套用 擴充資源

AdvancedFilter

Name Description Value
Key 事件中的欄位/屬性,根據您想要篩選的欄位/屬性。 字串
operatorType 將類型 BoolEqualsAdvancedFilter設置為“BoolEquals”。 對於類型 NumberGreaterThanAdvancedFilter,設置為“NumberGreaterThan”。 對於 類型 NumberGreaterThanOrEqualsAdvancedFilter,設置為“NumberGreaterThanOrEquals”。 對於 類型 NumberInAdvancedFilter,設置為“NumberIn”。 對於 類型 NumberLessThanAdvancedFilter,設置為“NumberLessThan”。 對於 類型 NumberLessThanOrEqualsAdvancedFilter,設置為“NumberLessThanOrEquals”。 對於 類型 NumberNotInAdvancedFilter,設置為“NumberNotIn”。 將類型 StringBeginsWithAdvancedFilter 設置為“StringBeginsWith”。 將 類型 StringContainsAdvancedFilter 設置為“StringContains”。 對於 類型 StringEndsWithAdvancedFilter,設置為“StringEndsWith”。 對於 類型 StringInAdvancedFilter,設置為“StringIn”。 對於 類型 StringNotInAdvancedFilter,設置為“StringNotIn”。 'BoolEquals'
'NumberGreaterThan'
'NumberGreaterThanOrEquals'
'NumberIn'
'NumberLessThan'
'NumberLessThanOrEquals'
'NumberNotIn'
'StringBeginsWith'
'StringContains'
'StringEndsWith'
'StringIn'
'StringNotIn'(必需)

BoolEqualsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'BoolEquals'(必填)
value 布爾篩選值。 bool

DeadLetterDestination

Name Description Value
endpointType 將類型 StorageBlobDeadLetterDestination 設置為“StorageBlob”。 “StorageBlob”(必需)

EventHubEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 “EventHub”(必需)
properties 事件訂用帳戶目的地的事件中樞屬性 EventHubEventSubscriptionDestinationProperties

EventHubEventSubscriptionDestinationProperties

Name Description Value
resourceId 代表事件訂用帳戶事件中樞目的地端點的 Azure 資源識別碼。 字串

EventSubscriptionDestination

Name Description Value
endpointType 類型 EventHubEventSubscriptionDestination 設置為“EventHub”。 將類型 HybridConnectionEventSubscriptionDestination 設置為“HybridConnection”。 將 ServiceBusQueueEventSubscriptionDestination 類型設置為“ServiceBusQueue”。 將類型 StorageQueueEventSubscriptionDestination 設置為“StorageQueue”。 將類型 WebHookEventSubscriptionDestination 設置為“WebHook”。 'EventHub'
'HybridConnection'
'ServiceBusQueue'
'StorageQueue'
'WebHook'(必需)

EventSubscriptionFilter

Name Description Value
advancedFilters 用於篩選事件訂閱的進階篩選陣列。 AdvancedFilter[]
includedEventTypes 需要屬於事件訂用帳戶一部分的適用事件類型清單。 如果想要訂閱所有預設事件類型,請將 IncludedEventTypes 設定為 null。 string[]
isSubjectCaseSensitive 指定篩選條件的 SubjectBeginsWith 和 SubjectEndsWith 屬性
應該以區分大小寫的方式進行比較。
bool
subjectBeginsWith 選擇性字串,可根據資源路徑前置詞篩選事件訂用帳戶的事件。
此格式取決於事件的發行者。
此路徑不支援通配符。
字串
subjectEndsWith 選擇性字串,可根據資源路徑後綴篩選事件訂用帳戶的事件。
此路徑不支援通配符。
字串

EventSubscriptionProperties

Name Description Value
deadLetterDestination 事件訂用帳戶的DeadLetter目的地。 DeadLetterDestination
目的地 事件訂閱必須傳遞事件目的地的相關信息。 EventSubscriptionDestination
expirationTimeUtc 事件訂閱的到期時間。 字串
篩選 事件訂閱篩選的相關信息。 EventSubscriptionFilter
labels 使用者定義的標籤清單。 string[]
retryPolicy 事件的重試原則。 這可用來設定事件傳遞嘗試次數上限和存留時間。 RetryPolicy

HybridConnectionEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 “HybridConnection”(必需)
properties 事件訂用帳戶目的地的混合式連線屬性 HybridConnectionEventSubscriptionDestinationProperties

HybridConnectionEventSubscriptionDestinationProperties

Name Description Value
resourceId 混合式連線的 Azure 資源識別碼,這是事件訂用帳戶的目的地。 字串

NumberGreaterThanAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberGreaterThan'(必填)
value 篩選值。 int

NumberGreaterThanOrEqualsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 “NumberGreaterThanOrEquals”(必需)
value 篩選值。 int

NumberInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberIn'(必填)
values 一組篩選值。 int[]

NumberLessThanAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberLessThan'(必填)
value 篩選值。 int

NumberLessThanOrEqualsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberLessThanOrEquals'(必需)
value 篩選值。 int

NumberNotInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberNotIn'(必需)
values 一組篩選值。 int[]

RetryPolicy

Name Description Value
eventTimeToLiveInMinutes 活動存留時間(以分鐘為單位)。 int
maxDeliveryAttempts 事件的傳遞重試嘗試次數上限。 int

ServiceBusQueueEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 'ServiceBusQueue'(必需)
properties 事件訂用帳戶目的地的服務總線屬性 ServiceBusQueueEventSubscriptionDestinationProperties

ServiceBusQueueEventSubscriptionDestinationProperties

Name Description Value
resourceId 代表事件訂用帳戶之服務總線目的地端點的 Azure 資源識別符。 字串

StorageBlobDeadLetterDestination

Name Description Value
endpointType 寄不出的信件目的地的端點類型 “StorageBlob”(必需)
properties 記憶體 Blob 型死機目的地的屬性 StorageBlobDeadLetterDestinationProperties

StorageBlobDeadLetterDestinationProperties

Name Description Value
blobContainerName 記憶體 Blob 容器的名稱,該容器是死機事件的目的地 字串
resourceId 記憶體帳戶的 Azure 資源識別符,這是死機事件的目的地 字串

StorageQueueEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 'StorageQueue'(必需)
properties 事件訂用帳戶目的地的記憶體佇列屬性 StorageQueueEventSubscriptionDestinationProperties

StorageQueueEventSubscriptionDestinationProperties

Name Description Value
queueName 記憶體帳戶下記憶體佇列的名稱,該記憶體帳戶是事件訂用帳戶的目的地。 字串
resourceId 記憶體帳戶的 Azure 資源識別碼,其中包含事件訂用帳戶目的地的佇列。 字串

StringBeginsWithAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringBeginsWith'(必需)
values 一組篩選值。 string[]

StringContainsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringContains'(必需)
values 一組篩選值。 string[]

StringEndsWithAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringEndsWith'(必需)
values 一組篩選值。 string[]

StringInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringIn'(必需)
values 一組篩選值。 string[]

StringNotInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringNotIn'(必需)
values 一組篩選值。 string[]

WebHookEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 'WebHook'(必需)
properties 事件訂用帳戶目的地的 WebHook 屬性 WebHookEventSubscriptionDestinationProperties

WebHookEventSubscriptionDestinationProperties

Name Description Value
endpointUrl 表示事件訂用帳戶目的地端點的 URL。 字串

使用範例

Azure 快速入門範例

下列 Azure 快速入門範本 包含用於部署此資源類型的 Bicep 範例。

Bicep 檔 Description
建立 Azure 事件方格自定義主題和佇列訂用帳戶 建立 Azure 事件方格自定義主題和服務總線佇列訂用帳戶。 範本最初由 Markus Meyer 撰寫。
建立 Azure 事件方格自定義主題和訂用帳戶 建立 Azure 事件方格自定義主題和 Webhook 訂用帳戶。 範本最初由John Downs 撰寫。

ARM 樣本資源定義

eventSubscriptions 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔

資源格式

若要建立 Microsoft.EventGrid/eventSubscriptions 資源,請將下列 JSON 新增至範本。

{
  "type": "Microsoft.EventGrid/eventSubscriptions",
  "apiVersion": "2019-06-01",
  "name": "string",
  "properties": {
    "deadLetterDestination": {
      "endpointType": "string"
      // For remaining properties, see DeadLetterDestination objects
    },
    "destination": {
      "endpointType": "string"
      // For remaining properties, see EventSubscriptionDestination objects
    },
    "expirationTimeUtc": "string",
    "filter": {
      "advancedFilters": [ {
        "key": "string",
        "operatorType": "string"
        // For remaining properties, see AdvancedFilter objects
      } ],
      "includedEventTypes": [ "string" ],
      "isSubjectCaseSensitive": "bool",
      "subjectBeginsWith": "string",
      "subjectEndsWith": "string"
    },
    "labels": [ "string" ],
    "retryPolicy": {
      "eventTimeToLiveInMinutes": "int",
      "maxDeliveryAttempts": "int"
    }
  }
}

AdvancedFilter 物件

設置 operatorType 屬性以指定物件的類型。

對於 BoolEquals,請使用:

{
  "operatorType": "BoolEquals",
  "value": "bool"
}

對於 NumberGreaterThan,請使用:

{
  "operatorType": "NumberGreaterThan",
  "value": "int"
}

對於 NumberGreaterThanOrEquals,請使用:

{
  "operatorType": "NumberGreaterThanOrEquals",
  "value": "int"
}

對於 NumberIn,請使用:

{
  "operatorType": "NumberIn",
  "values": [ "int" ]
}

對於 NumberLessThan,請使用:

{
  "operatorType": "NumberLessThan",
  "value": "int"
}

對於 NumberLessThanOrEquals,請使用:

{
  "operatorType": "NumberLessThanOrEquals",
  "value": "int"
}

對於 NumberNotIn,請使用:

{
  "operatorType": "NumberNotIn",
  "values": [ "int" ]
}

對於 StringBeginsWith,請使用:

{
  "operatorType": "StringBeginsWith",
  "values": [ "string" ]
}

對於 StringContains,請使用:

{
  "operatorType": "StringContains",
  "values": [ "string" ]
}

對於 StringEndsWith,請使用:

{
  "operatorType": "StringEndsWith",
  "values": [ "string" ]
}

對於 StringIn,請使用:

{
  "operatorType": "StringIn",
  "values": [ "string" ]
}

對於 StringNotIn,請使用:

{
  "operatorType": "StringNotIn",
  "values": [ "string" ]
}

DeadLetterDestination 物件

設置 endpointType 屬性以指定對象的類型。

對於 StorageBlob,請使用:

{
  "endpointType": "StorageBlob",
  "properties": {
    "blobContainerName": "string",
    "resourceId": "string"
  }
}

EventSubscriptionDestination 物件

設置 endpointType 屬性以指定對象的類型。

對於 EventHub,請使用:

{
  "endpointType": "EventHub",
  "properties": {
    "resourceId": "string"
  }
}

對於 HybridConnection,請使用:

{
  "endpointType": "HybridConnection",
  "properties": {
    "resourceId": "string"
  }
}

對於 ServiceBusQueue,請使用:

{
  "endpointType": "ServiceBusQueue",
  "properties": {
    "resourceId": "string"
  }
}

對於 StorageQueue,請使用:

{
  "endpointType": "StorageQueue",
  "properties": {
    "queueName": "string",
    "resourceId": "string"
  }
}

對於 WebHook,請使用:

{
  "endpointType": "WebHook",
  "properties": {
    "endpointUrl": "string"
  }
}

屬性值

Microsoft.EventGrid/eventSubscriptions

Name Description Value
apiVersion API 版本 '2019-06-01'
name 資源名稱 字串(必填)
properties 事件訂閱的屬性 EventSubscriptionProperties
型別 資源類型 'Microsoft.EventGrid/eventSubscriptions'

AdvancedFilter

Name Description Value
Key 事件中的欄位/屬性,根據您想要篩選的欄位/屬性。 字串
operatorType 將類型 BoolEqualsAdvancedFilter設置為“BoolEquals”。 對於類型 NumberGreaterThanAdvancedFilter,設置為“NumberGreaterThan”。 對於 類型 NumberGreaterThanOrEqualsAdvancedFilter,設置為“NumberGreaterThanOrEquals”。 對於 類型 NumberInAdvancedFilter,設置為“NumberIn”。 對於 類型 NumberLessThanAdvancedFilter,設置為“NumberLessThan”。 對於 類型 NumberLessThanOrEqualsAdvancedFilter,設置為“NumberLessThanOrEquals”。 對於 類型 NumberNotInAdvancedFilter,設置為“NumberNotIn”。 將類型 StringBeginsWithAdvancedFilter 設置為“StringBeginsWith”。 將 類型 StringContainsAdvancedFilter 設置為“StringContains”。 對於 類型 StringEndsWithAdvancedFilter,設置為“StringEndsWith”。 對於 類型 StringInAdvancedFilter,設置為“StringIn”。 對於 類型 StringNotInAdvancedFilter,設置為“StringNotIn”。 'BoolEquals'
'NumberGreaterThan'
'NumberGreaterThanOrEquals'
'NumberIn'
'NumberLessThan'
'NumberLessThanOrEquals'
'NumberNotIn'
'StringBeginsWith'
'StringContains'
'StringEndsWith'
'StringIn'
'StringNotIn'(必需)

BoolEqualsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'BoolEquals'(必填)
value 布爾篩選值。 bool

DeadLetterDestination

Name Description Value
endpointType 將類型 StorageBlobDeadLetterDestination 設置為“StorageBlob”。 “StorageBlob”(必需)

EventHubEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 “EventHub”(必需)
properties 事件訂用帳戶目的地的事件中樞屬性 EventHubEventSubscriptionDestinationProperties

EventHubEventSubscriptionDestinationProperties

Name Description Value
resourceId 代表事件訂用帳戶事件中樞目的地端點的 Azure 資源識別碼。 字串

EventSubscriptionDestination

Name Description Value
endpointType 類型 EventHubEventSubscriptionDestination 設置為“EventHub”。 將類型 HybridConnectionEventSubscriptionDestination 設置為“HybridConnection”。 將 ServiceBusQueueEventSubscriptionDestination 類型設置為“ServiceBusQueue”。 將類型 StorageQueueEventSubscriptionDestination 設置為“StorageQueue”。 將類型 WebHookEventSubscriptionDestination 設置為“WebHook”。 'EventHub'
'HybridConnection'
'ServiceBusQueue'
'StorageQueue'
'WebHook'(必需)

EventSubscriptionFilter

Name Description Value
advancedFilters 用於篩選事件訂閱的進階篩選陣列。 AdvancedFilter[]
includedEventTypes 需要屬於事件訂用帳戶一部分的適用事件類型清單。 如果想要訂閱所有預設事件類型,請將 IncludedEventTypes 設定為 null。 string[]
isSubjectCaseSensitive 指定篩選條件的 SubjectBeginsWith 和 SubjectEndsWith 屬性
應該以區分大小寫的方式進行比較。
bool
subjectBeginsWith 選擇性字串,可根據資源路徑前置詞篩選事件訂用帳戶的事件。
此格式取決於事件的發行者。
此路徑不支援通配符。
字串
subjectEndsWith 選擇性字串,可根據資源路徑後綴篩選事件訂用帳戶的事件。
此路徑不支援通配符。
字串

EventSubscriptionProperties

Name Description Value
deadLetterDestination 事件訂用帳戶的DeadLetter目的地。 DeadLetterDestination
目的地 事件訂閱必須傳遞事件目的地的相關信息。 EventSubscriptionDestination
expirationTimeUtc 事件訂閱的到期時間。 字串
篩選 事件訂閱篩選的相關信息。 EventSubscriptionFilter
labels 使用者定義的標籤清單。 string[]
retryPolicy 事件的重試原則。 這可用來設定事件傳遞嘗試次數上限和存留時間。 RetryPolicy

HybridConnectionEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 “HybridConnection”(必需)
properties 事件訂用帳戶目的地的混合式連線屬性 HybridConnectionEventSubscriptionDestinationProperties

HybridConnectionEventSubscriptionDestinationProperties

Name Description Value
resourceId 混合式連線的 Azure 資源識別碼,這是事件訂用帳戶的目的地。 字串

NumberGreaterThanAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberGreaterThan'(必填)
value 篩選值。 int

NumberGreaterThanOrEqualsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 “NumberGreaterThanOrEquals”(必需)
value 篩選值。 int

NumberInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberIn'(必填)
values 一組篩選值。 int[]

NumberLessThanAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberLessThan'(必填)
value 篩選值。 int

NumberLessThanOrEqualsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberLessThanOrEquals'(必需)
value 篩選值。 int

NumberNotInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberNotIn'(必需)
values 一組篩選值。 int[]

RetryPolicy

Name Description Value
eventTimeToLiveInMinutes 活動存留時間(以分鐘為單位)。 int
maxDeliveryAttempts 事件的傳遞重試嘗試次數上限。 int

ServiceBusQueueEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 'ServiceBusQueue'(必需)
properties 事件訂用帳戶目的地的服務總線屬性 ServiceBusQueueEventSubscriptionDestinationProperties

ServiceBusQueueEventSubscriptionDestinationProperties

Name Description Value
resourceId 代表事件訂用帳戶之服務總線目的地端點的 Azure 資源識別符。 字串

StorageBlobDeadLetterDestination

Name Description Value
endpointType 寄不出的信件目的地的端點類型 “StorageBlob”(必需)
properties 記憶體 Blob 型死機目的地的屬性 StorageBlobDeadLetterDestinationProperties

StorageBlobDeadLetterDestinationProperties

Name Description Value
blobContainerName 記憶體 Blob 容器的名稱,該容器是死機事件的目的地 字串
resourceId 記憶體帳戶的 Azure 資源識別符,這是死機事件的目的地 字串

StorageQueueEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 'StorageQueue'(必需)
properties 事件訂用帳戶目的地的記憶體佇列屬性 StorageQueueEventSubscriptionDestinationProperties

StorageQueueEventSubscriptionDestinationProperties

Name Description Value
queueName 記憶體帳戶下記憶體佇列的名稱,該記憶體帳戶是事件訂用帳戶的目的地。 字串
resourceId 記憶體帳戶的 Azure 資源識別碼,其中包含事件訂用帳戶目的地的佇列。 字串

StringBeginsWithAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringBeginsWith'(必需)
values 一組篩選值。 string[]

StringContainsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringContains'(必需)
values 一組篩選值。 string[]

StringEndsWithAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringEndsWith'(必需)
values 一組篩選值。 string[]

StringInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringIn'(必需)
values 一組篩選值。 string[]

StringNotInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringNotIn'(必需)
values 一組篩選值。 string[]

WebHookEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 'WebHook'(必需)
properties 事件訂用帳戶目的地的 WebHook 屬性 WebHookEventSubscriptionDestinationProperties

WebHookEventSubscriptionDestinationProperties

Name Description Value
endpointUrl 表示事件訂用帳戶目的地端點的 URL。 字串

使用範例

Azure 快速入門範本

下列 Azure 快速入門範本 部署此資源類型。

Template Description
建立 Azure 事件方格自定義主題和佇列訂用帳戶

部署至 Azure
建立 Azure 事件方格自定義主題和服務總線佇列訂用帳戶。 範本最初由 Markus Meyer 撰寫。
建立 Azure 事件方格自定義主題和訂用帳戶

部署至 Azure
建立 Azure 事件方格自定義主題和 Webhook 訂用帳戶。 範本最初由John Downs 撰寫。
建立 Azure 事件方格自定義主題訂用帳戶

部署至 Azure
建立 Azure 事件方格自定義主題和服務總線主題訂用帳戶。 範本最初由 Markus Meyer 撰寫。
建立事件方格自定義主題和事件中樞處理程式

部署至 Azure
建立 Azure 事件方格自定義主題和事件中樞來處理事件。
針對資源事件建立事件方格訂用帳戶

部署至 Azure
建立資源群組或 Azure 訂用帳戶的事件方格訂用帳戶。
使用 CloudEvents 自定義 Azure 事件方格主題/訂用帳戶

部署至 Azure
建立自定義 Azure 事件方格主題、具有 CloudEvents 架構的 Webhook 訂用帳戶,以及邏輯應用程式作為事件處理程式。 範本最初由 Justin Yoo 撰寫。

Terraform (AzAPI 提供者) 資源定義

eventSubscriptions 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔

資源格式

若要建立 Microsoft.EventGrid/eventSubscriptions 資源,請將下列 Terraform 新增至範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.EventGrid/eventSubscriptions@2019-06-01"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      deadLetterDestination = {
        endpointType = "string"
        // For remaining properties, see DeadLetterDestination objects
      }
      destination = {
        endpointType = "string"
        // For remaining properties, see EventSubscriptionDestination objects
      }
      expirationTimeUtc = "string"
      filter = {
        advancedFilters = [
          {
            key = "string"
            operatorType = "string"
            // For remaining properties, see AdvancedFilter objects
          }
        ]
        includedEventTypes = [
          "string"
        ]
        isSubjectCaseSensitive = bool
        subjectBeginsWith = "string"
        subjectEndsWith = "string"
      }
      labels = [
        "string"
      ]
      retryPolicy = {
        eventTimeToLiveInMinutes = int
        maxDeliveryAttempts = int
      }
    }
  }
}

AdvancedFilter 物件

設置 operatorType 屬性以指定物件的類型。

對於 BoolEquals,請使用:

{
  operatorType = "BoolEquals"
  value = bool
}

對於 NumberGreaterThan,請使用:

{
  operatorType = "NumberGreaterThan"
  value = int
}

對於 NumberGreaterThanOrEquals,請使用:

{
  operatorType = "NumberGreaterThanOrEquals"
  value = int
}

對於 NumberIn,請使用:

{
  operatorType = "NumberIn"
  values = [
    int
  ]
}

對於 NumberLessThan,請使用:

{
  operatorType = "NumberLessThan"
  value = int
}

對於 NumberLessThanOrEquals,請使用:

{
  operatorType = "NumberLessThanOrEquals"
  value = int
}

對於 NumberNotIn,請使用:

{
  operatorType = "NumberNotIn"
  values = [
    int
  ]
}

對於 StringBeginsWith,請使用:

{
  operatorType = "StringBeginsWith"
  values = [
    "string"
  ]
}

對於 StringContains,請使用:

{
  operatorType = "StringContains"
  values = [
    "string"
  ]
}

對於 StringEndsWith,請使用:

{
  operatorType = "StringEndsWith"
  values = [
    "string"
  ]
}

對於 StringIn,請使用:

{
  operatorType = "StringIn"
  values = [
    "string"
  ]
}

對於 StringNotIn,請使用:

{
  operatorType = "StringNotIn"
  values = [
    "string"
  ]
}

DeadLetterDestination 物件

設置 endpointType 屬性以指定對象的類型。

對於 StorageBlob,請使用:

{
  endpointType = "StorageBlob"
  properties = {
    blobContainerName = "string"
    resourceId = "string"
  }
}

EventSubscriptionDestination 物件

設置 endpointType 屬性以指定對象的類型。

對於 EventHub,請使用:

{
  endpointType = "EventHub"
  properties = {
    resourceId = "string"
  }
}

對於 HybridConnection,請使用:

{
  endpointType = "HybridConnection"
  properties = {
    resourceId = "string"
  }
}

對於 ServiceBusQueue,請使用:

{
  endpointType = "ServiceBusQueue"
  properties = {
    resourceId = "string"
  }
}

對於 StorageQueue,請使用:

{
  endpointType = "StorageQueue"
  properties = {
    queueName = "string"
    resourceId = "string"
  }
}

對於 WebHook,請使用:

{
  endpointType = "WebHook"
  properties = {
    endpointUrl = "string"
  }
}

屬性值

Microsoft.EventGrid/eventSubscriptions

Name Description Value
name 資源名稱 字串(必填)
parent_id 要套用此延伸模組資源之資源的標識碼。 字串(必填)
properties 事件訂閱的屬性 EventSubscriptionProperties
型別 資源類型 "Microsoft.EventGrid/eventSubscriptions@2019-06-01"

AdvancedFilter

Name Description Value
Key 事件中的欄位/屬性,根據您想要篩選的欄位/屬性。 字串
operatorType 將類型 BoolEqualsAdvancedFilter設置為“BoolEquals”。 對於類型 NumberGreaterThanAdvancedFilter,設置為“NumberGreaterThan”。 對於 類型 NumberGreaterThanOrEqualsAdvancedFilter,設置為“NumberGreaterThanOrEquals”。 對於 類型 NumberInAdvancedFilter,設置為“NumberIn”。 對於 類型 NumberLessThanAdvancedFilter,設置為“NumberLessThan”。 對於 類型 NumberLessThanOrEqualsAdvancedFilter,設置為“NumberLessThanOrEquals”。 對於 類型 NumberNotInAdvancedFilter,設置為“NumberNotIn”。 將類型 StringBeginsWithAdvancedFilter 設置為“StringBeginsWith”。 將 類型 StringContainsAdvancedFilter 設置為“StringContains”。 對於 類型 StringEndsWithAdvancedFilter,設置為“StringEndsWith”。 對於 類型 StringInAdvancedFilter,設置為“StringIn”。 對於 類型 StringNotInAdvancedFilter,設置為“StringNotIn”。 'BoolEquals'
'NumberGreaterThan'
'NumberGreaterThanOrEquals'
'NumberIn'
'NumberLessThan'
'NumberLessThanOrEquals'
'NumberNotIn'
'StringBeginsWith'
'StringContains'
'StringEndsWith'
'StringIn'
'StringNotIn'(必需)

BoolEqualsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'BoolEquals'(必填)
value 布爾篩選值。 bool

DeadLetterDestination

Name Description Value
endpointType 將類型 StorageBlobDeadLetterDestination 設置為“StorageBlob”。 “StorageBlob”(必需)

EventHubEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 “EventHub”(必需)
properties 事件訂用帳戶目的地的事件中樞屬性 EventHubEventSubscriptionDestinationProperties

EventHubEventSubscriptionDestinationProperties

Name Description Value
resourceId 代表事件訂用帳戶事件中樞目的地端點的 Azure 資源識別碼。 字串

EventSubscriptionDestination

Name Description Value
endpointType 類型 EventHubEventSubscriptionDestination 設置為“EventHub”。 將類型 HybridConnectionEventSubscriptionDestination 設置為“HybridConnection”。 將 ServiceBusQueueEventSubscriptionDestination 類型設置為“ServiceBusQueue”。 將類型 StorageQueueEventSubscriptionDestination 設置為“StorageQueue”。 將類型 WebHookEventSubscriptionDestination 設置為“WebHook”。 'EventHub'
'HybridConnection'
'ServiceBusQueue'
'StorageQueue'
'WebHook'(必需)

EventSubscriptionFilter

Name Description Value
advancedFilters 用於篩選事件訂閱的進階篩選陣列。 AdvancedFilter[]
includedEventTypes 需要屬於事件訂用帳戶一部分的適用事件類型清單。 如果想要訂閱所有預設事件類型,請將 IncludedEventTypes 設定為 null。 string[]
isSubjectCaseSensitive 指定篩選條件的 SubjectBeginsWith 和 SubjectEndsWith 屬性
應該以區分大小寫的方式進行比較。
bool
subjectBeginsWith 選擇性字串,可根據資源路徑前置詞篩選事件訂用帳戶的事件。
此格式取決於事件的發行者。
此路徑不支援通配符。
字串
subjectEndsWith 選擇性字串,可根據資源路徑後綴篩選事件訂用帳戶的事件。
此路徑不支援通配符。
字串

EventSubscriptionProperties

Name Description Value
deadLetterDestination 事件訂用帳戶的DeadLetter目的地。 DeadLetterDestination
目的地 事件訂閱必須傳遞事件目的地的相關信息。 EventSubscriptionDestination
expirationTimeUtc 事件訂閱的到期時間。 字串
篩選 事件訂閱篩選的相關信息。 EventSubscriptionFilter
labels 使用者定義的標籤清單。 string[]
retryPolicy 事件的重試原則。 這可用來設定事件傳遞嘗試次數上限和存留時間。 RetryPolicy

HybridConnectionEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 “HybridConnection”(必需)
properties 事件訂用帳戶目的地的混合式連線屬性 HybridConnectionEventSubscriptionDestinationProperties

HybridConnectionEventSubscriptionDestinationProperties

Name Description Value
resourceId 混合式連線的 Azure 資源識別碼,這是事件訂用帳戶的目的地。 字串

NumberGreaterThanAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberGreaterThan'(必填)
value 篩選值。 int

NumberGreaterThanOrEqualsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 “NumberGreaterThanOrEquals”(必需)
value 篩選值。 int

NumberInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberIn'(必填)
values 一組篩選值。 int[]

NumberLessThanAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberLessThan'(必填)
value 篩選值。 int

NumberLessThanOrEqualsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberLessThanOrEquals'(必需)
value 篩選值。 int

NumberNotInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'NumberNotIn'(必需)
values 一組篩選值。 int[]

RetryPolicy

Name Description Value
eventTimeToLiveInMinutes 活動存留時間(以分鐘為單位)。 int
maxDeliveryAttempts 事件的傳遞重試嘗試次數上限。 int

ServiceBusQueueEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 'ServiceBusQueue'(必需)
properties 事件訂用帳戶目的地的服務總線屬性 ServiceBusQueueEventSubscriptionDestinationProperties

ServiceBusQueueEventSubscriptionDestinationProperties

Name Description Value
resourceId 代表事件訂用帳戶之服務總線目的地端點的 Azure 資源識別符。 字串

StorageBlobDeadLetterDestination

Name Description Value
endpointType 寄不出的信件目的地的端點類型 “StorageBlob”(必需)
properties 記憶體 Blob 型死機目的地的屬性 StorageBlobDeadLetterDestinationProperties

StorageBlobDeadLetterDestinationProperties

Name Description Value
blobContainerName 記憶體 Blob 容器的名稱,該容器是死機事件的目的地 字串
resourceId 記憶體帳戶的 Azure 資源識別符,這是死機事件的目的地 字串

StorageQueueEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 'StorageQueue'(必需)
properties 事件訂用帳戶目的地的記憶體佇列屬性 StorageQueueEventSubscriptionDestinationProperties

StorageQueueEventSubscriptionDestinationProperties

Name Description Value
queueName 記憶體帳戶下記憶體佇列的名稱,該記憶體帳戶是事件訂用帳戶的目的地。 字串
resourceId 記憶體帳戶的 Azure 資源識別碼,其中包含事件訂用帳戶目的地的佇列。 字串

StringBeginsWithAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringBeginsWith'(必需)
values 一組篩選值。 string[]

StringContainsAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringContains'(必需)
values 一組篩選值。 string[]

StringEndsWithAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringEndsWith'(必需)
values 一組篩選值。 string[]

StringInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringIn'(必需)
values 一組篩選值。 string[]

StringNotInAdvancedFilter

Name Description Value
operatorType 用於篩選的運算符類型,例如 NumberIn、StringContains、BoolEquals 等。 'StringNotIn'(必需)
values 一組篩選值。 string[]

WebHookEventSubscriptionDestination

Name Description Value
endpointType 事件訂用帳戶目的地的端點類型 'WebHook'(必需)
properties 事件訂用帳戶目的地的 WebHook 屬性 WebHookEventSubscriptionDestinationProperties

WebHookEventSubscriptionDestinationProperties

Name Description Value
endpointUrl 表示事件訂用帳戶目的地端點的 URL。 字串

使用範例

Terraform 範例

部署 EventGrid 事件訂用帳戶的基本範例。

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "namespace" {
  type      = "Microsoft.EventHub/namespaces@2022-01-01-preview"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      disableLocalAuth     = false
      isAutoInflateEnabled = false
      publicNetworkAccess  = "Enabled"
      zoneRedundant        = false
    }
    sku = {
      capacity = 1
      name     = "Standard"
      tier     = "Standard"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "storageAccount" {
  type      = "Microsoft.Storage/storageAccounts@2021-09-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    kind = "StorageV2"
    properties = {
      accessTier                   = "Hot"
      allowBlobPublicAccess        = true
      allowCrossTenantReplication  = true
      allowSharedKeyAccess         = true
      defaultToOAuthAuthentication = false
      encryption = {
        keySource = "Microsoft.Storage"
        services = {
          queue = {
            keyType = "Service"
          }
          table = {
            keyType = "Service"
          }
        }
      }
      isHnsEnabled      = false
      isNfsV3Enabled    = false
      isSftpEnabled     = false
      minimumTlsVersion = "TLS1_2"
      networkAcls = {
        defaultAction = "Allow"
      }
      publicNetworkAccess      = "Enabled"
      supportsHttpsTrafficOnly = true
    }
    sku = {
      name = "Standard_LRS"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "eventhub" {
  type      = "Microsoft.EventHub/namespaces/eventhubs@2021-11-01"
  parent_id = azapi_resource.namespace.id
  name      = var.resource_name
  body = {
    properties = {
      messageRetentionInDays = 1
      partitionCount         = 1
      status                 = "Active"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "eventSubscription" {
  type      = "Microsoft.EventGrid/eventSubscriptions@2021-12-01"
  parent_id = azapi_resource.storageAccount.id
  name      = var.resource_name
  body = {
    properties = {
      deadLetterDestination = null
      destination = {
        endpointType = "EventHub"
        properties = {
          deliveryAttributeMappings = null
          resourceId                = azapi_resource.eventhub.id
        }
      }
      eventDeliverySchema = "EventGridSchema"
      filter = {
        includedEventTypes = [
          "Microsoft.Storage.BlobCreated",
          "Microsoft.Storage.BlobRenamed",
        ]
      }
      labels = [
      ]
      retryPolicy = {
        eventTimeToLiveInMinutes = 144
        maxDeliveryAttempts      = 10
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}