Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

New-AzEventGridSubscription

Asynchronously create a new event subscription or create an existing event subscription based on the specified scope.

Syntax

CreateExpanded (Default)

New-AzEventGridSubscription
 -Name <String>
 -Scope <String>
 [-DeadLetterWithResourceIdentityType <String>]
 [-DeadLetterWithResourceIdentityUserAssignedIdentity <String>]
 [-DeliveryWithResourceIdentityDestination <IEventSubscriptionDestination>]
 [-DeliveryWithResourceIdentityType <String>]
 [-DeliveryWithResourceIdentityUserAssignedIdentity <String>]
 [-Destination <IEventSubscriptionDestination>]
 [-EventDeliverySchema <String>]
 [-ExpirationTimeUtc <DateTime>]
 [-FilterAdvancedFilter <IAdvancedFilter[]>]
 [-FilterEnableAdvancedFilteringOnArray]
 [-FilterIncludedEventType <String[]>]
 [-FilterIsSubjectCaseSensitive]
 [-FilterSubjectBeginsWith <String>]
 [-FilterSubjectEndsWith <String>]
 [-Label <String[]>]
 [-RetryPolicyEventTimeToLiveInMinute <Int32>]
 [-RetryPolicyMaxDeliveryAttempt <Int32>]
 [-DefaultProfile <PSObject>]
 [-AsJob]
 [-NoWait]
 [-PassThru]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

CreateViaJsonString

New-AzEventGridSubscription
 -Name <String>
 -Scope <String>
 -JsonString <String>
 [-DefaultProfile <PSObject>]
 [-AsJob]
 [-NoWait]
 [-PassThru]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

CreateViaJsonFilePath

New-AzEventGridSubscription
 -Name <String>
 -Scope <String>
 -JsonFilePath <String>
 [-DefaultProfile <PSObject>]
 [-AsJob]
 [-NoWait]
 [-PassThru]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

CreateViaIdentityExpanded

New-AzEventGridSubscription
 -InputObject <IEventGridIdentity>
 [-DeadLetterWithResourceIdentityType <String>]
 [-DeadLetterWithResourceIdentityUserAssignedIdentity <String>]
 [-DeliveryWithResourceIdentityDestination <IEventSubscriptionDestination>]
 [-DeliveryWithResourceIdentityType <String>]
 [-DeliveryWithResourceIdentityUserAssignedIdentity <String>]
 [-Destination <IEventSubscriptionDestination>]
 [-EventDeliverySchema <String>]
 [-ExpirationTimeUtc <DateTime>]
 [-FilterAdvancedFilter <IAdvancedFilter[]>]
 [-FilterEnableAdvancedFilteringOnArray]
 [-FilterIncludedEventType <String[]>]
 [-FilterIsSubjectCaseSensitive]
 [-FilterSubjectBeginsWith <String>]
 [-FilterSubjectEndsWith <String>]
 [-Label <String[]>]
 [-RetryPolicyEventTimeToLiveInMinute <Int32>]
 [-RetryPolicyMaxDeliveryAttempt <Int32>]
 [-DefaultProfile <PSObject>]
 [-AsJob]
 [-NoWait]
 [-PassThru]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

Description

Asynchronously create a new event subscription or create an existing event subscription based on the specified scope.

Examples

Example 1: Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.

$obj = New-AzEventGridWebHookEventSubscriptionDestinationObject -EndpointUrl "https://azpsweb.azurewebsites.net/api/updates"
New-AzEventGridSubscription -Name azps-eventsub -Scope "subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" -Destination $obj -FilterIsSubjectCaseSensitive:$false
Name ResourceGroupName
---- -----------------
azps-eventsub

Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.

Example 2: Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.

$obj = New-AzEventGridWebHookEventSubscriptionDestinationObject -EndpointUrl "https://azpsweb.azurewebsites.net/api/updates"
$topic = Get-AzEventGridTopic -ResourceGroupName azps_test_group_eventgrid -Name azps-topic
New-AzEventGridSubscription -Name azps-eventsub -Scope $topic.Id -Destination $obj -FilterIsSubjectCaseSensitive:$false -FilterSubjectBeginsWith "ExamplePrefix" -FilterSubjectEndsWith "ExampleSuffix"
Name ResourceGroupName
---- -----------------
azps-eventsub azps_test_group_eventgrid

Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.

Parameters

-AsJob

Run the command as a job

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

-DeadLetterWithResourceIdentityType

The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identity.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DeadLetterWithResourceIdentityUserAssignedIdentity

The user identity associated with the resource.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DefaultProfile

The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRMContext, AzureCredential

Parameter sets

-DeliveryWithResourceIdentityDestination

Information about the destination where events have to be delivered for the event subscription.Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering.

Parameter properties

Type:IEventSubscriptionDestination
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DeliveryWithResourceIdentityType

The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identity.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DeliveryWithResourceIdentityUserAssignedIdentity

The user identity associated with the resource.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Destination

Information about the destination where events have to be delivered for the event subscription.Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering.

Parameter properties

Type:IEventSubscriptionDestination
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-EventDeliverySchema

The event delivery schema for the event subscription.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:DeliverySchema

Parameter sets

-ExpirationTimeUtc

Expiration time of the event subscription.

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ExpirationDate

Parameter sets

-FilterAdvancedFilter

An array of advanced filters that are used for filtering event subscriptions.

Parameter properties

Type:

IAdvancedFilter[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:AdvancedFilter

Parameter sets

-FilterEnableAdvancedFilteringOnArray

Allows advanced filters to be evaluated against an array of values instead of expecting a singular value.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AdvancedFilteringOnArray

Parameter sets

-FilterIncludedEventType

A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default event types, set the IncludedEventTypes to null.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:IncludedEventType

Parameter sets

-FilterIsSubjectCaseSensitive

Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter should be compared in a case sensitive manner.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:SubjectCaseSensitive

Parameter sets

-FilterSubjectBeginsWith

An optional string to filter events for an event subscription based on a resource path prefix.The format of this depends on the publisher of the events.Wildcard characters are not supported in this path.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:SubjectBeginsWith

Parameter sets

-FilterSubjectEndsWith

An optional string to filter events for an event subscription based on a resource path suffix.Wildcard characters are not supported in this path.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:SubjectEndsWith

Parameter sets

-InputObject

Identity Parameter

Parameter properties

Type:IEventGridIdentity
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-JsonFilePath

Path of Json file supplied to the Create operation

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-JsonString

Json string supplied to the Create operation

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Label

List of user defined labels.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Name

Name of the event subscription. Event subscription names must be between 3 and 64 characters in length and should use alphanumeric letters only.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:EventSubscriptionName

Parameter sets

-NoWait

Run the command asynchronously

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-PassThru

Returns true when the command succeeds

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-RetryPolicyEventTimeToLiveInMinute

Time To Live (in minutes) for events.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:EventTtl

Parameter sets

-RetryPolicyMaxDeliveryAttempt

Maximum number of delivery retry attempts for events.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:MaxDeliveryAttempt

Parameter sets

-Scope

The identifier of the resource to which the event subscription needs to be created or updated. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

IEventGridIdentity

Outputs

IEventSubscription


Feedback

Was this page helpful?