Skip to content

Commit 30bf327

Browse files
authored
[RDBMS] BREAKING CHANGE: az postgres flexible-server create/update/ad-admin: Rename deprecated references to Microsoft Entra (#31379)
1 parent 4ac0f25 commit 30bf327

12 files changed

+2426
-20232
lines changed

src/azure-cli/azure/cli/command_modules/rdbms/_breaking_change.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55

6-
from azure.cli.core.breaking_change import register_command_group_deprecate, register_default_value_breaking_change, \
7-
register_argument_deprecate, register_other_breaking_change, register_logic_breaking_change
6+
from azure.cli.core.breaking_change import register_default_value_breaking_change, \
7+
register_other_breaking_change, register_logic_breaking_change
88

99

1010
register_logic_breaking_change('postgres flexible-server create', 'Update default value of "--sku-name"',
@@ -13,9 +13,6 @@
1313
register_default_value_breaking_change('postgres flexible-server create', '--version', '16', '17')
1414
register_default_value_breaking_change('postgres flexible-server create', '--create-default-database', 'Enabled',
1515
'Disabled')
16-
register_argument_deprecate('postgres flexible-server create', '--active-directory-auth', '--microsoft-entra-auth')
17-
register_argument_deprecate('postgres flexible-server update', '--active-directory-auth', '--microsoft-entra-auth')
18-
register_command_group_deprecate('postgres flexible-server ad-admin', redirect='microsoft-entra-admin')
1916
register_other_breaking_change('postgres flexible-server update',
2017
message='User confirmation will be needed for compute and storage updates '
2118
'that trigger a restart of the server.')

src/azure-cli/azure/cli/command_modules/rdbms/_client_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def cf_postgres_flexible_operations(cli_ctx, _):
370370
return get_postgresql_flexible_management_client(cli_ctx).flexible_server
371371

372372

373-
def cf_postgres_flexible_adadmin(cli_ctx, _):
373+
def cf_postgres_flexible_admin(cli_ctx, _):
374374
return get_postgresql_flexible_management_client(cli_ctx).administrators
375375

376376

src/azure-cli/azure/cli/command_modules/rdbms/_helptext_pg.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -950,53 +950,6 @@
950950
text: az postgres flexible-server identity list -g testgroup -s testsvr
951951
"""
952952

953-
helps['postgres flexible-server ad-admin'] = """
954-
type: group
955-
short-summary: Manage server Microsoft Entra administrators.
956-
"""
957-
958-
helps['postgres flexible-server ad-admin create'] = """
959-
type: command
960-
short-summary: Create a Microsoft Entra administrator.
961-
examples:
962-
- name: Create Microsoft Entra administrator with user 'john@contoso.com', administrator ID '00000000-0000-0000-0000-000000000000' and type User.
963-
text: az postgres flexible-server ad-admin create -g testgroup -s testsvr -u john@contoso.com -i 00000000-0000-0000-0000-000000000000 -t User
964-
"""
965-
966-
helps['postgres flexible-server ad-admin delete'] = """
967-
type: command
968-
short-summary: Delete a Microsoft Entra administrator.
969-
examples:
970-
- name: Delete Microsoft Entra administrator with ID '00000000-0000-0000-0000-000000000000'.
971-
text: az postgres flexible-server ad-admin delete -g testgroup -s testsvr -i 00000000-0000-0000-0000-000000000000
972-
"""
973-
974-
helps['postgres flexible-server ad-admin list'] = """
975-
type: command
976-
short-summary: List all Microsoft Entra administrators.
977-
examples:
978-
- name: List Microsoft Entra administrators.
979-
text: az postgres flexible-server ad-admin list -g testgroup -s testsvr
980-
"""
981-
982-
helps['postgres flexible-server ad-admin show'] = """
983-
type: command
984-
short-summary: Get a Microsoft Entra administrator.
985-
examples:
986-
- name: Get Microsoft Entra administrator with ID '00000000-0000-0000-0000-000000000000'.
987-
text: az postgres flexible-server ad-admin show -g testgroup -s testsvr -i 00000000-0000-0000-0000-000000000000
988-
"""
989-
990-
helps['postgres flexible-server ad-admin wait'] = """
991-
type: command
992-
short-summary: Wait for a Microsoft Entra administrator to satisfy certain conditions.
993-
examples:
994-
- name: Wait until a Microsoft Entra administrator exists.
995-
text: az postgres flexible-server ad-admin wait -g testgroup -s testsvr -i 00000000-0000-0000-0000-000000000000 --exists
996-
- name: Wait for a Microsoft Entra administrator to be deleted.
997-
text: az postgres flexible-server ad-admin wait -g testgroup -s testsvr -i 00000000-0000-0000-0000-000000000000 --deleted
998-
"""
999-
1000953
helps['postgres flexible-server microsoft-entra-admin'] = """
1001954
type: group
1002955
short-summary: Manage server Microsoft Entra administrators.

src/azure-cli/azure/cli/command_modules/rdbms/_params.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,6 @@ def _flexible_server_params(command_group):
539539
validator=validate_identities
540540
)
541541

542-
active_directory_auth_arg_type = CLIArgumentType(
543-
options_list=['--active-directory-auth'],
544-
arg_type=get_enum_type(['Enabled', 'Disabled']),
545-
help='Whether Microsoft Entra authentication is enabled.'
546-
)
547-
548542
microsoft_entra_auth_arg_type = CLIArgumentType(
549543
options_list=['--microsoft-entra-auth'],
550544
arg_type=get_enum_type(['Enabled', 'Disabled']),
@@ -612,7 +606,6 @@ def _flexible_server_params(command_group):
612606
c.argument('storage_gb', default='128', arg_type=storage_gb_arg_type)
613607
c.argument('version', default='17', arg_type=version_arg_type)
614608
c.argument('backup_retention', default=7, arg_type=pg_backup_retention_arg_type)
615-
c.argument('active_directory_auth', default='Disabled', arg_type=active_directory_auth_arg_type)
616609
c.argument('microsoft_entra_auth', default='Disabled', arg_type=microsoft_entra_auth_arg_type)
617610
c.argument('admin_id', options_list=['--admin-object-id', '-i'], help='The unique ID of the Microsoft Entra administrator.')
618611
c.argument('admin_name', options_list=['--admin-display-name', '-m'], help='Display name of the Microsoft Entra administrator user or group.')
@@ -766,7 +759,6 @@ def _flexible_server_params(command_group):
766759
c.argument('iops', default=None, arg_type=iops_v2_arg_type)
767760
c.argument('throughput', default=None, arg_type=throughput_arg_type)
768761
c.argument('backup_retention', arg_type=pg_backup_retention_arg_type)
769-
c.argument('active_directory_auth', arg_type=active_directory_auth_arg_type)
770762
c.argument('microsoft_entra_auth', arg_type=microsoft_entra_auth_arg_type)
771763
c.argument('password_auth', arg_type=password_auth_arg_type)
772764
c.argument('private_dns_zone_arguments', private_dns_zone_arguments_arg_type)
@@ -1001,19 +993,6 @@ def _flexible_server_params(command_group):
1001993
c.argument('database_names', options_list=['--database-names', '-d'], nargs='+',
1002994
help='Space-separated list of the database names to be mirrored. Required if --mirroring is enabled.')
1003995

1004-
# ad-admin - Rename and deprecate group
1005-
with self.argument_context('{} flexible-server ad-admin'.format(command_group)) as c:
1006-
c.argument('server_name', id_part=None, options_list=['--server-name', '-s'], arg_type=server_name_arg_type)
1007-
1008-
for scope in ['create', 'show', 'delete', 'wait']:
1009-
with self.argument_context('{} flexible-server ad-admin {}'.format(command_group, scope)) as c:
1010-
c.argument('sid', options_list=['--object-id', '-i'], help='The unique ID of the Microsoft Entra administrator.')
1011-
1012-
with self.argument_context('{} flexible-server ad-admin create'.format(command_group)) as c:
1013-
c.argument('login', options_list=['--display-name', '-u'], help='Display name of the Microsoft Entra administrator user or group.')
1014-
c.argument('principal_type', options_list=['--type', '-t'], default='User', arg_type=get_enum_type(['User', 'Group', 'ServicePrincipal', 'Unknown']), help='Type of the Microsoft Entra administrator.')
1015-
c.argument('identity', help='Name or ID of identity used for AAD Authentication.', validator=validate_identity)
1016-
1017996
# microsoft-entra-admin
1018997
with self.argument_context('{} flexible-server microsoft-entra-admin'.format(command_group)) as c:
1019998
c.argument('server_name', id_part=None, options_list=['--server-name', '-s'], arg_type=server_name_arg_type)

src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_commands.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
cf_postgres_flexible_ltr_backups,
1717
cf_postgres_flexible_operations,
1818
cf_postgres_flexible_replica,
19-
cf_postgres_flexible_adadmin,
19+
cf_postgres_flexible_admin,
2020
cf_postgres_flexible_migrations,
2121
cf_postgres_flexible_private_endpoint_connection,
2222
cf_postgres_flexible_private_endpoint_connections,
@@ -85,9 +85,9 @@ def load_flexibleserver_command_table(self, _):
8585
client_factory=cf_postgres_flexible_replica
8686
)
8787

88-
postgres_flexible_adadmin_sdk = CliCommandType(
88+
postgres_flexible_admin_sdk = CliCommandType(
8989
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#AdministratorsOperations.{}',
90-
client_factory=cf_postgres_flexible_adadmin
90+
client_factory=cf_postgres_flexible_admin
9191
)
9292

9393
postgres_flexible_migrations_sdk = CliCommandType(
@@ -249,23 +249,14 @@ def load_flexibleserver_command_table(self, _):
249249
g.custom_show_command('show', 'flexible_server_identity_show')
250250
g.custom_command('list', 'flexible_server_identity_list')
251251

252-
with self.command_group('postgres flexible-server ad-admin', postgres_flexible_adadmin_sdk,
252+
with self.command_group('postgres flexible-server microsoft-entra-admin', postgres_flexible_admin_sdk,
253253
custom_command_type=flexible_servers_custom_postgres,
254-
client_factory=cf_postgres_flexible_adadmin) as g:
255-
g.custom_command('create', 'flexible_server_ad_admin_set', supports_no_wait=True)
256-
g.custom_command('delete', 'flexible_server_ad_admin_delete', supports_no_wait=True, confirmation=True)
257-
g.custom_command('list', 'flexible_server_ad_admin_list')
258-
g.custom_show_command('show', 'flexible_server_ad_admin_show')
259-
g.custom_wait_command('wait', 'flexible_server_ad_admin_show')
260-
261-
with self.command_group('postgres flexible-server microsoft-entra-admin', postgres_flexible_adadmin_sdk,
262-
custom_command_type=flexible_servers_custom_postgres,
263-
client_factory=cf_postgres_flexible_adadmin) as g:
264-
g.custom_command('create', 'flexible_server_ad_admin_set', supports_no_wait=True)
265-
g.custom_command('delete', 'flexible_server_ad_admin_delete', supports_no_wait=True, confirmation=True)
266-
g.custom_command('list', 'flexible_server_ad_admin_list')
267-
g.custom_show_command('show', 'flexible_server_ad_admin_show')
268-
g.custom_wait_command('wait', 'flexible_server_ad_admin_show')
254+
client_factory=cf_postgres_flexible_admin) as g:
255+
g.custom_command('create', 'flexible_server_microsoft_entra_admin_set', supports_no_wait=True)
256+
g.custom_command('delete', 'flexible_server_microsoft_entra_admin_delete', supports_no_wait=True, confirmation=True)
257+
g.custom_command('list', 'flexible_server_microsoft_entra_admin_list')
258+
g.custom_show_command('show', 'flexible_server_microsoft_entra_admin_show')
259+
g.custom_wait_command('wait', 'flexible_server_microsoft_entra_admin_show')
269260

270261
with self.command_group('postgres flexible-server advanced-threat-protection-setting', postgres_flexible_server_threat_protection_settings_sdk,
271262
custom_command_type=flexible_servers_custom_postgres,

src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
cf_postgres_flexible_private_dns_zone_suffix_operations, \
3131
cf_postgres_flexible_private_endpoint_connections, \
3232
cf_postgres_flexible_tuning_options, \
33-
cf_postgres_flexible_config, cf_postgres_flexible_adadmin
33+
cf_postgres_flexible_config, cf_postgres_flexible_admin
3434
from ._flexible_server_util import generate_missing_parameters, resolve_poller, \
3535
generate_password, parse_maintenance_window, get_current_time, build_identity_and_data_encryption, \
3636
_is_resource_name, get_tenant_id, get_case_insensitive_key_value, get_enum_value_true_false
@@ -58,7 +58,7 @@ def flexible_server_create(cmd, client,
5858
resource_group_name=None, server_name=None,
5959
location=None, backup_retention=None,
6060
sku_name=None, tier=None,
61-
storage_gb=None, version=None, active_directory_auth=None, microsoft_entra_auth=None,
61+
storage_gb=None, version=None, microsoft_entra_auth=None,
6262
admin_name=None, admin_id=None, admin_type=None,
6363
password_auth=None, administrator_login=None, administrator_login_password=None,
6464
tags=None, database_name=None,
@@ -107,7 +107,7 @@ def flexible_server_create(cmd, client,
107107
backup_byok_key=backup_byok_key,
108108
performance_tier=performance_tier,
109109
create_cluster=create_cluster,
110-
password_auth=password_auth, active_directory_auth=active_directory_auth, microsoft_entra_auth=microsoft_entra_auth,
110+
password_auth=password_auth, microsoft_entra_auth=microsoft_entra_auth,
111111
admin_name=admin_name, admin_id=admin_id, admin_type=admin_type,)
112112

113113
cluster = None
@@ -141,8 +141,7 @@ def flexible_server_create(cmd, client,
141141
standby_availability_zone=standby_availability_zone)
142142

143143
is_password_auth_enabled = bool(password_auth is not None and password_auth.lower() == 'enabled')
144-
is_microsoft_entra_auth_enabled = bool(active_directory_auth is not None and active_directory_auth.lower() == 'enabled') or \
145-
bool(microsoft_entra_auth is not None and microsoft_entra_auth.lower() == 'enabled')
144+
is_microsoft_entra_auth_enabled = bool(microsoft_entra_auth is not None and microsoft_entra_auth.lower() == 'enabled')
146145
if is_password_auth_enabled:
147146
administrator_login_password = generate_password(administrator_login_password)
148147

@@ -176,7 +175,7 @@ def flexible_server_create(cmd, client,
176175

177176
# Add Microsoft Entra Admin
178177
if is_microsoft_entra_auth_enabled and admin_name is not None or admin_id is not None:
179-
server_admin_client = cf_postgres_flexible_adadmin(cmd.cli_ctx, '_')
178+
server_admin_client = cf_postgres_flexible_admin(cmd.cli_ctx, '_')
180179
logger.warning("Add Microsoft Entra Admin '%s'.", admin_name)
181180
_create_admin(server_admin_client, resource_group_name, server_name, admin_name, admin_id, admin_type)
182181

@@ -313,7 +312,7 @@ def flexible_server_update_custom_func(cmd, client, instance,
313312
maintenance_window=None,
314313
byok_identity=None, byok_key=None,
315314
backup_byok_identity=None, backup_byok_key=None,
316-
active_directory_auth=None, microsoft_entra_auth=None, password_auth=None,
315+
microsoft_entra_auth=None, password_auth=None,
317316
private_dns_zone_arguments=None,
318317
public_access=None,
319318
tags=None,
@@ -427,8 +426,8 @@ def flexible_server_update_custom_func(cmd, client, instance,
427426

428427
auth_config = instance.auth_config
429428
administrator_login = instance.administrator_login if instance.administrator_login else None
430-
if active_directory_auth or microsoft_entra_auth:
431-
auth_config.active_directory_auth = active_directory_auth if active_directory_auth else microsoft_entra_auth
429+
if microsoft_entra_auth:
430+
auth_config.active_directory_auth = microsoft_entra_auth
432431
if password_auth:
433432
administrator_login, administrator_login_password = _update_login(server_name, resource_group_name, auth_config,
434433
password_auth, administrator_login, administrator_login_password)
@@ -1088,7 +1087,7 @@ def flexible_server_identity_show(cmd, client, resource_group_name, server_name,
10881087

10891088

10901089
# Custom functions for ad-admin
1091-
def flexible_server_ad_admin_set(cmd, client, resource_group_name, server_name, login, sid, principal_type=None, no_wait=False):
1090+
def flexible_server_microsoft_entra_admin_set(cmd, client, resource_group_name, server_name, login, sid, principal_type=None, no_wait=False):
10921091
validate_resource_group(resource_group_name)
10931092

10941093
server_operations_client = cf_postgres_flexible_servers(cmd.cli_ctx, '_')
@@ -1112,7 +1111,7 @@ def _create_admin(client, resource_group_name, server_name, principal_name, sid,
11121111
return sdk_no_wait(no_wait, client.begin_create, resource_group_name, server_name, sid, parameters)
11131112

11141113

1115-
def flexible_server_ad_admin_delete(cmd, client, resource_group_name, server_name, sid, no_wait=False):
1114+
def flexible_server_microsoft_entra_admin_delete(cmd, client, resource_group_name, server_name, sid, no_wait=False):
11161115
validate_resource_group(resource_group_name)
11171116

11181117
server_operations_client = cf_postgres_flexible_servers(cmd.cli_ctx, '_')
@@ -1125,15 +1124,15 @@ def flexible_server_ad_admin_delete(cmd, client, resource_group_name, server_nam
11251124
return sdk_no_wait(no_wait, client.begin_delete, resource_group_name, server_name, sid)
11261125

11271126

1128-
def flexible_server_ad_admin_list(client, resource_group_name, server_name):
1127+
def flexible_server_microsoft_entra_admin_list(client, resource_group_name, server_name):
11291128
validate_resource_group(resource_group_name)
11301129

11311130
return client.list_by_server(
11321131
resource_group_name=resource_group_name,
11331132
server_name=server_name)
11341133

11351134

1136-
def flexible_server_ad_admin_show(client, resource_group_name, server_name, sid):
1135+
def flexible_server_microsoft_entra_admin_show(client, resource_group_name, server_name, sid):
11371136
validate_resource_group(resource_group_name)
11381137

11391138
return client.get(

0 commit comments

Comments
 (0)