Remove-AzDataCollectionRule

Delete a data collection rule.

Syntax

Remove-AzDataCollectionRule
        -ResourceGroupName <string>
         -RuleName <string>
         [-PassThru]
        [-DefaultProfile <IAzureContextContainer>]
        [-WhatIf]
        [-Confirm]  
      [<CommonParameters>]
Remove-AzDataCollectionRule
        -InputObject <PSDataCollectionRuleResource>
        [-PassThru]
        [-DefaultProfile <IAzureContextContainer>]
        [-WhatIf]
        [-Confirm]  
      [<CommonParameters>]
Remove-AzDataCollectionRule
        -RuleId <string>
        [-PassThru]
        [-DefaultProfile <IAzureContextContainer>]
        [-WhatIf]
        [-Confirm]  
      [<CommonParameters>]

Description

The Remove-AzDataCollectionRule cmdlet delete a data collection rule.

Data Collection Rules (DCR) define data coming into Azure Monitor and specify where that data should be sent or stored. Here is the complete DCR overview article.

Examples

Example 1: Delete data collection rule with name and resource group parameters

PS C:\>Remove-AzDataCollectionRule -ResourceGroupName "testgroup" -RuleName "testDcr"

Example 2: Delete data collection rule with name and resource group return bool

PS C:\>Remove-AzDataCollectionRule -ResourceGroupName "testgroup" -RuleName "testDcr" -PassThru

True

Example 3: Delete data collection rule from InputObject

PS C:\>Get-AzDataCollectionRule -ResourceGroupName "testdcr" -RuleName "dcrFromPipe95" | Remove-AzDataCollectionRule

Example 4: Delete data collection rule from resource id

PS C:\>Remove-AzDataCollectionRule -RuleId "/subscriptions/{subId}/resourceGroups/testdcr/providers/Microsoft.Insights/dataCollectionRules/{dcrName}"

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

The credentials, account, tenant, and subscription used for communication with azure

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

The resource group name

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

The resource identifier.

Type:String
Aliases:ResourceId
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-RuleName

The resource name.

Type:String
Aliases:Name
Position:Named
Default value:None
Accept pipeline input:True
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:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Outputs

Microsoft.Azure.Commands.Insights.OutputClasses.PSDataCollectionRuleResource