Skip to content

[MySQL] Fix az mysql flexible-server list-skus returning empty list for all regions#33747

Draft
a0x1ab with Copilot wants to merge 8 commits into
devfrom
copilot/fix-mysql-list-skus-issue
Draft

[MySQL] Fix az mysql flexible-server list-skus returning empty list for all regions#33747
a0x1ab with Copilot wants to merge 8 commits into
devfrom
copilot/fix-mysql-list-skus-issue

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

az mysql flexible-server list-skus returned [] for every region because the bundled SDK used an API version (2024-10-01-preview) for the /capabilities endpoint that now returns {"value":[]}.

Related command
az mysql flexible-server list-skus

Description

  • Root cause: Old SDK hit /capabilities?api-version=2024-10-01-preview → empty response. azure-mgmt-mysqlflexibleservers==1.1.0b2 (already in setup.py) uses api-version=2025-06-01-preview which returns actual data.
  • Transformer bug fix (_transformers.py): len(result) > 1len(result) >= 1. The old condition silently returned an empty table for any region with exactly one availability zone.
  • Test hardening (test_mysql_scenario.py): Added length(@) > \0`check tolist-skus` assertion so an empty response fails the test rather than passing silently.
  • HISTORY.rst: Added bug fix entry.

Testing Guide

# Should return a non-empty list of capability objects
az mysql flexible-server list-skus -l westeurope

# Table format should also work for all regions
az mysql flexible-server list-skus -l westeurope --output table

History Notes

[MySQL] az mysql flexible-server list-skus: Fix command returning empty list for all regions


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Breaking Change Starting...

Thanks for your contribution!

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI changed the title [WIP] Fix issue with az mysql flexible-server list-skus returning empty SKU list [MySQL] Fix az mysql flexible-server list-skus returning empty list for all regions Jul 17, 2026
Copilot AI requested a review from a0x1ab July 17, 2026 06:20
@azure-client-tools-agent

Copy link
Copy Markdown

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_mysql_scenario (module)
PR head ref: copilot/fix-mysql-list-skus-issue
PR head sha: 5de2ed8e9a3c25297571758332763c496c846994
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/29559799576

Live-test recordings: 1 regenerated — archived in workflow artifact live-test-pr-33747 (recordings/).

Recording files
src/azure-cli/azure/cli/command_modules/mysql/tests/latest/recordings/test_mysql_flexible_server_byok_mgmt.yaml
Last 80 lines of azdev output
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:303: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.venv/lib/python3.12/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/__init__.py:153: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ex = CLIError(GraphError('/me request is only valid with delegated authentication flow.'))
args = (), kwargs = {}

    def _handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
        if isinstance(ex, CannotOverwriteExistingCassetteException):
            # This exception usually caused by a no match HTTP request. This is a product error
            # that is caused by change of SDK invocation.
            raise ex
    
>       raise CliExecutionError(ex)
E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception CLIError during execution and fails the command.

azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.mysql.tests.latest.test_mysql_scenario.FlexibleServerMgmtScenarioTest testMethod=test_mysql_flexible_server_byok_mgmt>
resource_group = 'clitest.rgp62xbqdndnvihx3r3m36ifd424miwy6hujz6dvh4wdm2wh5fptt42szhpn3tnxrob'
vault_name = 'rdbmsvaultgsakrr7aesnsmm'
backup_vault_name = 'rdbmsvaultp2digaazi3dslg'

    @AllowLargeResponse()
    @ResourceGroupPreparer(location=DEFAULT_LOCATION)
    @KeyVaultPreparer(name_prefix='rdbmsvault', parameter_name='vault_name', location=DEFAULT_PAIRED_LOCATION, additional_params='--enable-purge-protection true --retention-days 90 --enable-rbac-authorization false')
    @KeyVaultPreparer(name_prefix='rdbmsvault', parameter_name='backup_vault_name', location=DEFAULT_LOCATION, additional_params='--enable-purge-protection true --retention-days 90 --enable-rbac-authorization false')
    def test_mysql_flexible_server_byok_mgmt(self, resource_group, vault_name, backup_vault_name):
>       self._test_flexible_server_byok_mgmt('mysql', resource_group, vault_name, backup_vault_name)

azure-cli/src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py:139: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
azure-cli/src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py:741: in _test_flexible_server_byok_mgmt
    user = self.cmd('ad signed-in-user show').get_output_in_json()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in __init__
    self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in _in_process_execute
    raise ex.exception
.venv/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:677: in execute
    raise ex
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:820: in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:812: in _run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ex = GraphError('/me request is only valid with delegated authentication flow.')

    def graph_err_handler(ex):
        # Convert GraphError to CLIError that can be printed
        from ._msgrpah import GraphError
        if isinstance(ex, GraphError):
            from knack.util import CLIError
>           raise CLIError(ex)
E           knack.util.CLIError: /me request is only valid with delegated authentication flow.

azure-cli/src/azure-cli/azure/cli/command_modules/role/commands.py:56: CLIError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
========================= 1 failed in 84.49s (0:01:24) =========================

Posted by agent-assist live-test workflow.

@azure-client-tools-agent

Copy link
Copy Markdown

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_mysql_scenario (module)
PR head ref: copilot/fix-mysql-list-skus-issue
PR head sha: b69fbb665dd3485aa745528f8dd445b874b359a5
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/29560619868

Live-test recordings: 1 regenerated — archived in workflow artifact live-test-pr-33747 (recordings/).

Recording files
src/azure-cli/azure/cli/command_modules/mysql/tests/latest/recordings/test_mysql_flexible_server_byok_mgmt.yaml
Last 80 lines of azdev output
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:303: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.venv/lib/python3.12/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/__init__.py:153: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ex = CLIError(GraphError('/me request is only valid with delegated authentication flow.'))
args = (), kwargs = {}

    def _handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
        if isinstance(ex, CannotOverwriteExistingCassetteException):
            # This exception usually caused by a no match HTTP request. This is a product error
            # that is caused by change of SDK invocation.
            raise ex
    
>       raise CliExecutionError(ex)
E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception CLIError during execution and fails the command.

azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.mysql.tests.latest.test_mysql_scenario.FlexibleServerMgmtScenarioTest testMethod=test_mysql_flexible_server_byok_mgmt>
resource_group = 'clitest.rgxwvh6ocoteyrobxl25oj7tvaisjjpsrgat3tgolvjoive6o5eupkzpdnco4ujdu3f'
vault_name = 'rdbmsvaultnhlvx5qhfokrtn'
backup_vault_name = 'rdbmsvaultelznge6cmxse34'

    @AllowLargeResponse()
    @ResourceGroupPreparer(location=DEFAULT_LOCATION)
    @KeyVaultPreparer(name_prefix='rdbmsvault', parameter_name='vault_name', location=DEFAULT_PAIRED_LOCATION, additional_params='--enable-purge-protection true --retention-days 90 --enable-rbac-authorization false')
    @KeyVaultPreparer(name_prefix='rdbmsvault', parameter_name='backup_vault_name', location=DEFAULT_LOCATION, additional_params='--enable-purge-protection true --retention-days 90 --enable-rbac-authorization false')
    def test_mysql_flexible_server_byok_mgmt(self, resource_group, vault_name, backup_vault_name):
>       self._test_flexible_server_byok_mgmt('mysql', resource_group, vault_name, backup_vault_name)

azure-cli/src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py:139: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
azure-cli/src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py:741: in _test_flexible_server_byok_mgmt
    user = self.cmd('ad signed-in-user show').get_output_in_json()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in __init__
    self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in _in_process_execute
    raise ex.exception
.venv/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:677: in execute
    raise ex
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:820: in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:812: in _run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ex = GraphError('/me request is only valid with delegated authentication flow.')

    def graph_err_handler(ex):
        # Convert GraphError to CLIError that can be printed
        from ._msgrpah import GraphError
        if isinstance(ex, GraphError):
            from knack.util import CLIError
>           raise CLIError(ex)
E           knack.util.CLIError: /me request is only valid with delegated authentication flow.

azure-cli/src/azure-cli/azure/cli/command_modules/role/commands.py:56: CLIError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
========================= 1 failed in 96.56s (0:01:36) =========================

Posted by agent-assist live-test workflow.

@a0x1ab

a0x1ab commented Jul 17, 2026

Copy link
Copy Markdown
Member

@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33747 (review) and push a fix.


Posted by agent-assist (autonomous bug-fix pipeline).

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Live Test Failure — Action Required

The live test run for this PR failed. All CI checks passed, but azdev test --live reported failures.

Failing test

test_mysql_flexible_server_byok_mgmt in test_mysql_scenario.py

Error

ex = CLIError(GraphError('/me request is only valid with delegated authentication flow.'))

azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception CLIError during execution and fails the command.

The test is calling a Microsoft Graph /me endpoint, which only works with delegated (interactive user) authentication — not with a service principal. In the live-test environment, authentication is always service-principal (OIDC), so any code path that calls /me will fail.

What to investigate

  1. Review whether the changes to test_mysql_scenario.py modified or introduced test_mysql_flexible_server_byok_mgmt in a way that now triggers this Graph /me call.
  2. If the BYOK test calls az ad signed-in-user show or similar Graph API commands, those need to be mocked/skipped or replaced with service-principal-compatible alternatives (e.g. az ad sp show).
  3. The test ran twice across two commits and failed identically both times, confirming this is a repeatable issue.

Live test run: https://github.com/Azure/issue-sentinel/actions/runs/29560619868

Please fix the test so that test_mysql_flexible_server_byok_mgmt passes under service-principal authentication, or skip the Graph-dependent assertion in live mode.


Posted by agent-assist (autonomous bug-fix pipeline).

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33747 (review) and pu...

Fixed in commits fix: BYOK test_test_flexible_server_byok_mgmt now catches CliExecutionError when az ad signed-in-user show fails under service-principal auth (Graph /me is delegated-only), and falls back to resolving the caller object ID via az account show + az ad sp show --id <clientId>. Added import for CliExecutionError from azure.cli.testsdk.exceptions.

@azure-client-tools-agent

Copy link
Copy Markdown

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_mysql_scenario (module)
PR head ref: copilot/fix-mysql-list-skus-issue
PR head sha: 4aea9bace9725f52e19003da001ced71c9418de1
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/29563427899

Live-test recordings: 1 regenerated — archived in workflow artifact live-test-pr-33747 (recordings/).

Recording files
src/azure-cli/azure/cli/command_modules/mysql/tests/latest/recordings/test_mysql_flexible_server_byok_mgmt.yaml
Last 80 lines of azdev output
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:303: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.venv/lib/python3.12/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/__init__.py:153: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ex = CLIError(GraphError('/me request is only valid with delegated authentication flow.'))
args = (), kwargs = {}

    def _handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
        if isinstance(ex, CannotOverwriteExistingCassetteException):
            # This exception usually caused by a no match HTTP request. This is a product error
            # that is caused by change of SDK invocation.
            raise ex
    
>       raise CliExecutionError(ex)
E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception CLIError during execution and fails the command.

azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.mysql.tests.latest.test_mysql_scenario.FlexibleServerMgmtScenarioTest testMethod=test_mysql_flexible_server_byok_mgmt>
resource_group = 'clitest.rgjmderbnrcl5lh24x56y35eq7wm4ukahf2acmz33oqh2q6um5zo5z2niodpf4jmozf'
vault_name = 'rdbmsvaultlqscynvdapt52k'
backup_vault_name = 'rdbmsvaultngyf54qg65wors'

    @AllowLargeResponse()
    @ResourceGroupPreparer(location=DEFAULT_LOCATION)
    @KeyVaultPreparer(name_prefix='rdbmsvault', parameter_name='vault_name', location=DEFAULT_PAIRED_LOCATION, additional_params='--enable-purge-protection true --retention-days 90 --enable-rbac-authorization false')
    @KeyVaultPreparer(name_prefix='rdbmsvault', parameter_name='backup_vault_name', location=DEFAULT_LOCATION, additional_params='--enable-purge-protection true --retention-days 90 --enable-rbac-authorization false')
    def test_mysql_flexible_server_byok_mgmt(self, resource_group, vault_name, backup_vault_name):
>       self._test_flexible_server_byok_mgmt('mysql', resource_group, vault_name, backup_vault_name)

azure-cli/src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py:140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
azure-cli/src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py:743: in _test_flexible_server_byok_mgmt
    user = self.cmd('ad signed-in-user show').get_output_in_json()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in __init__
    self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in _in_process_execute
    raise ex.exception
.venv/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:677: in execute
    raise ex
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:820: in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:812: in _run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ex = GraphError('/me request is only valid with delegated authentication flow.')

    def graph_err_handler(ex):
        # Convert GraphError to CLIError that can be printed
        from ._msgrpah import GraphError
        if isinstance(ex, GraphError):
            from knack.util import CLIError
>           raise CLIError(ex)
E           knack.util.CLIError: /me request is only valid with delegated authentication flow.

azure-cli/src/azure-cli/azure/cli/command_modules/role/commands.py:56: CLIError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
========================= 1 failed in 88.59s (0:01:28) =========================

Posted by agent-assist live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Live test still failing on latest commit

The live-test workflow (azdev test --live --series test_mysql_scenario) still fails on head SHA 4aea9bace9725f52e19003da001ced71c9418de1, even after the last fix attempt:

Run: https://github.com/Azure/issue-sentinel/actions/runs/29563427899

ex = CLIError(GraphError('/me request is only valid with delegated authentication flow.'))

    def _handle_main_exception(ex, *args, **kwargs):
        ...
>       raise CliExecutionError(ex)
E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception CLIError during execution and fails the command.

azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

self = <azure.cli.command_modules.mysql.tests.latest.test_mysql_scenario.FlexibleServerMgmtScenarioTest testMethod=test_mysql_flexible_server_byok_mgmt>

CI checks on this PR are otherwise green (no failed checks, nothing pending), so this is purely the live-test failure.

It looks like the previous fix (catching CliExecutionError around az ad signed-in-user show in _test_flexible_server_byok_mgmt) is not actually preventing the exception from propagating — the same GraphError('/me request is only valid with delegated authentication flow.') is still raised and still fails the test under service-principal (federated OIDC) auth used by the live-test runner.

Please:

  1. Re-check exactly where az ad signed-in-user show (or the equivalent /me Graph call) is invoked in src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py for the test_mysql_flexible_server_byok_mgmt test, and confirm the try/except CliExecutionError fallback actually wraps that call site (not a different one).
  2. Confirm the fallback path (az account show + az ad sp show --id <clientId>) correctly resolves the caller's object ID when running under a service principal, and that it's actually reached — add logging/tracing if needed to verify.
  3. Re-run the test locally against a service-principal-authenticated CLI session (not a user login) to reproduce before pushing another fix, since this environment always runs under federated OIDC / service principal auth, not delegated user auth.

Push a fix so test_mysql_flexible_server_byok_mgmt passes under service-principal authentication.


Posted by agent-assist (autonomous bug-fix pipeline).

@a0x1ab

a0x1ab commented Jul 17, 2026

Copy link
Copy Markdown
Member

@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33747 (review) and push a fix.


Posted by agent-assist (autonomous bug-fix pipeline).

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33747 (review) and pu...

The previous fix used except CliExecutionError, but the test SDK's _in_process_execute re-raises the inner exception (CLIError) rather than the wrapper (CliExecutionError) when expect_failure=False. So the except CliExecutionError block was never reached and the CLIError(GraphError('/me request is only valid with delegated authentication flow.')) propagated up unhandled.

Fixed in the latest commit by changing except CliExecutionErrorexcept Exception so the SP fallback path (az account show + az ad sp show --id <clientId>) is correctly reached under service-principal / OIDC auth. Also removed the now-unused CliExecutionError import.

@yonzhan

yonzhan commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

MySQL

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review — CI + live-test summary

CI: ✅ all 18 checks passed (0 failed, 0 pending).

Live test (azdev test --live -- test_mysql_scenario): 2 passed, 1 failed.
The single failure is not a code defect — it's an environment/auth issue in
the live-test harness:

azure.cli.core.azclierror.AuthenticationError: AADSTS700024: Client assertion
is not within its valid time range. Current time: 2026-07-17T08:43:11Z,
assertion valid from 2026-07-17T07:47:44Z, expiry time of assertion
2026-07-17T07:52:44Z.

The overall live-test run took ~52 minutes (3116.83s), well past the
5-minute validity window of the service-principal client assertion used to
authenticate test calls — the credential simply expired mid-run before
reaching the third scenario. This is an infrastructure token-lifetime issue
in the test runner, unrelated to the change in this PR (mysql list-skus
fix). No action needed on the PR itself.

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/29564194447


Posted by agent-assist (autonomous bug-fix pipeline).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az mysql flexible-server list-skus does not list any SKU's for any region

3 participants