[SQL] Fix az sql server update --assign_identity failing with unrelated RetentionDays error#33317
Draft
[SQL] Fix az sql server update --assign_identity failing with unrelated RetentionDays error#33317
az sql server update --assign_identity failing with unrelated RetentionDays error#33317Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Collaborator
|
sql |
…serving existing retention_days Agent-Logs-Url: https://github.com/Azure/azure-cli/sessions/10c5a645-1796-4cf0-9712-045bfe649233 Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix az sql server update identity assignment error
[SQL] Fix May 5, 2026
az sql server update --assign_identity failing with unrelated RetentionDays error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
az sql server update --assign_identity(and any server update not specifying--soft-delete-retention-days) failed withERROR: (InvalidParameterValue) Invalid value given for parameter RetentionDays— an error completely unrelated to identity assignment.Root cause:
server_updateexplicitly setinstance.retention_days = Nonein theelsebranch whensoft_delete_retention_dayswas not provided. The SDK serializer dropsNonevalues from the PUT body, so the Azure SQL API received a request with noretentionDaysfield and rejected it.Fix: Remove the
else: instance.retention_days = Nonebranch. When--soft-delete-retention-daysis not specified, the existing value from the GET response is preserved in the PUT body.Testing Guide
New
SqlServerUpdateRetentionDaysUnitTestunit test class (no live credentials required) covers:retention_daysis preserved when--soft-delete-retention-daysis not specified (values:0,7,None)retention_daysis correctly updated when--soft-delete-retention-daysis specified--assign_identitywithout--soft-delete-retention-daysdoes not affectretention_days(direct regression test)History Notes
[SQL]
az sql server update: Fix--assign_identityfailing with unrelatedInvalidParameterValueerror forRetentionDaysThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
azcliprod.blob.core.windows.net/usr/bin/python3 python3 -m unittest azure.cli.command_modules.sql.tests.latest.test_sql_commands.SqlServerUpdateRetentionDaysUnitTest -v(dns block)If you need me to access, download, or install something from one of these locations, you can either: