Skip to content

Remove-AzDenyAssignment: throws "Cannot find an overload for List`1" after confirming delete (DA does delete) #29462

@jruttle

Description

@jruttle

Description

Remove-AzDenyAssignment throws a runtime error after the user confirms the delete prompt:

Cannot find an overload for "List`1" and the argument count: "<N>".

The argument count varies by call site (observed: 7, 8, 9). The deny assignment is removed server-side (verified via REST GET → 404), so the error appears to be in the cmdlet's response-handling code, not in the underlying API call.

Repro

Tested against the Debug build from PR #29340 (Az.Resources 9.0.3) in PowerShell 7 on Windows.

Import-Module C:\src\azure-powershell\artifacts\Debug\Az.Resources\Az.Resources.psd1 -Force
Connect-AzAccount -Tenant <tenant> -Subscription <sub>

# Case 1 - argument count "7"
$da = New-AzDenyAssignment -Scope "/subscriptions/<sub>" -DenyAssignmentName "case1" -Description "x" `
        -Action @("Microsoft.Storage/storageAccounts/delete") `
        -Principal @{ Id = "<oid>"; Type = "User" }
Remove-AzDenyAssignment -Id $da.Id   # answer Y at prompt
# -> Cannot find an overload for "List`1" and the argument count: "7".

# Case 2 - argument count "8"  (using -DenyAssignmentName + -Scope)
Remove-AzDenyAssignment -DenyAssignmentName $da.DenyAssignmentName -Scope $da.Scope
# -> Cannot find an overload for "List`1" and the argument count: "8".

# Case 3 - argument count "9"  (pipeline delete)
Get-AzDenyAssignment -Scope "/subscriptions/<sub>/resourceGroups/<rg>" | Remove-AzDenyAssignment
# -> Cannot find an overload for "List`1" and the argument count: "9".

In every case, a follow-up Get-AzDenyAssignment -Id $da.Id returns 404 — the DA is deleted, but the cmdlet returns a terminating error to the user.

Expected

Cmdlet returns silently (or returns a removed-resource object) on successful delete.

Actual

Cmdlet throws Cannot find an overload for "List\1"` after the server has already accepted the DELETE.

Impact

  • Customers using Remove-AzDenyAssignment see an apparent failure even though the operation succeeded
  • Pipeline scenarios (Get | Remove) are broken — first failure terminates pipeline
  • Blocks PowerShell GA

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions