Skip to content
Merged
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
5 changes: 5 additions & 0 deletions src/azure-cli/azure/cli/command_modules/sql/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,11 @@ def load_arguments(self, _):
help='Name of the new replica.'
' If unspecified, defaults to the source database name.')

c.argument('secondary_type',
options_list=['--secondary-type'],
help='Type of secondary to create.'
' Allowed values include: Geo, Named.')

with self.argument_context('sql db replica set-primary') as c:
c.argument('database_name',
help='Name of the database to fail over.')
Expand Down
7 changes: 6 additions & 1 deletion src/azure-cli/azure/cli/command_modules/sql/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ def _db_dw_create(
dest_db,
no_wait,
sku=None,
secondary_type=None,
**kwargs):
'''
Creates a DB (with any create mode) or DW.
Expand All @@ -817,6 +818,9 @@ def _db_dw_create(
if source_db:
kwargs['source_database_id'] = source_db.id()

if secondary_type:
kwargs['secondary_type'] = secondary_type

# If sku.name is not specified, resolve the requested sku name
# using capabilities.
kwargs['sku'] = _find_db_sku_from_capabilities(
Expand Down Expand Up @@ -984,6 +988,7 @@ def db_create_replica(
partner_server_name,
partner_database_name=None,
partner_resource_group_name=None,
secondary_type=None,
no_wait=False,
**kwargs):
'''
Expand Down Expand Up @@ -1019,13 +1024,13 @@ def db_create_replica(
if kwargs['storage_account_type'] == 'GRS':
_backup_storage_redundancy_specify_geo_warning()

# Replica must have the same database name as the source db
return _db_dw_create(
cmd.cli_ctx,
client,
DatabaseIdentity(cmd.cli_ctx, database_name, server_name, resource_group_name),
DatabaseIdentity(cmd.cli_ctx, partner_database_name, partner_server_name, partner_resource_group_name),
no_wait,
secondary_type=secondary_type,
**kwargs)


Expand Down
Loading