Description
Remove-AzRoleDefinition displays incorrect confirmation message and target when using -WhatIf or -Confirm:
- The action description shows an unformatted placeholder
'{0}' instead of the actual value
- When using
-Name parameter, the target shows empty GUID 00000000-0000-0000-0000-000000000000 instead of the role name
Expected behavior:
-Id should show: Performing the operation "Removing role definition by id" on target "<guid>"
-Name should show: Performing the operation "Removing role definition by name" on target "<name>"
Actual behavior:
- Both show:
Performing the operation "Are you sure you want to remove role definition with id '{0}'." on target "<guid-or-empty-guid>"
Bug Summary Table
| Command |
Buggy Output |
Remove-AzRoleDefinition -Id $(New-Guid) -Confirm |
Performing the operation "Are you sure you want to remove role definition with id '{0}'." on target "4090e780-c302-45f9-ad9b-6b53f4832e7e" |
Remove-AzRoleDefinition -Name abc -Confirm |
Performing the operation "Are you sure you want to remove role definition with id '{0}'." on target "00000000-0000-0000-0000-000000000000" |
Remove-AzRoleDefinition -Id $(New-Guid) -WhatIf |
Performing the operation "Are you sure you want to remove role definition with id '{0}'." on target "5c889b20-ba53-4bd5-bae7-f36ff3259502" |
Remove-AzRoleDefinition -Name abc -WhatIf |
Performing the operation "Are you sure you want to remove role definition with id '{0}'." on target "00000000-0000-0000-0000-000000000000" |
Issue script & Debug output
PS> $DebugPreference='Continue'
# Bug with -Name parameter (shows empty GUID)
PS> Remove-AzRoleDefinition -Name abc -WhatIf
What if: Performing the operation "Are you sure you want to remove role definition with id '{0}'." on target "00000000-0000-0000-0000-000000000000".
# Bug with -Id parameter (shows unformatted placeholder)
PS> Remove-AzRoleDefinition -Id $(New-Guid) -WhatIf
What if: Performing the operation "Are you sure you want to remove role definition with id '{0}'." on target "3248f3b0-b7c7-4114-b0f9-c04873e3d5df".
Environment data
PS> $PSVersionTable
Name Value
---- -----
PSVersion 7.5.3
PSEdition Core
GitCommitId 7.5.3
OS Darwin 24.6.0 Darwin Kernel Version 24.6.0
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Module versions
PS> Get-Module Az*
Name Version
---- -------
Az.Accounts 5.3.2
Az.Resources 9.0.0
Error output
N/A - This is a display issue, not an error.
Description
Remove-AzRoleDefinitiondisplays incorrect confirmation message and target when using-WhatIfor-Confirm:'{0}'instead of the actual value-Nameparameter, the target shows empty GUID00000000-0000-0000-0000-000000000000instead of the role nameExpected behavior:
-Idshould show:Performing the operation "Removing role definition by id" on target "<guid>"-Nameshould show:Performing the operation "Removing role definition by name" on target "<name>"Actual behavior:
Performing the operation "Are you sure you want to remove role definition with id '{0}'." on target "<guid-or-empty-guid>"Bug Summary Table
Remove-AzRoleDefinition -Id $(New-Guid) -ConfirmPerforming the operation "Are you sure you want to remove role definition with id '{0}'." on target "4090e780-c302-45f9-ad9b-6b53f4832e7e"Remove-AzRoleDefinition -Name abc -ConfirmPerforming the operation "Are you sure you want to remove role definition with id '{0}'." on target "00000000-0000-0000-0000-000000000000"Remove-AzRoleDefinition -Id $(New-Guid) -WhatIfPerforming the operation "Are you sure you want to remove role definition with id '{0}'." on target "5c889b20-ba53-4bd5-bae7-f36ff3259502"Remove-AzRoleDefinition -Name abc -WhatIfPerforming the operation "Are you sure you want to remove role definition with id '{0}'." on target "00000000-0000-0000-0000-000000000000"Issue script & Debug output
Environment data
Module versions
Error output