Event Grid 구독 쿼리

이 문서에서는 Azure 구독에 Event Grid 구독을 나열하는 방법을 설명합니다. 기존 Event Grid 구독을 쿼리하는 경우 다양한 구독 유형을 이해하는 것이 중요합니다. 원하는 구독 유형에 따라 다른 매개 변수를 제공합니다.

참고 항목

Azure Az PowerShell 모듈을 사용하여 Azure와 상호 작용하는 것이 좋습니다. 시작하려면 Azure PowerShell 설치를 참조하세요. Az PowerShell 모듈로 마이그레이션하는 방법에 대한 자세한 내용은 Azure PowerShell을 AzureRM에서 Azure로 마이그레이션을 참조하세요.

리소스 그룹 및 Azure 구독

Azure 구독 및 리소스 그룹은 Azure 리소스가 아닙니다. 따라서 리소스 그룹 또는 Azure 구독에 대한 Event Grid 구독에는 Azure 리소스에 대한 Event Grid 구독과 동일한 속성이 없습니다. 리소스 그룹 또는 Azure 구독에 대한 Event Grid 구독은 전역으로 간주됩니다.

Azure 구독 및 해당 리소스 그룹에 대한 Event Grid 구독을 얻으려면 매개 변수를 제공할 필요가 없습니다. 쿼리하려는 Azure 구독을 선택했는지 확인합니다. 다음 예제는 사용자 지정 항목이나 Azure 리소스에 대한 Event Grid 구독을 가져오지 않습니다.

Azure CLI의 경우

az account set -s "My Azure Subscription"
az eventgrid event-subscription list

PowerShell의 경우 다음을 사용합니다.

Set-AzContext -Subscription "My Azure Subscription"
Get-AzEventGridSubscription

Azure 구독에 대한 Event Grid 구독을 얻으려면 Microsoft.Resources.Subscriptions의 항목 유형을 제공합니다.

Azure CLI의 경우

az eventgrid event-subscription list --topic-type-name "Microsoft.Resources.Subscriptions" --location global

PowerShell의 경우 다음을 사용합니다.

Get-AzEventGridSubscription -TopicTypeName "Microsoft.Resources.Subscriptions"

Azure 구독 내 모든 리소스 그룹에 대한 Event Grid 구독을 얻으려면 Microsoft.Resources.ResourceGroups의 항목 유형을 제공합니다.

Azure CLI의 경우

az eventgrid event-subscription list --topic-type-name "Microsoft.Resources.ResourceGroups" --location global

PowerShell의 경우 다음을 사용합니다.

Get-AzEventGridSubscription -TopicTypeName "Microsoft.Resources.ResourceGroups"

지정된 리소스 그룹에 대한 Event Grid 구독을 얻으려면, 리소스 그룹의 이름을 매개 변수로 제공합니다.

Azure CLI의 경우

az eventgrid event-subscription list --resource-group myResourceGroup --location global

PowerShell의 경우 다음을 사용합니다.

Get-AzEventGridSubscription -ResourceGroupName myResourceGroup

사용자 지정 항목 및 Azure 리소스

Event Grid 사용자 지정 항목은 Azure 리소스입니다. 따라서 Blob Storage 계정과 같은 사용자 지정 항목 및 기타 리소스에 대한 Event Grid 구독을 동일한 방식으로 쿼리합니다. 사용자 지정 항목에 대한 Event Grid 구독을 얻으려면 리소스를 식별하거나 리소스의 위치를 식별하는 매개 변수를 제공해야 합니다. Azure 구독 전반에서 리소스에 대한 Event Grid 구독을 광범위하게 쿼리할 수는 없습니다.

특정 위치의 사용자 지정 항목 및 기타 리소스에 대한 Event Grid 구독을 얻으려면 위치 이름을 제공합니다.

Azure CLI의 경우

az eventgrid event-subscription list --location westus2

PowerShell의 경우 다음을 사용합니다.

Get-AzEventGridSubscription -Location westus2

특정 위치의 사용자 지정 항목에 대한 구독을 얻으려면 Microsoft.EventGrid.Topics의 위치와 항목 종류를 제공합니다.

Azure CLI의 경우

az eventgrid event-subscription list --topic-type-name "Microsoft.EventGrid.Topics" --location "westus2"

PowerShell의 경우 다음을 사용합니다.

Get-AzEventGridSubscription -TopicTypeName "Microsoft.EventGrid.Topics" -Location westus2

특정 위치의 스토리지 계정에 대한 구독을 얻으려면 Microsoft.Storage.StorageAccounts의 위치와 항목 종류를 제공합니다.

Azure CLI의 경우

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

PowerShell의 경우 다음을 사용합니다.

Get-AzEventGridSubscription -TopicTypeName "Microsoft.Storage.StorageAccounts" -Location westus2

사용자 지정 항목에 대한 Event Grid 구독을 얻으려면 사용자 지정 항목의 이름과 해당 리소스 그룹의 이름을 제공합니다.

Azure CLI의 경우

az eventgrid event-subscription list --topic-name myCustomTopic --resource-group myResourceGroup

PowerShell의 경우 다음을 사용합니다.

Get-AzEventGridSubscription -TopicName myCustomTopic -ResourceGroupName myResourceGroup

특정 리소스에 대한 Event Grid 구독을 가져오려면 리소스 ID를 제공합니다.

Azure CLI의 경우

resourceid=$(az storage account show -g myResourceGroup -n myStorageAccount --query id --output tsv)
az eventgrid event-subscription list --resource-id $resourceid

PowerShell의 경우 다음을 사용합니다.

$resourceid = (Get-AzResource -Name mystorage -ResourceGroupName myResourceGroup).ResourceId
Get-AzEventGridSubscription -ResourceId $resourceid

다음 단계