Get-AzEventGridDomain
Gets the details of an Event Grid domain, or gets a list of all Event Grid domains in the current Azure subscription.
Syntax
Get-AzEventGridDomain
[[-ResourceGroupName] <String>]
[-ODataQuery <String>]
[-Top <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzEventGridDomain
[-ResourceGroupName] <String>
[-Name] <String>
[-ODataQuery <String>]
[-Top <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzEventGridDomain
[-ResourceId] <String>
[-ODataQuery <String>]
[-Top <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzEventGridDomain
[-NextLink <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzEventGridDomain cmdlet gets either the details of a specified Event Grid domain, or a list of all Event Grid domains in the current Azure subscription. If the domain name is provided, the details of a single Event Grid domain is returned. If the domain name is not provided, a list of domains is returned. The number of elements returned in this list is controlled by the Top parameter. If the Top value is not specified or $null, the list will contain all the domains items returned at once. Otherwise, Top will indicate the maximum number of elements to be returned in the list. If more domains are still available, the value in NextLink should be used in the next call to get the next page of domains. Finally, ODataQuery parameter is used to perform filtering for the search results. The filtering query follows OData syntax using the Name property only. The supported operations include: CONTAINS, eq (for equal), ne (for not equal), AND, OR and NOT.
Examples
Example 1
Gets the details of Event Grid domain `Domain1` in resource group `MyResourceGroupName`.
Get-AzEventGridDomain -ResourceGroup MyResourceGroupName -Name Domain1
ResourceGroupName : MyResourceGroupName
DomainName : Domain1
Id : /subscriptions/<Azure Subscription Id>/resourceGroups/myresourcegroupname/providers/Microsoft.EventGrid/domains/domain1
Type : Microsoft.EventGrid/domains
Location : westus2
Endpoint : https://domain1.westus2-1.eventgrid.azure.net/api/events
ProvisioningState : Succeeded
Tags : {[Tag1, Value1], [Tag2, Value2]}
Example 2
Gets the details of Event Grid domain `Domain1` in resource group `MyResourceGroupName` using ResourceId option.
Get-AzEventGridDomain -ResourceId "/subscriptions/$subscriptionId/resourceGroups/MyResourceGroupName/providers/Microsoft.EventGrid/domains/Domain1"
ResourceGroupName : MyResourceGroupName
DomainName : Domain1
Id : /subscriptions/<Azure Subscription Id>/resourceGroups/myresourcegroupname/providers/Microsoft.EventGrid/domains/domain1
Type : Microsoft.EventGrid/domains
Location : westus2
Endpoint : https://domain1.westus2-1.eventgrid.azure.net/api/events
ProvisioningState : Succeeded
Tags : {[Tag1, Value1], [Tag2, Value2]}
Example 3
List all the Event Grid domains in resource group `MyResourceGroupName` without pagination (all domains are returned in one shot)
$result=Get-AzEventGridDomain -ResourceGroup MyResourceGroupName
Write-Output $result.PsDomainsList
ResourceGroupName : MyResourceGroupName
DomainName : Domain1
Id : /subscriptions/<Azure Subscription Id>/resourceGroups/myresourcegroupname/providers/Microsoft.EventGrid/domains/domain1
Type : Microsoft.EventGrid/domains
Location : westus2
Endpoint : https://domain1.westus2-1.eventgrid.azure.net/api/events
ProvisioningState : Succeeded
Tags : {[Tag1, Value1], [Tag2, Value2]}
ResourceGroupName : MyResourceGroupName
DomainName : Domain2
Id : /subscriptions/<Azure Subscription Id>/resourceGroups/myresourcegroupname/providers/Microsoft.EventGrid/domains/domain2
Type : Microsoft.EventGrid/domains
Location : westus2
Endpoint : https://domain2.westus2-1.eventgrid.azure.net/api/events
ProvisioningState : Succeeded
Tags :
ResourceGroupName : MyResourceGroupName
DomainName : Domain3
Id : /subscriptions/<Azure Subscription Id>/resourceGroups/myresourcegroupname/providers/Microsoft.EventGrid/domains/domain3
Type : Microsoft.EventGrid/domains
Location : westus2
Endpoint : https://domain3.westus2-1.eventgrid.azure.net/api/events
ProvisioningState : Succeeded
Tags : {[Tag3, Value3], [Tag4, Value4]}
ResourceGroupName : MyResourceGroupName
DomainName : Domain4
Id : /subscriptions/<Azure Subscription Id>/resourceGroups/myresourcegroupname/providers/Microsoft.EventGrid/domains/domain4
Type : Microsoft.EventGrid/domains
Location : westus2
Endpoint : https://domain4.westus2-1.eventgrid.azure.net/api/events
ProvisioningState : Succeeded
Tags :
Example 4
List the Event Grid domains (if any) in resource group `MyResourceGroupName` that satisfies the $odataFilter query 10 domains at a time. If more results are available, the $result.NextLink will not be $null. In order to get next page(s) of domains, user is expected to re-call Get-AzEventGridDomain and uses result.NextLink obtained from the previous call. Caller should stop when result.NextLink becomes $null.
$total = 0
$odataFilter = "Name ne 'ABCD'"
$result = Get-AzEventGridDomain -ResourceGroup MyResourceGroupName -Top 10 -ODataQuery $odataFilter
$total += $result.Count
while ($null -ne $result.NextLink)
{
$result = Get-AzEventGridDomain -NextLink $result.NextLink
$total += $result.Count
}
Write-Output "Total number of domains is $Total"
Example 5
List all the Event Grid domains in Azure Subscription without pagination (all domains are returned in one shot)
$result=Get-AzEventGridDomain
Write-Output $result.PsDomainsList
ResourceGroupName : MyResourceGroupName
DomainName : Domain1
Id : /subscriptions/<Azure Subscription Id>/resourceGroups/myresourcegroupname1/providers/Microsoft.EventGrid/domains/domain1
Type : Microsoft.EventGrid/domains
Location : westus2
Endpoint : https://domain1.westus2-1.eventgrid.azure.net/api/events
ProvisioningState : Succeeded
Tags : {[Tag1, Value1], [Tag2, Value2]}
ResourceGroupName : MyResourceGroupName
DomainName : Domain2
Id : /subscriptions/<Azure Subscription Id>/resourceGroups/myresourcegroupname1/providers/Microsoft.EventGrid/domains/domain2
Type : Microsoft.EventGrid/domains
Location : westus2
Endpoint : https://domain2.westus2-1.eventgrid.azure.net/api/events
ProvisioningState : Succeeded
Tags :
ResourceGroupName : MyResourceGroupName
DomainName : Domain3
Id : /subscriptions/<Azure Subscription Id>/resourceGroups/myresourcegroupname2/providers/Microsoft.EventGrid/domains/domain3
Type : Microsoft.EventGrid/domains
Location : westus2
Endpoint : https://domain3.westus2-1.eventgrid.azure.net/api/events
ProvisioningState : Succeeded
Tags : {[Tag3, Value3], [Tag4, Value4]}
ResourceGroupName : MyResourceGroupName
DomainName : Domain4
Id : /subscriptions/<Azure Subscription Id>/resourceGroups/myresourcegroupname3/providers/Microsoft.EventGrid/domains/domain4
Type : Microsoft.EventGrid/domains
Location : westus2
Endpoint : https://domain4.westus2-1.eventgrid.azure.net/api/events
ProvisioningState : Succeeded
Tags :
Example 6
List the Event Grid domains (if any) in Azure Subscription that satisfies the $odataFilter query 20 domains at a time. If more results are available, the $result.NextLink will not be $null. In order to get next page(s) of domains, user is expected to re-call Get-AzEventGridDomain and uses result.NextLink obtained from the previous call. Caller should stop when result.NextLink becomes $null.
$total = 0
$odataFilter = "Contains(Name, 'ABCD')"
$result = Get-AzEventGridDomain -Top 20 -ODataQuery $odataFilter
$total += $result.Count
while ($null -ne $result.NextLink)
{
$result = Get-AzEventGridDomain -NextLink $result.NextLink
$total += $result.Count
}
Write-Output "Total number of domains is $Total"
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
EventGrid domain name.
Type: | String |
Aliases: | DomainName |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-NextLink
The link for the next page of resources to be obtained. This value is obtained with the first Get-AzEventGrid cmdlet call when more resources are still available to be queried.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ODataQuery
The OData query used for filtering the list results. Filtering is currently allowed on the Name property only.The supported operations include: CONTAINS, eq (for equal), ne (for not equal), AND, OR and NOT.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
The name of the resource group.
Type: | String |
Aliases: | ResourceGroup |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceId
Resource Identifier representing the Event Grid Domain.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Top
The maximum number of resources to be obtained. Valid value is between 1 and 100. If top value is specified and more results are still available, the result will contain a link to the next page to be queried in NextLink. If the Top value is not specified, the full list of resources will be returned at once.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Inputs
Outputs
Azure PowerShell
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for