New-AzCosmosDBSqlTrigger

Creates a new CosmosDB Sql Trigger.

Syntax

New-AzCosmosDBSqlTrigger
   -ResourceGroupName <String>
   -AccountName <String>
   -DatabaseName <String>
   -ContainerName <String>
   -Name <String>
   -Body <String>
   [-TriggerOperation <String>]
   [-TriggerType <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzCosmosDBSqlTrigger
   -Name <String>
   -Body <String>
   [-TriggerOperation <String>]
   [-TriggerType <String>]
   -ParentObject <PSSqlContainerGetResults>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Creates a new CosmosDB Sql Trigger.

Examples

Example 1

PS C:\> New-AzCosmosDBSqlTrigger -AccountName MyAccountName -ResourceGroupName MyRgName -DatabaseName MyDatabaseName -ContainerName MyContainerName -Name myTriggerName -Body myTriggerBody -TriggerOperation All -TriggerType Pre

Name     : myTriggerName
Id       : /subscriptions/mySubId/resourceGroups/MyRgName/providers/Microsoft.DocumentDB/databaseAccounts/MyAccountName/sqlDatabases/MyDatabaseName/contain
           ers/MyContainerName/triggers/myTriggerName
Location :
Tags     :
Resource : Microsoft.Azure.Commands.CosmosDB.Models.PSSqlTriggerGetPropertiesResource

Parameters

-AccountName

Name of the Cosmos DB database account.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Body

The body of the Trigger.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ContainerName

Container name.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DatabaseName

Database name.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

Trigger name.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ParentObject

Sql Container object.

Type:PSSqlContainerGetResults
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ResourceGroupName

Name of resource group.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TriggerOperation

The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace'

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TriggerType

Type of the Trigger. Possible values include: 'Pre', 'Post'

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.Azure.Commands.CosmosDB.Models.PSSqlContainerGetResults

Outputs

Microsoft.Azure.Commands.CosmosDB.Models.PSSqlTriggerGetResults

Microsoft.Azure.Commands.CosmosDB.Exceptions.ConflictingResourceException