다음을 통해 공유


Event Grid에서 Azure Resource Management 이벤트 구독

이 문서에서는 Azure 리소스 알림 - 리소스에서 게시한 이벤트를 구독하는 데 필요한 단계를 설명합니다. 이러한 이벤트에 대한 자세한 내용은 Azure 리소스 알림 - 리소스 이벤트를 참조하세요.

리소스 시스템 토픽 만들기

이 섹션에서는 microsoft.resourcenotifications.resources 유형의 시스템 토픽을 만드는 방법을 보여줍니다.

  1. 시스템 토픽을 만들고자 하는 Azure 구독에 계정을 설정합니다.

    az account set –s AZURESUBSCRIPTIONID
    
  2. microsoft.resourcenotifications.resources 명령을 사용하여 az eventgrid system-topic create 유형의 시스템 토픽을 만듭니다.

    az eventgrid system-topic create \
                --name SYSTEMTOPICNAME \
                --resource-group RESOURCEGROUPNAME \
                --source /subscriptions/AZURESUBSCRIPTIONID \
                --topic-type microsoft.resourcenotifications.resources \
                --location Global        
    

이벤트 구독

az eventgrid system-topic event-subscription create 명령을 사용하여 위 토픽에 대한 이벤트 구독을 만듭니다.

다음 샘플 명령은 CreatedOrUpdatedDeleted 이벤트 모두에 대한 이벤트 구독을 만듭니다. included-event-types를 지정하지 않으면 모든 이벤트 유형이 기본적으로 포함됩니다.

az eventgrid system-topic event-subscription create \
                --name EVENTSUBSCRIPTIONNAME \
                --resource-group RESOURCEGROUPNAME \
                --system-topic-name SYSTEMTOPICNAME \
                –-included-event-types Microsoft.ResourceNotifications.Resources.CreatedOrUpdated, Microsoft.ResourceNotifications.Resources.Deleted \
                --endpoint /subscriptions/AZURESUBSCRIPTIONID/resourceGroups/RESOURCEGROUPNAME/providers/Microsoft.EventHub/namespaces/MYEVENTHUBSNAMESPACE/eventhubs/MYEVENTHUB \
                --endpoint-type eventhub        

이벤트 구독 및 시스템 토픽 삭제

이벤트 구독을 삭제하려면 az eventgrid system-topic event-subscription delete 명령을 사용합니다. 예를 들면 다음과 같습니다.

az eventgrid system-topic event-subscription delete --name firstEventSubscription --resourcegroup sampletestrg --system-topic-name arnSystemTopicResources

시스템 토픽을 삭제하려면 az eventgrid system-topic delete 명령을 사용합니다. 예를 들면 다음과 같습니다.

az eventgrid system-topic delete --name arnSystemTopicResources --resource-group sampletestrg

필터링 예

Azure 구독에서 가상 머신에 대한 알림 만들기, 업데이트, 삭제 구독

이 섹션에서는 Azure 구독에서 가상 머신에 대한 알림을 만들고, 업데이트하고, 삭제하는 구독의 필터링 예제를 보여 줍니다.

az eventgrid system-topic event-subscription create \
	--name firstEventSubscription \
	--resource-group sampletestrg \
	--system-topic-name arnSystemTopicResources 
	--included-event-types Microsoft.ResourceNotifications.Resources.CreatedOrUpdated, Microsoft.ResourceNotifications.Resources.Deleted \
	--endpoint /subscriptions/000000000-0000-0000-0000-000000000000/resourceGroups/sampletestrg/providers/Microsoft.EventHub/namespaces/testEventHub/eventhubs/ehforsystemtopicresources \
	--endpoint-type evenhub \
    --advanced-filter data.resourceInfo.type StringEndsWith virtualMachines

특정 리소스 그룹에서 VM 만들기, 업데이트 및 삭제 알림 구독

az eventgrid system-topic event-subscription create \
	--name firstEventSubscription \
	--resource-group sampletestrg \
	--system-topic-name arnSystemTopicResources \
	--included-event-types Microsoft.ResourceNotifications.Resources.CreatedOrUpdated, Microsoft.ResourceNotifications.Resources.Deleted \
	--endpoint/subscriptions/000000000-0000-0000-0000-0000000000000/resourceGroups/sampletestrg/providers/Microsoft.EventHub/namespaces/testEventHub/eventhubs/ehforsystemtopicresources \
	--endpoint-type evenhub \
    --subject-begins-with /subscription/{Azure subscription ID}/resourceGroups/<Resource group name>/
	--advanced-filter data.resourceInfo.type StringEndsWith virtualMachines

구독 내 특정 위치별 VM 만들기 및 업데이트 알림 구독

az eventgrid system-topic event-subscription create \
	--name firstEventSubscription \
	--resource-group sampletestrg \
	--system-topic-name arnSystemTopicResources \
	--included-event-types Microsoft.ResourceNotifications.Resources.CreatedOrUpdated \
	--endpoint/subscriptions/000000000-0000-0000-0000-0000000000000/resourceGroups/sampletestrg/providers/Microsoft.EventHub/namespaces/testEventHub/eventhubs/ehforsystemtopicresources \
	--endpoint-type evenhub \
    --subject-begins-with /subscription/{Azure subscription ID}/resourceGroups/<Resource group name>/
    --advanced-filter data.resourceInfo.location StringIn eastus 
    –-advanced-filter data.resourceInfo.type StringEndsWith virtualMachines

문의하기

이 기능에 대한 질문이나 피드백이 있는 경우 주저하지 말고 arnsupport@microsoft.com을 통해 연락해 주세요.

특정 이벤트에 대한 구체적인 피드백을 더 잘 지원하기 위해 다음 정보를 제공합니다.

누락된 이벤트의 경우:

  • 시스템 토픽 유형 이름
  • 작업이 실행되었을 때 UTC의 대략적 타임스탬프
  • 알림이 생성된 기본 리소스 ID
  • Azure Portal의 리소스로 이동하고 맨 오른쪽 모서리에서 JSON 보기를 선택합니다. 리소스 ID는 JSON 보기 페이지의 첫 번째 필드입니다.
  • 예상 이벤트 유형
  • 실행된 작업(예: VM 시작 또는 중지, 스토리지 계정 생성 등)
  • 발생한 문제에 대한 설명(예: VM이 시작되고 Microsoft.ResourceNotifications.HealthResources.AvailabilityStatusChanged 이벤트가 생성되지 않음)
  • 가능하면 실행된 작업의 상관 관계 ID를 제공합니다.

지연되었거나 예기치 않은 콘텐츠가 있는 이벤트의 경우

  • 시스템 토픽 유형 이름
  • data.resourceInfo.properties를 제외한 알림의 전체 콘텐츠
  • 발생한 문제 및 영향을 받은 필드 값에 대한 설명

이 데이터를 공유하는 동안 최종 사용자 식별 정보를 제공하고 있지 않은지 확인합니다.

다음 단계

이러한 이벤트에 대한 자세한 내용은 Azure 리소스 알림 - 리소스 이벤트를 참조하세요.