Edytuj

Remove-AzDenyAssignment

Removes a user-assigned deny assignment at the specified scope.

Syntax

DenyAssignmentIdParameterSet (Default)

Remove-AzDenyAssignment
    -Id <String>
    [-Scope <String>]
    [-PassThru]
    [-Force]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

DenyAssignmentNameAndScopeParameterSet

Remove-AzDenyAssignment
    -DenyAssignmentName <String>
    -Scope <String>
    [-PassThru]
    [-Force]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

InputObjectParameterSet

Remove-AzDenyAssignment
    [-InputObject] <PSDenyAssignment>
    [-PassThru]
    [-Force]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Use the Remove-AzDenyAssignment command to remove a user-assigned deny assignment. The deny assignment can be identified by its ID, by display name and scope, or by piping a PSDenyAssignment object from Get-AzDenyAssignment.

Examples

Example 1: Remove a deny assignment by ID

Remove-AzDenyAssignment -Id "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/denyAssignments/11111111-1111-1111-1111-111111111111" -Force

Removes the deny assignment with the specified fully qualified ID.

Example 2: Remove a deny assignment by name and scope

Remove-AzDenyAssignment -DenyAssignmentName "Block deletes" `
    -Scope "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG" -Force

Removes the deny assignment named "Block deletes" at the specified resource group scope.

Example 3: Remove a deny assignment using pipeline

Get-AzDenyAssignment -DenyAssignmentName "Block writes" -Scope "/subscriptions/00000000-0000-0000-0000-000000000000" | Remove-AzDenyAssignment -Force -PassThru

Gets and removes the specified deny assignment using the pipeline.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
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 credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, 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

-DenyAssignmentName

The display name of the deny assignment to remove.

Parameter properties

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

Parameter sets

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

-Force

Do not ask for confirmation.

Parameter properties

Type:SwitchParameter
Default value:False
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

Fully qualified deny assignment ID including scope, or just the GUID. When provided as a GUID, the current subscription scope is used.

Parameter properties

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

Parameter sets

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

-InputObject

Deny assignment object from Get-AzDenyAssignment.

Parameter properties

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

Parameter sets

InputObjectParameterSet
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

If specified, returns the deleted deny assignment.

Parameter properties

Type:SwitchParameter
Default value:False
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

-Scope

Scope of the deny assignment. In the format of relative URI.

Parameter properties

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

Parameter sets

DenyAssignmentIdParameterSet
Position:Named
Mandatory:False
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:False
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

String

PSDenyAssignment

Outputs

PSDenyAssignment

When the -PassThru parameter is specified, returns the deleted deny assignment object. Otherwise, this cmdlet does not generate any output.