Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,64 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.breaking_change import register_argument_deprecate, register_command_group_deprecate
from azure.cli.core.breaking_change import (register_argument_deprecate, register_command_group_deprecate,
register_other_breaking_change)

# High availability command argument changes
register_argument_deprecate('postgres flexible-server create', '--high-availability', redirect='--zonal-resiliency')
register_argument_deprecate('postgres flexible-server update', '--high-availability', redirect='--zonal-resiliency')

# Index Tuning command argument changes
register_command_group_deprecate(command_group='postgres flexible-server index-tuning',
redirect='postgres flexible-server autonomous-tuning',
message='Index tuning feature has now expanded its capabilities to support '
'other automatically generated recommendations which are covered by the '
'new command.')

# LTR command argument changes
register_other_breaking_change('postgres flexible-server long-term-retention',
message='The --backup-name/-b argument has been deprecated and will be removed '
'in next breaking change release(2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server long-term-retention',
message='The --name/-n argument will be repurposed to specify the backup name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in next breaking change release(2.86.0) scheduled for May 2026.')

# Backup command argument changes
register_other_breaking_change('postgres flexible-server backup',
message='The --backup-name/-b argument has been deprecated and will be removed '
'in next breaking change release(2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server backup',
message='The --name/-n argument will be repurposed to specify the backup name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in next breaking change release(2.86.0) scheduled for May 2026.')

# Database command argument changes
register_other_breaking_change('postgres flexible-server db',
message='The --database-name/-d argument has been deprecated and will be removed '
'in next breaking change release(2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server db',
message='The --name/-n argument will be repurposed to specify the database name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in next breaking change release(2.86.0) scheduled for May 2026.')

# Firewall rule command argument changes
register_other_breaking_change('postgres flexible-server firewall-rule',
message='The --name/-n argument will be repurposed to specify the firewall rule '
'name. The --server-name/-s argument will be introduced to specify the server '
'name in next breaking change release(2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server firewall-rule',
message='The --rule-name/-r argument has been deprecated and will be removed '
'in next breaking change release(2.86.0) scheduled for May 2026.')

# Migration command argument changes
register_other_breaking_change('postgres flexible-server migration',
message='The --migration-name argument has been deprecated and will be removed '
'in next breaking change release(2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server migration',
message='The --name/-n argument will be repurposed to specify the migration name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in next breaking change release(2.86.0) scheduled for May 2026.')
Comment on lines +23 to +63
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

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

The breaking change messages for these command groups use inconsistent phrasing. Some say "will be repurposed" while others say "will be introduced". Additionally, the message says "in next breaking change release(2.86.0) scheduled for May 2026" but should be more consistently formatted as "in the next breaking change release (2.86.0) scheduled for May 2026" (with article "the" and proper spacing around parentheses) to match standard English grammar.

Suggested change
'in next breaking change release(2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server long-term-retention',
message='The --name/-n argument will be repurposed to specify the backup name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in next breaking change release(2.86.0) scheduled for May 2026.')
# Backup command argument changes
register_other_breaking_change('postgres flexible-server backup',
message='The --backup-name/-b argument has been deprecated and will be removed '
'in next breaking change release(2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server backup',
message='The --name/-n argument will be repurposed to specify the backup name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in next breaking change release(2.86.0) scheduled for May 2026.')
# Database command argument changes
register_other_breaking_change('postgres flexible-server db',
message='The --database-name/-d argument has been deprecated and will be removed '
'in next breaking change release(2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server db',
message='The --name/-n argument will be repurposed to specify the database name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in next breaking change release(2.86.0) scheduled for May 2026.')
# Firewall rule command argument changes
register_other_breaking_change('postgres flexible-server firewall-rule',
message='The --name/-n argument will be repurposed to specify the firewall rule '
'name. The --server-name/-s argument will be introduced to specify the server '
'name in next breaking change release(2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server firewall-rule',
message='The --rule-name/-r argument has been deprecated and will be removed '
'in next breaking change release(2.86.0) scheduled for May 2026.')
# Migration command argument changes
register_other_breaking_change('postgres flexible-server migration',
message='The --migration-name argument has been deprecated and will be removed '
'in next breaking change release(2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server migration',
message='The --name/-n argument will be repurposed to specify the migration name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in next breaking change release(2.86.0) scheduled for May 2026.')
'in the next breaking change release (2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server long-term-retention',
message='The --name/-n argument will be repurposed to specify the backup name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in the next breaking change release (2.86.0) scheduled for May 2026.')
# Backup command argument changes
register_other_breaking_change('postgres flexible-server backup',
message='The --backup-name/-b argument has been deprecated and will be removed '
'in the next breaking change release (2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server backup',
message='The --name/-n argument will be repurposed to specify the backup name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in the next breaking change release (2.86.0) scheduled for May 2026.')
# Database command argument changes
register_other_breaking_change('postgres flexible-server db',
message='The --database-name/-d argument has been deprecated and will be removed '
'in the next breaking change release (2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server db',
message='The --name/-n argument will be repurposed to specify the database name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in the next breaking change release (2.86.0) scheduled for May 2026.')
# Firewall rule command argument changes
register_other_breaking_change('postgres flexible-server firewall-rule',
message='The --name/-n argument will be repurposed to specify the firewall rule '
'name. The --server-name/-s argument will be introduced to specify the server '
'name in the next breaking change release (2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server firewall-rule',
message='The --rule-name/-r argument has been deprecated and will be removed '
'in the next breaking change release (2.86.0) scheduled for May 2026.')
# Migration command argument changes
register_other_breaking_change('postgres flexible-server migration',
message='The --migration-name argument has been deprecated and will be removed '
'in the next breaking change release (2.86.0) scheduled for May 2026.')
register_other_breaking_change('postgres flexible-server migration',
message='The --name/-n argument will be repurposed to specify the migration name. '
'The --server-name/-s argument will be introduced to specify the server name '
'in the next breaking change release (2.86.0) scheduled for May 2026.')

Copilot uses AI. Check for mistakes.

# Replica command argument changes
register_argument_deprecate('postgres flexible-server replica create', '--replica-name', redirect='--name')
10 changes: 5 additions & 5 deletions src/azure-cli/azure/cli/command_modules/rdbms/_helptext_pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,10 +822,10 @@
short-summary: Create a read replica for a server.
examples:
- name: Create a read replica 'testreplicaserver' for 'testserver' with public or private access in the specified zone and location if available.
text: az postgres flexible-server replica create --replica-name testreplicaserver -g testGroup --source-server testserver --zone 3 --location testLocation
text: az postgres flexible-server replica create --name testreplicaserver -g testGroup --source-server testserver --zone 3 --location testLocation
- name: Create a read replica 'testreplicaserver' with new subnet for 'testserver' with private access.
text: >
az postgres flexible-server replica create --replica-name testreplicaserver -g testGroup \\
az postgres flexible-server replica create --name testreplicaserver -g testGroup \\
--source-server testserver --zone 3 --location testLocation \\
--vnet newVnet --subnet newSubnet \\
--address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24 \\
Expand All @@ -836,13 +836,13 @@
in the specified location if available. Since zone is not passed, it will automatically pick up zone in the \
replica location which is different from source server, if available, else will pick up zone same as source server \
in the replica location if available, else will set the zone as None, i.e. No preference
text: az postgres flexible-server replica create --replica-name testreplicaserver -g testGroup --source-server testserver --location testLocation
text: az postgres flexible-server replica create --name testreplicaserver -g testGroup --source-server testserver --location testLocation
- name: Create a read replica 'testreplicaserver' for 'testserver' with custom --storage-size and --sku.
text: az postgres flexible-server replica create --replica-name testreplicaserver -g testGroup --source-server testserver --sku-name Standard_D4ds_v5 --storage-size 256
text: az postgres flexible-server replica create --name testreplicaserver -g testGroup --source-server testserver --sku-name Standard_D4ds_v5 --storage-size 256
- name: Create a read replica 'testreplicaserver' for 'testserver', where 'testreplicaserver' is in a different resource group 'newTestGroup'. \
Here --resource-group is for the read replica's resource group, and --source-server must be passed as resource ID.
text: >
az postgres flexible-server replica create --replica-name testreplicaserver -g newTestGroup \
az postgres flexible-server replica create --name testreplicaserver -g newTestGroup \
--source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServerName} --location testLocation
"""

Expand Down
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/rdbms/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,8 @@ def _flexible_server_params(command_group):
with self.argument_context('{} flexible-server replica create'.format(command_group)) as c:
c.argument('source_server', arg_type=source_server_arg_type)
c.argument('replica_name', options_list=['--replica-name'],
help='The name of the server to restore to.')
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

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

The help text for the deprecated --replica-name argument is incorrect. It says "The name of the server to restore to." but should say "The name of the read replica." This argument is being deprecated in favor of --name, but its help text should still accurately describe its purpose while it remains available.

Suggested change
help='The name of the server to restore to.')
help='The name of the read replica.')

Copilot uses AI. Check for mistakes.
c.argument('name', options_list=['--name', '-n'],
help='The name of the read replica.')
c.argument('zone', arg_type=zone_arg_type)
c.argument('location', arg_type=get_location_type(self.cli_ctx))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,14 +591,17 @@ def flexible_replica_list_by_server(cmd, client, resource_group_name, server_nam
return client.list_by_server(resource_group_name, server_name)


def flexible_replica_create(cmd, client, resource_group_name, source_server, replica_name, zone=None,
def flexible_replica_create(cmd, client, resource_group_name, source_server, replica_name=None, name=None, zone=None,
location=None, vnet=None, vnet_address_prefix=None, subnet=None,
subnet_address_prefix=None, private_dns_zone_arguments=None, no_wait=False,
byok_identity=None, byok_key=None,
sku_name=None, tier=None,
storage_gb=None, performance_tier=None, yes=False, tags=None):
validate_resource_group(resource_group_name)
replica_name = replica_name.lower()

if replica_name is None and name is None:
raise RequiredArgumentMissingError('the following arguments are required: --name')
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

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

The error message should mention both the new --name and the deprecated --replica-name arguments since both are valid during the transition period. The message currently only mentions --name, which could confuse users who are still using --replica-name. Consider updating to: "One of the following arguments is required: --name, --replica-name"

Suggested change
raise RequiredArgumentMissingError('the following arguments are required: --name')
raise RequiredArgumentMissingError('One of the following arguments is required: --name, --replica-name')

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

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

The logic for handling --name and --replica-name gives priority to --name when both are provided (line 604: replica_name.lower() if name is None else name.lower()). However, there's no warning or error when both arguments are specified simultaneously. This could lead to confusion during the transition period. Consider adding a check to either warn users or raise a MutuallyExclusiveArgumentError when both arguments are provided, to guide users toward using only --name.

Suggested change
raise RequiredArgumentMissingError('the following arguments are required: --name')
raise RequiredArgumentMissingError('the following arguments are required: --name')
if replica_name is not None and name is not None:
raise MutuallyExclusiveArgumentError('usage error: --name and --replica-name cannot be used together. Please use --name.')

Copilot uses AI. Check for mistakes.
replica_name = replica_name.lower() if name is None else name.lower()

if not is_valid_resource_id(source_server):
if _is_resource_name(source_server):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ def _test_flexible_server_mgmt_empty_rg_name_return_error(self, database_engine)
--public-access None'.format(database_engine, random_rg_name, server_name, backup_retention,
sku_name, tier, storage_size, 'dbadmin', version, ha_value))

self.cmd('postgres flexible-server replica create -g "" --replica-name {} --source-server {}'.format(
self.cmd('postgres flexible-server replica create -g "" --name {} --source-server {}'.format(
replica_1_name,
server_name
), expect_failure=True)

self.cmd('postgres flexible-server replica create -g \'\' --replica-name {} --source-server {}'.format(
self.cmd('postgres flexible-server replica create -g \'\' --name {} --source-server {}'.format(
replica_1_name,
server_name
), expect_failure=True)
Expand Down Expand Up @@ -420,7 +420,7 @@ def _test_flexible_server_ssdv2_mgmt(self, database_engine, resource_group):
expect_failure=True)

replica_name = 'rep-ssdv2-' + server_name
self.cmd('{} flexible-server replica create -g {} --replica-name {} --source-server {}'
self.cmd('{} flexible-server replica create -g {} --name {} --source-server {}'
.format(database_engine, resource_group, replica_name, basic_info['id']),
expect_failure=True)

Expand Down Expand Up @@ -739,7 +739,7 @@ def main_tests(geo_redundant_backup):
# create replica 1 with data encryption
replica_1_name = self.create_random_name(SERVER_NAME_PREFIX, SERVER_NAME_MAX_LENGTH)

self.cmd('postgres flexible-server replica create -g {} --replica-name {} --source-server {} --key {} --identity {}'.format(
self.cmd('postgres flexible-server replica create -g {} --name {} --source-server {} --key {} --identity {}'.format(
resource_group,
replica_1_name,
primary_server_name,
Expand Down Expand Up @@ -1284,7 +1284,7 @@ def _test_flexible_server_replica_validator(self, database_engine, resource_grou
JMESPathCheck('storage.autoGrow', source_server_auto_grow)]).get_output_in_json()

# test replica create
self.cmd('{} flexible-server replica create -g {} --replica-name {} --source-server {} --zone 2 {}'
self.cmd('{} flexible-server replica create -g {} --name {} --source-server {} --zone 2 {}'
.format(database_engine, resource_group, replicas[0], result['id'], public_access_arg),
checks=[
JMESPathCheck('name', replicas[0]),
Expand Down Expand Up @@ -1329,7 +1329,7 @@ def _test_flexible_server_replica_mgmt(self, database_engine, resource_group, vn
checks=[JMESPathCheck('replica.role', primary_role)] + master_vnet_check).get_output_in_json()

# test replica create
self.cmd('{} flexible-server replica create -g {} --replica-name {} --source-server {} --zone 2 {} {}'
self.cmd('{} flexible-server replica create -g {} --name {} --source-server {} --zone 2 {} {}'
.format(database_engine, resource_group, replicas[0], result['id'], replica_vnet_args[0], public_access_arg),
checks=[
JMESPathCheck('name', replicas[0]),
Expand Down Expand Up @@ -1366,7 +1366,7 @@ def _test_flexible_server_replica_mgmt(self, database_engine, resource_group, vn
JMESPathCheck('sourceServerResourceId', 'None')])

# test delete master server
self.cmd('{} flexible-server replica create -g {} --replica-name {} --source-server {} {}'
self.cmd('{} flexible-server replica create -g {} --name {} --source-server {} {}'
.format(database_engine, resource_group, replicas[1], result['id'], replica_vnet_args[1]),
checks=[
JMESPathCheck('name', replicas[1]),
Expand All @@ -1382,7 +1382,7 @@ def _test_flexible_server_replica_mgmt(self, database_engine, resource_group, vn

# test virtual-endpoint
if not vnet_enabled:
self.cmd('{} flexible-server replica create -g {} --replica-name {} --source-server {}'
self.cmd('{} flexible-server replica create -g {} --name {} --source-server {}'
.format(database_engine, resource_group, replicas[2], result['id']),
checks=[
JMESPathCheck('name', replicas[2]),
Expand Down Expand Up @@ -2171,7 +2171,7 @@ def _test_flexible_server_upgrade_mgmt(self, database_engine, resource_group, pu
checks=[JMESPathCheck('version', current_version)])

# create replica
self.cmd('{} flexible-server replica create -g {} --replica-name {} --source-server {}'
self.cmd('{} flexible-server replica create -g {} --name {} --source-server {}'
.format(database_engine, resource_group, replica_name, server_name),
checks=[JMESPathCheck('version', current_version)])

Expand Down Expand Up @@ -2283,7 +2283,7 @@ def _test_identity_microsoft_entra_admin_mgmt(self, database_engine, resource_gr
JMESPathCheckExists('userAssignedIdentities."{}"'.format(identity_id[0]))])

# create replica 1
self.cmd('{} flexible-server replica create -g {} --replica-name {} --source-server {}'
self.cmd('{} flexible-server replica create -g {} --name {} --source-server {}'
.format(database_engine, resource_group, replica[0], server))

if database_engine == 'postgres':
Expand Down Expand Up @@ -2338,7 +2338,7 @@ def _test_identity_microsoft_entra_admin_mgmt(self, database_engine, resource_gr
JMESPathCheckExists('userAssignedIdentities."{}"'.format(identity_id[1]))])

# create replica 2
self.cmd('{} flexible-server replica create -g {} --replica-name {} --source-server {}'
self.cmd('{} flexible-server replica create -g {} --name {} --source-server {}'
.format(database_engine, resource_group, replica[1], server))

if database_engine == 'postgres':
Expand Down
Loading