[SQL] Fix az sql server update failing with "Invalid value given for parameter RetentionDays"#33318
[SQL] Fix az sql server update failing with "Invalid value given for parameter RetentionDays"#33318Copilot wants to merge 2 commits into
az sql server update failing with "Invalid value given for parameter RetentionDays"#33318Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
When servers have retention_days=-1 (legacy 'not configured' value), az sql server update fails because the API now validates this field even when absent from the PUT body. Fix by explicitly setting it to 0 (disabled) when the existing value is negative and no --soft-delete-retention-days argument is specified. Add unit tests for the fix. Agent-Logs-Url: https://github.com/Azure/azure-cli/sessions/15743958-26bc-49c2-92fa-8889d09d2b71 Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
az sql server update failing with "Invalid value given for parameter RetentionDays"
|
SQL |
a0x1ab
left a comment
There was a problem hiding this comment.
🔄 Iteration 1/3 — Test Failures
Failed Tests
Failure Details
Setup failed:
Cloning into '/tmp/azure-cli-test-squad-32741-1'...
Updating files: 67% (6247/9311)
Updating files: 68% (6332/9311)
Updating files: 69% (6425/9311)
Updating files: 70% (6518/9311)
Updating files: 71% (6611/9311)
Updating files: 72% (6704/9311)
Updating files: 73% (6798/9311)
Updating files: 74% (6891/9311)
Updating files: 75% (6984/9311)
Updating files: 76% (7077/9311)
Updating files: 77% (7170/9311)
Updating files: 78% (7263/9311)
Updating files: 79% (7356/9311)
Updating files: 80% (7449/9311)
Updating files: 81% (7542/9311)
Updating files: 82% (7636/9311)
Updating files: 83% (7729/9311)
Updating files: 84% (7822/9311)
Updating files: 85% (7915/9311)
Updating files: 86% (8008/9311)
Updating files: 87% (8101/9311)
Updating files: 88% (8194/9311)
Updating files: 89% (8287/9311)
Updating files: 90% (8380/9311)
Updating files: 91% (8474/9311)
Updating files: 92% (8567/9311)
Updating files: 93% (8660/9311)
Updating files: 94% (8753/9311)
Updating files: 95% (8846/9311)
Updating files: 96% (8939/9311)
Updating files: 97% (9032/9311)
Updating files: 98% (9125/9311)
Updating files: 98% (9217/9311)
Updating files: 99% (9218/9311)
Updating files: 100% (9311/9311)
Updating files: 100% (9311/9311), done.
From https://github.com/Azure/azure-cli
* [new branch] copilot/fix-invalid-retentiondays-error -> origin/copilot/fix-invalid-retentiondays-error
fatal: cannot set up tracking information; starting point 'origin/copilot/fix-invalid-retentiondays-error' is not a branch
failed to run git: exit status 128
Requested Fix
Please address the test failures above. The affected module is sql. Run azdev test sql to validate locally before pushing.
🤖 This comment was generated with AI assistance.
The CI failure is a git infrastructure issue in the test runner ( |
a0x1ab
left a comment
There was a problem hiding this comment.
🔄 Iteration 2/3 — Test Failures
Failed Tests
Failure Details
Setup failed:
Cloning into '/tmp/azure-cli-test-squad-32741-2'...
Updating files: 79% (7366/9311)
Updating files: 80% (7449/9311)
Updating files: 81% (7542/9311)
Updating files: 82% (7636/9311)
Updating files: 83% (7729/9311)
Updating files: 84% (7822/9311)
Updating files: 85% (7915/9311)
Updating files: 86% (8008/9311)
Updating files: 87% (8101/9311)
Updating files: 88% (8194/9311)
Updating files: 89% (8287/9311)
Updating files: 90% (8380/9311)
Updating files: 91% (8474/9311)
Updating files: 92% (8567/9311)
Updating files: 93% (8660/9311)
Updating files: 94% (8753/9311)
Updating files: 95% (8846/9311)
Updating files: 96% (8939/9311)
Updating files: 97% (9032/9311)
Updating files: 98% (9125/9311)
Updating files: 99% (9218/9311)
Updating files: 100% (9311/9311)
Updating files: 100% (9311/9311), done.
From https://github.com/Azure/azure-cli
* [new branch] copilot/fix-invalid-retentiondays-error -> origin/copilot/fix-invalid-retentiondays-error
fatal: cannot set up tracking information; starting point 'origin/copilot/fix-invalid-retentiondays-error' is not a branch
failed to run git: exit status 128
Requested Fix
Please address the test failures above. The affected module is sql. Run azdev test sql to validate locally before pushing.
🤖 This comment was generated with AI assistance.
This is the same git infrastructure failure as iteration 1 — the test runner cannot set up git tracking for the branch after cloning. No tests actually ran or failed (the "Failed Tests" section is empty). All 4 unit tests continue to pass locally. There is no code issue to address here. |
Live test results —
|
azclibot
left a comment
There was a problem hiding this comment.
🔴 Review: Failures Detected
@copilot — the live tests and CI checks have reported failures. Please investigate and fix the issues below.
Live Test Result: ❌ Failure
- Workflow run: View live test run
CI Check Failures (2 failed out of 91)
| Check | Result | Details |
|---|---|---|
Azure.azure-cli |
❌ Failed | Build #20260505.21 failed |
Azure.azure-cli (Build Rpm Packages Red Hat Universal Base Image 9 ARM64) |
❌ Failed | Build Rpm Packages Red Hat Universal Base Image 9 ARM64 failed |
Next Steps
- Review the live test failure at the link above for test-level errors.
- Fix the RPM package build failure for Red Hat UBI 9 ARM64.
- Ensure all CI checks pass before this PR can be merged.
Posted by agent-assist (autonomous bug-fix pipeline).
Related command
az sql server updateDescription
az sql server updatestarted failing withInvalid value given for parameter RetentionDays(value:-1) for servers created before the soft-delete feature existed, even when--soft-delete-retention-dayswas never specified. The Azure SQL API recently tightened validation to reject-1(the legacy "not configured" sentinel) even when the field is omitted from the PUT body — the API validates the stored value.sql/custom.py—server_update(): When--soft-delete-retention-daysis not specified and the server's existingretention_daysis negative (i.e., the legacy-1"not configured" value), explicitly set it to0(disabled) before the PUT. Valid existing values (0–7) andNonecontinue to be omitted as before.tests/latest/test_sql_commands.py: AddedSqlServerUpdateRetentionDaysUnitTestwith four unit tests covering: negative→0 conversion, valid value cleared when unspecified, explicit arg overrides existing, and explicit0disables soft delete.Testing Guide
History Notes
[SQL]
az sql server update: Fix "Invalid value given for parameter RetentionDays" error when updating servers with legacyretentionDays=-1This 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.