你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Remove-AzPolicySetDefinition
This operation deletes the policy definition in the given subscription with the given name.
Syntax
Remove-AzPolicySetDefinition
-Name <String>
[-Force]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Remove-AzPolicySetDefinition
-Name <String>
-ManagementGroupName <String>
[-Force]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Remove-AzPolicySetDefinition
-Name <String>
-SubscriptionId <String>
[-Force]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Remove-AzPolicySetDefinition
-Id <String>
[-Force]
[-BackwardCompatible]
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Remove-AzPolicySetDefinition
-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 policy set definition by resource ID
$PolicySetDefinition = Get-AzPolicySetDefinition -ResourceId '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition'
Remove-AzPolicySetDefinition -Id $PolicySetDefinition.ResourceId -Force
The first command gets a policy set definition by using the Get-AzPolicySetDefinition cmdlet. The command stores it in the $PolicySetDefinition variable. The second command removes the policy set definition identified by the ResourceId property of $PolicySetDefinition.
Example 2: [Backcompat] Remove policy set definition by resource ID
$PolicySetDefinition = Get-AzPolicySetDefinition -ResourceId '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition'
Remove-AzPolicySetDefinition -Id $PolicySetDefinition.ResourceId -Force -BackwardCompatible
True
The first command gets a policy set definition by using the Get-AzPolicySetDefinition cmdlet. The command stores it in the $PolicySetDefinition variable. The second command removes the policy set definition identified by the ResourceId property of $PolicySetDefinition.
Parameters
-BackwardCompatible
Causes cmdlet to return artifacts using legacy format placing policy-specific properties in a property bag object.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
Type: | PSObject |
Aliases: | AzureRMContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Force
When $true, skip confirmation prompts
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Id
The full Id of the policy definition to get.
Type: | String |
Aliases: | ResourceId |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-InputObject
Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
Type: | IPolicyIdentity |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ManagementGroupName
The name of the management group.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
The name of the policy definition to get.
Type: | String |
Aliases: | PolicySetDefinitionName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PassThru
Returns true when the command succeeds
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SubscriptionId
The ID of the target subscription.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
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: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |