Azure Event Grid イベントのイベント ハンドラーとしてのストレージ キュー

イベント ハンドラーは、イベントが送信される場所です。 ハンドラーは、さらにいくつかのアクションを行ってイベントを処理します。 イベントを処理するように複数の Azure サービスが自動的に構成され、 Azure Queue Storage もその 1 つです。

Queue Storage を使用して、プルする必要があるイベントを受信します。 実行時間の長いプロセスがあり、応答に時間がかかりすぎる場合は、Queue Storage を使用できます。 Queue ストレージにイベントを送信することで、アプリは独自のスケジュールでイベントをプルおよび処理できます。

  • Azure Storage アカウント用に構成されたファイアウォールまたは仮想ネットワーク規則がない場合は、ユーザー割り当て ID とシステム割り当て ID の両方を使用して、Azure Storage アカウントにイベントを配信できます。
  • Azure Storage アカウントに対してファイアウォールまたは仮想ネットワーク規則が構成されている場合は、 信頼されたサービス 一覧の Azure サービスがストレージ アカウントでも有効 になっている場合は、システム割り当てマネージド ID のみを使用できます。 このオプションが有効かどうかに関係なく、ユーザー割り当てマネージド ID は使用できません。

チュートリアル

イベント ハンドラーとして Queue Storage を使用する例については、次のチュートリアルを参照してください。

タイトル 説明
クイック スタート: Azure CLI と Event Grid を使用してカスタム イベントを Azure Queue Storage にルーティングする Queue Storage にカスタム イベントを送信する方法について説明します。

REST の例 (PUT の場合)

イベント ハンドラーとしてのストレージ キュー

{
	"properties": 
	{
		"destination": 
		{
			"endpointType": "StorageQueue",
			"properties": 
			{
				"resourceId": "/subscriptions/<AZURE SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Storage/storageAccounts/<STORAGE ACCOUNT NAME>",
				"queueName": "<QUEUE NAME>"
			}
		},
		"eventDeliverySchema": "EventGridSchema"
	}
}

イベント ハンドラーとしてのストレージ キュー - マネージド ID を使用した配信

{
	"properties": 
	{
		"deliveryWithResourceIdentity": 
		{
			"identity": 
			{
				"type": "SystemAssigned"
			},
			"destination": 
			{
				"endpointType": "StorageQueue",
				"properties": 
				{
					"resourceId": "/subscriptions/<AZURE SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Storage/storageAccounts/<STORAGE ACCOUNT NAME>",
					"queueName": "<QUEUE NAME>"
				}
			}
		},
		"eventDeliverySchema": "EventGridSchema"
	}
}

デッドレター宛先を指定したイベント ハンドラーとしてのストレージ キュー

{
	"name": "",
	"properties": 
	{
		"destination": 
		{
			"endpointType": "StorageQueue",
			"properties": 
			{
				"resourceId": "/subscriptions/<AZURE SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Storage/storageAccounts/<DESTINATION STORAGE>",
				"queueName": "queue1"
			}
		},
		"eventDeliverySchema": "EventGridSchema",
		"deadLetterDestination": 
		{
			"endpointType": "StorageBlob",
			"properties": 
			{
				"resourceId": "/subscriptions/<AZURE SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Storage/storageAccounts/<DEADLETTER STORAGE>",
				"blobContainerName": "test"
			}
		}
	}
}

イベント ハンドラーとしてのストレージ キューと配信不能の宛先 - マネージド ID

{
	"properties": 
	{
		"destination": 
		{
			"endpointType": "StorageQueue",
			"properties": 
			{
				"resourceId": "/subscriptions/<AZURE SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Storage/storageAccounts/<DESTINATION STORAGE>",
				"queueName": "queue1"
			}
		},
		"eventDeliverySchema": "EventGridSchema",
		"deadLetterWithResourceIdentity": 
		{
			"identity": 
			{
				"type": "SystemAssigned"
			},
			"deadLetterDestination": 
			{
				"endpointType": "StorageBlob",
				"properties": 
				{
					"resourceId": "/subscriptions/<AZURE SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Storage/storageAccounts/<DEADLETTER STORAGE>",
					"blobContainerName": "test"
				}
			}
		}
	}
}

次のステップ

サポートされている イベント ハンドラーの 一覧については、イベント ハンドラーに関する記事を参照してください。