Remove-AzPolicyDefinition
This operation deletes the policy definition in the given subscription with the given name.
Syntax
Name (Default)
Remove-AzPolicyDefinition
-Name <String>
[-Force]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ManagementGroupName
Remove-AzPolicyDefinition
-Name <String>
-ManagementGroupName <String>
[-Force]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SubscriptionId
Remove-AzPolicyDefinition
-Name <String>
-SubscriptionId <String>
[-Force]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Id
Remove-AzPolicyDefinition
-Id <String>
[-Force]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Remove-AzPolicyDefinition
-InputObject <IPolicyIdentity>
[-Force]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
This operation deletes the policy definition in the given subscription with the given name.
Examples
Example 1: Remove the policy definition by name
Remove-AzPolicyDefinition -Name 'VMPolicyDefinition'
This command removes the specified policy definition.
Example 2: Remove policy definition by resource ID
$PolicyDefinition = Get-AzPolicyDefinition -Name 'VMPolicyDefinition'
Remove-AzPolicyDefinition -Id $PolicyDefinition.Id -Force
This command removes the given policy definition without prompting the user.
Example 3: [Backcompat] Remove policy definition by resource ID
$PolicyDefinition = Get-AzPolicyDefinition -Name 'VMPolicyDefinition' -BackwardCompatible
Remove-AzPolicyDefinition -Id $PolicyDefinition.ResourceId -Force -BackwardCompatible
True
This command removes the given policy definition without prompting the user.
Parameters
-BackwardCompatible
Causes cmdlet to return artifacts using legacy format placing policy-specific properties in a property bag object.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Force
When $true, skip confirmation prompts
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Id
The full Id of the policy definition to get.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: ResourceId
Parameter sets
Id
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
Type: IPolicyIdentity
Default value: None
Supports wildcards: False
DontShow: False
InputObject
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: True
Value from remaining arguments: False
-ManagementGroupName
The name of the management group.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ManagementGroupName
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Name
The name of the policy definition to get.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: PolicyDefinitionName
Parameter sets
Name
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-PassThru
Returns true when the command succeeds
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SubscriptionId
The ID of the target subscription.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
SubscriptionId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
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 .
Outputs