Skip to content

{Backup} Fix random password parsing in SQL snapshot tests - #34392

Merged
Naga Nandyala (naga-nandyala) merged 3 commits into
Azure:devfrom
naga-nandyala:fix/backup-snapshot-password-arguments
Nov 10, 2026
Merged

Naga Nandyala (naga-nandyala) merged 3 commits into
Azure:devfrom
naga-nandyala:fix/backup-snapshot-password-arguments

Conversation

@naga-nandyala

@naga-nandyala Naga Nandyala (naga-nandyala) commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests Suppressions
️✔️ None ️✔️ 130/130 ⚠️ 50 added

This PR adds warning or check suppressions. Fix the underlying warning where possible and justify each remaining suppression in a code comment or the PR description.

50 added suppressions
File Line Kind Code
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_access_restriction_commands.py 27 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_access_restriction_commands.py 53 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_access_restriction_commands.py 85 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_access_restriction_commands.py 106 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_access_restriction_commands.py 128 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_access_restriction_commands.py 184 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_access_restriction_commands.py 211 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_access_restriction_commands.py 232 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 192 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 215 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 270 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 347 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 373 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 399 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 412 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 427 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 495 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 524 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 662 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 685 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 705 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 2067 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 2093 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 2154 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 2181 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 2202 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 2223 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 2272 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 2299 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py 2339 skipped test @unittest.skip('Recorded runtime reached end-of-life on 2026-11-10; update runtime and re-record.')

20 more not shown.

Related commands

az vm create and az sql vm create, invoked by the Azure Backup SQL instance snapshot test setup.

Why this PR

The SQL snapshot scenario intermittently fails during setup because a randomly generated password can begin with -. The test passes the password as a separate CLI token, so the argument parser can interpret it as another option even though the command string quotes it.

Build evidence

Pipeline run 20261110.17 (build 372908), job Test Rpm Package Azure Linux 4.0 (Beta) ARM64, failed in:

SqlInstanceSnapshotTests.test_backup_sql_instance_snapshot_primary_region

Failing task log (log 697) shows the initial error:

argument --admin-password: expected one argument

The full-test failure excerpt reported during the same investigation shows the equivalent SQL authentication error:

argument --sql-auth-update-pwd: expected one argument

Setup then enters cleanup, where sql_instance_test_setup.py:190 attempts backup container unregister and raises:

azure.core.exceptions.HttpResponseError: (CloudInternalError) Microsoft Azure Backup encountered an internal error.

That later cleanup exception masks the initial password-parsing failure. This PR addresses the initial setup failure; it does not suppress cleanup errors or claim to fix independent Backup service failures.

Fix

Exactly two changes in the existing sql_instance_test_setup.py helper:

---admin-password "{password}"
+--admin-password="{password}"
---sql-auth-update-pwd "{sql_password}"
+--sql-auth-update-pwd="{sql_password}"

Using --option=value binds a leading-hyphen value to its option. Random password generation, recording redaction, cleanup behavior, and production CLI code remain unchanged. No additional test files, skips, or dependencies are included.

Validation

  • Reproduced both parser errors with leading-hyphen values before applying the fix.
  • Before narrowing this PR, a temporary regression test exercised the actual helper command construction: all 10 cases passed on Python 3.12 and 3.14 after the fix, covering normal, leading-hyphen, and underscore-prefixed values for source and target VM setup. That added test file has been removed as requested.
  • Verified that the final helper differs from the base by exactly the two argument replacements above.
  • Python syntax validation and git diff --check passed.
  • No live Azure resources created; full pipeline validation remains for CI.

History Notes

Test setup only; no customer-facing behavior change.

Pass VM admin and SQL authentication passwords using option=value syntax so leading hyphens in token_urlsafe values cannot be interpreted as CLI options. Add regression coverage for both passwords and both VM setup paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The test-setup password-handling change has no active review issues.

No open issues 🎉

What changed in this PR

Fixes intermittent password-parsing failures in Backup SQL instance snapshot test setup without changing production commands.

Changes:

  • Attaches VM admin and SQL authentication passwords directly to their CLI options so leading hyphens are handled correctly.
  • Adds 10 mocked regression cases covering normal, leading-hyphen, and underscore-prefixed passwords for seed and target VMs.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​backup/​tests/​latest/​test_sql_instance_test_setup.py Adds regression coverage for password parsing and seed/target setup.
src/​azure-cli/​azure/​cli/​command_modules/​backup/​tests/​latest/​sql_instance_test_setup.py Uses --option="value" syntax for both password arguments.

Review effort: Balanced

Remove the added regression test at the request of the PR author; retain only the two option=value fixes in the existing SQL snapshot setup helper.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

Skip the 51 recorded scenarios failing after .NET 8 and PowerShell 7.4 reached their recorded end-of-life date on 2026-11-10. Use existing method-level unittest.skip decorators and document that runtimes and recordings need updating before re-enabling the tests. Leave production EOL validation and all other tests unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@naga-nandyala

Copy link
Copy Markdown
Contributor Author

Build 372988 (https://dev.azure.com/azclitools/public/_build/results?buildId=372988) validates this PR. Cherry-picked the EOL test-skip commit from #34391 as a948799 so fresh CI can validate the Backup password fix without the 51 unrelated App Service EOL failures. The three App Service files exactly match the EOL fix. The Backup helper remains a two-line argument fix with no added regression-test file. These EOL changes temporarily appear in the diff and should drop out once #34391 lands in dev. Other independent failures remain possible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@naga-nandyala
Naga Nandyala (naga-nandyala) merged commit 6fc05b6 into Azure:dev Nov 10, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants