Edit

Remove-AzPolicyAttestation

Deletes a policy attestation.

Syntax

DeleteBySubscriptionId (Default)

Remove-AzPolicyAttestation
    -Name <String>
    [-SubscriptionId <String>]
    [-DefaultProfile <PSObject>]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

DeleteByResourceGroup

Remove-AzPolicyAttestation
    -Name <String>
    -ResourceGroupName <String>
    [-SubscriptionId <String>]
    [-DefaultProfile <PSObject>]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

DeleteByResourceId

Remove-AzPolicyAttestation
    -ResourceId <String>
    [-Name <String>]
    [-DefaultProfile <PSObject>]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

DeleteByScope

Remove-AzPolicyAttestation
    -Name <String>
    -Scope <String>
    [-DefaultProfile <PSObject>]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

DeleteViaInputObject

Remove-AzPolicyAttestation
    -InputObject <IPolicyInsightsIdentity>
    [-DefaultProfile <PSObject>]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Remove-AzPolicyAttestation cmdlet deletes a policy attestation, with no return value by default.

Examples

Example 1: Delete a policy remediation by name at subscription scope.

Remove-AzPolicyAttestation -Name "attestation-subscription" -PassThru
True

This command deletes the attestation named 'attestation-subscription' in the current context's subscription. The -PassThru switch forces the cmdlet to return the status of the operation.

Example 2: Delete a policy remediation via piping at resource group.

$rgName = "ps-attestation-test-rg"
Get-AzPolicyAttestation -Name "attestation-RG" -ResourceGroupName $rgName | Remove-AzPolicyAttestation

This command deletes the attestation named 'attestation-RG' at resource group 'ps-attestation-test-rg' using input object given by the Get-AzPolicyAttestation cmdlet.

Example 3: Delete a policy remediation using ResourceId.

$scope = "/subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/resourceGroups/ps-attestation-test-rg/providers/Microsoft.Network/networkSecurityGroups/pstests0"
$attestationToDelete = Get-AzPolicyAttestation -Name "attestation-resource" -Scope $scope
Remove-AzPolicyAttestation -Id $attestationToDelete.Id

The first command gets an attestation named 'attestation-resource' with a resource id supplied as scope. The second command then deletes the attestation using the resource id of the stored attestation.

Parameters

-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

-InputObject

Identity Parameter

Parameter properties

Type:Microsoft.Azure.PowerShell.Cmdlets.PolicyInsights.Models.IPolicyInsightsIdentity
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DeleteViaInputObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

The name of the attestation.

Parameter properties

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

Parameter sets

DeleteBySubscriptionId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
DeleteByResourceGroup
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
DeleteByScope
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
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

-ResourceGroupName

The name of the resource group. The name is case insensitive.

Parameter properties

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

Parameter sets

DeleteByResourceGroup
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceId

ID of the resource that the attestation was made against or full Resource ID of the attestation.

Parameter properties

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

Parameter sets

DeleteByResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Scope

Scope of the resource. E.g. '/subscriptions/{subscriptionId}/resourceGroups/{rgName}'.

Parameter properties

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

Parameter sets

DeleteByScope
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SubscriptionId

The ID of the target subscription. Uses current subscription if one isn't provided.

Parameter properties

Type:String
Default value:(Get-AzContext).Subscription.Id
Supports wildcards:False
DontShow:False

Parameter sets

DeleteBySubscriptionId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
DeleteByResourceGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
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.

Inputs

Microsoft.Azure.PowerShell.Cmdlets.PolicyInsights.Models.IPolicyInsightsIdentity

Outputs

Boolean