Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
eead433
Initial plan
Copilot Jul 17, 2026
5de2ed8
[MySQL] Fix `az mysql flexible-server list-skus` returning empty list…
Copilot Jul 17, 2026
b69fbb6
Merge branch 'dev' into copilot/fix-mysql-list-skus-issue
azure-client-tools-agent[bot] Jul 17, 2026
315158f
fix: BYOK test - fall back to SP object ID when Graph /me unavailable…
Copilot Jul 17, 2026
20780c2
fix: narrow exception type to CliExecutionError for Graph /me SP auth…
Copilot Jul 17, 2026
4aea9ba
fix: expand exception comment for SP auth fallback in BYOK test
Copilot Jul 17, 2026
70e85af
fix: catch Exception instead of CliExecutionError for Graph /me SP au…
Copilot Jul 17, 2026
31e1ba3
fix: catch CLIError specifically instead of bare Exception for Graph …
Copilot Jul 17, 2026
89516b7
docs: clarify BYOK test SP auth fallback comments
Copilot Jul 20, 2026
7b91a4c
fix: use broad Exception catch to handle GraphError in BYOK test SP a…
Copilot Jul 20, 2026
fcf8b74
fix: catch GraphError specifically instead of broad Exception in BYOK…
Copilot Jul 20, 2026
ecdfcc4
Merge branch 'dev' into copilot/fix-mysql-list-skus-issue
azure-client-tools-agent[bot] Jul 20, 2026
3520d69
fix: catch CLIError (not GraphError) in BYOK test SP auth fallback
Copilot Jul 20, 2026
6b8efba
refactor: use `if result:` and narrow bare except in list-skus transf…
Copilot Jul 20, 2026
d7197db
refactor: guard list-skus transformer with isinstance check
Copilot Jul 20, 2026
5bf270e
Merge branch 'dev' into copilot/fix-mysql-list-skus-issue
azure-client-tools-agent[bot] Jul 20, 2026
c3887f9
docs: simplify HISTORY.rst entry for list-skus fix
Copilot Jul 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/azure-cli/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Release History
**MySQL**

* [BREAKING CHANGE] `az mysql flexible-server backup create/restore/geo-restore/replica`: Remove `--storage-redundancy` (#33428)
* Fix #31568: `az mysql flexible-server list-skus`: Fix command returning empty list for all regions

**NetAppFiles**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def table_transform_output_list_servers(result):

def mysql_table_transform_output_list_skus(result):
table_result = []
if len(result) > 1:
if isinstance(result, list) and result:
skus_tiers = result[0]["supportedFlexibleServerEditions"]
for skus in skus_tiers:
tier_name = skus["name"]
Expand All @@ -61,7 +61,7 @@ def mysql_table_transform_output_list_skus(result):
new_entry['Memory'] = str(int(key['supportedMemoryPerVCoreMb']) * int(key['vCores']) // 1024) + " GiB"
new_entry['Max Disk IOPS'] = key['supportedIops']
table_result.append(new_entry)
except:
except (KeyError, IndexError, TypeError):
raise CLIError("There is no sku available for this location.")

return table_result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from azure.cli.testsdk.scenario_tests.const import ENV_LIVE_TEST
from azure.cli.testsdk.preparers import AbstractPreparer, SingleValueReplacer, StorageAccountPreparer
from azure.core.exceptions import HttpResponseError
from knack.util import CLIError
from ..._client_factory import cf_mysql_flexible_private_dns_zone_suffix_operations
from ..._network import prepare_private_dns_zone
from ...custom import DbContext as MysqlDbContext, _determine_iops
Expand Down Expand Up @@ -224,7 +225,8 @@ def _test_flexible_server_mgmt(self, database_engine, resource_group):
self.assertIn('ado.net', connection_string['connectionStrings'])

self.cmd('{} flexible-server list-skus -l {}'.format(database_engine, location),
checks=[JMESPathCheck('type(@)', 'array')])
checks=[JMESPathCheck('type(@)', 'array'),
JMESPathCheck('length(@) > `0`', True)])

self.cmd('{} flexible-server delete -g {} -n {} --yes'.format(database_engine, resource_group, server_name), checks=NoneCheck())

Expand Down Expand Up @@ -737,9 +739,21 @@ def _test_flexible_server_byok_mgmt(self, database_engine, resource_group, vault
backup_location = DEFAULT_PAIRED_LOCATION
replication_role = 'Replica'

user = self.cmd('ad signed-in-user show').get_output_in_json()

self.cmd('keyvault set-policy --name {} --object-id {} --key-permissions all'.format(vault_name, user['id']))
try:
# In interactive/delegated auth, `az ad signed-in-user show` returns the signed-in user.
user = self.cmd('ad signed-in-user show').get_output_in_json()
caller_object_id = user['id']
except CLIError:
# `az ad signed-in-user show` calls Graph /me which is delegated-only. Under
# service-principal/OIDC auth (as used in live-test CI pipelines), the Graph API
# returns an HTTP 400. The role module's graph_err_handler converts the raw
# GraphError into a CLIError, which is what the test SDK re-raises here.
# Fall back to resolving the caller's object ID via `az ad sp show`.
account = self.cmd('account show').get_output_in_json()
sp_client_id = account['user']['name']
caller_object_id = self.cmd('ad sp show --id {}'.format(sp_client_id)).get_output_in_json()['id']

self.cmd('keyvault set-policy --name {} --object-id {} --key-permissions all'.format(vault_name, caller_object_id))

key = self.cmd('keyvault key create --name {} -p software --vault-name {}'
.format(key_name, vault_name)).get_output_in_json()
Expand Down
Loading