Skip to content

Conversation

@atomassi
Copy link
Contributor

Fixes #29075

Description

Remove-AzRoleDefinition displays incorrect confirmation message and target when using -WhatIf or -Confirm. This PR fixes two issues:

  1. The action description was showing an unformatted placeholder '{0}' instead of a proper action description
  2. When using -Name parameter, the target was showing empty GUID 00000000-0000-0000-0000-000000000000 instead of the role name

Before/After Comparison

-WhatIf Parameter

Command Before After
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 "02f07549-8863-43d4-beb3-17c08a6318d6". What if: Performing the operation "Removing role definition by id" on target "7a59d7f5-7fa4-4912-ad3d-c06b1fed81b1".
Remove-AzRoleDefinition -Name TestRole -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". What if: Performing the operation "Removing role definition by name" on target "TestRole".

-Confirm Parameter

Command Before After
Remove-AzRoleDefinition -Id $(New-Guid) -Confirm Confirm: Are you sure you want to perform this action? Performing the operation "Are you sure you want to remove role definition with id '{0}'." on target "02f07549-8863-43d4-beb3-17c08a6318d6". Confirm: Are you sure you want to perform this action? Performing the operation "Removing role definition by id" on target "7a59d7f5-7fa4-4912-ad3d-c06b1fed81b1".
Remove-AzRoleDefinition -Name TestRole -Confirm Confirm: Are you sure you want to perform this action? Performing the operation "Are you sure you want to remove role definition with id '{0}'." on target "00000000-0000-0000-0000-000000000000". Confirm: Are you sure you want to perform this action? Performing the operation "Removing role definition by name" on target "TestRole".

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings January 19, 2026 11:44
@azure-client-tools-bot-prd
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

- Fixed action description showing unformatted placeholder '{0}'
- Fixed target showing empty GUID when using -Name parameter
- Added distinct action descriptions for -Id and -Name scenarios
@atomassi atomassi force-pushed the dev/atomassilli/fix-confirm-msg branch from 5c66503 to 8223cdd Compare January 19, 2026 11:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the Remove-AzRoleDefinition cmdlet where the confirmation prompt displayed incorrect messages when using -WhatIf or -Confirm parameters.

Changes:

  • Fixed the confirmation prompt to display proper action descriptions ("Removing role definition by id/name") instead of an unformatted placeholder string containing '{0}'
  • Fixed the target identifier to show the actual role name when using the -Name parameter instead of showing an empty GUID (00000000-0000-0000-0000-000000000000)
  • Removed the breaking change attribute from the cmdlet class since the breaking change announcement is now properly documented in the ChangeLog

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
RemoveAzureRoleDefinitionCommand.cs Added logic to set proper action descriptions and targets for confirmation prompts based on whether Id or Name parameter is used; removed unused using statement and breaking change attribute
Resources.resx Added two new resource strings for action descriptions: "RemovingRoleDefinitionById" and "RemovingRoleDefinitionByName"
Resources.Designer.cs Auto-generated code to expose the new resource strings as strongly-typed properties
ChangeLog.md Added entry documenting the fix with reference to issue #29075
Files not reviewed (1)
  • src/Resources/Resources/Properties/Resources.Designer.cs: Language not supported

@isra-fel
Copy link
Member

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Contributor

@vidai-msft vidai-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vidai-msft vidai-msft enabled auto-merge (squash) January 19, 2026 12:51
@vidai-msft vidai-msft merged commit 4e14c08 into Azure:main Jan 19, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Resource Authorization AzRole* in Az.Resources

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove-AzRoleDefinition displays incorrect confirmation message with unformatted placeholder and empty GUID

3 participants