az sql db replica
Manage replication between databases.
Commands
Name | Description | Type | Status |
---|---|---|---|
az sql db replica create |
Create a database as a readable secondary replica of an existing database. |
Core | GA |
az sql db replica delete-link |
Permanently stop data replication between two database replicas. |
Core | GA |
az sql db replica list-links |
List the replicas of a database and their replication status. |
Core | GA |
az sql db replica set-primary |
Set the primary replica database by failing over from the current primary replica database. |
Core | GA |
az sql db replica create
Create a database as a readable secondary replica of an existing database.
A full list of performance level options can be seen by executing az sql db list-editions -a -o table -l LOCATION
. The secondary database must have the same edition as the primary database.
az sql db replica create --name
--partner-server
--resource-group
--server
[--assign-identity {false, true}]
[--auto-pause-delay]
[--availability-zone]
[--backup-storage-redundancy --bsr]
[--capacity]
[--compute-model {Provisioned, Serverless}]
[--elastic-pool]
[--encryption-protector]
[--encryption-protector-auto-rotation --epauto {false, true}]
[--family]
[--federated-client-id]
[--ha-replicas --read-replicas]
[--keys]
[--license-type {BasePrice, LicenseIncluded}]
[--min-capacity]
[--no-wait]
[--partner-database]
[--partner-resource-group]
[--partner-sub-id]
[--preferred-enclave-type {Default, VBS}]
[--read-scale {Disabled, Enabled}]
[--secondary-type]
[--service-level-objective --service-objective]
[--tags]
[--umi --user-assigned-identity-id]
[--zone-redundant {false, true}]
Examples
Create a database with performance level S0 as a secondary replica of an existing Standard database.
az sql db replica create -g mygroup -s myserver -n originalDb --partner-server newDb --service-objective S0
Create a database with GeneralPurpose edition, Gen4 hardware, and 1 vcore as a secondary replica of an existing GeneralPurpose database
az sql db replica create -g mygroup -s myserver -n originalDb --partner-server newDb -f Gen4 -c 1
Create a database with with zone redundant backup storage as a secondary replica of an existing database.
az sql db replica create -g mygroup -s myserver -n originalDb --partner-server newDb --backup-storage-redundancy Zone
Required Parameters
Name of the Azure SQL Database.
Name of the server to create the new replica in.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL Server. You can configure the default using az configure --defaults sql-server=<name>
.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Assign identity for database.
Property | Value |
---|---|
Accepted values: | false, true |
Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled.
Property | Value |
---|---|
Parameter group: | Serverless offering Arguments |
Availability zone.
Backup storage redundancy used to store backups. Allowed values include: Local, Zone, Geo, GeoZone.
The capacity component of the sku in integer number of DTUs or vcores.
Property | Value |
---|---|
Parameter group: | Performance Level (components) Arguments |
The compute model of the database.
Property | Value |
---|---|
Parameter group: | Serverless offering Arguments |
Accepted values: | Provisioned, Serverless |
The name or resource id of the elastic pool to create the database in.
Property | Value |
---|---|
Parameter group: | Performance Level Arguments |
Specifies the Azure key vault key to be used as database encryption protector key.
Specifies the database encryption protector key auto rotation flag. Can be either true, false or null.
Property | Value |
---|---|
Accepted values: | false, true |
The compute generation component of the sku (for vcore skus only). Allowed values include: Gen4, Gen5.
Property | Value |
---|---|
Parameter group: | Performance Level (components) Arguments |
The federated client id for the SQL Database. It is used for cross tenant CMK scenario.
The number of high availability replicas to provision for the database. Only settable for Hyperscale edition.
The list of AKV keys for the SQL Database.
The license type to apply for this database.LicenseIncluded
if you need a license, or BasePrice
if you have a license and are eligible for the Azure HybridBenefit.
Property | Value |
---|---|
Accepted values: | BasePrice, LicenseIncluded |
Minimal capacity that database will always have allocated, if not paused.
Property | Value |
---|---|
Parameter group: | Serverless offering Arguments |
Do not wait for the long-running operation to finish.
Property | Value |
---|---|
Default value: | False |
Name of the new replica. If unspecified, defaults to the source database name.
Name of the resource group to create the new replica in. If unspecified, defaults to the origin resource group.
Subscription id to create the new replica in. If unspecified, defaults to the origin subscription id.
Specifies type of enclave for this resource.
Property | Value |
---|---|
Accepted values: | Default, VBS |
If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases.
Property | Value |
---|---|
Accepted values: | Disabled, Enabled |
Type of secondary to create. Allowed values include: Geo, Named.
The service objective for the new database. For example: Basic, S0, P1, GP_Gen4_1, GP_S_Gen5_8, BC_Gen5_2, HS_Gen5_32.
Property | Value |
---|---|
Parameter group: | Performance Level Arguments |
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
The list of user assigned identity for the SQL Database.
Specifies whether to enable zone redundancy. Default is true if no value is specified.
Property | Value |
---|---|
Accepted values: | false, true |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az sql db replica delete-link
Permanently stop data replication between two database replicas.
az sql db replica delete-link --partner-server
[--ids]
[--name]
[--partner-resource-group]
[--resource-group]
[--server]
[--subscription]
[--yes]
Required Parameters
Name of the server that the other replica is in.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of the Azure SQL Database.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of the resource group that the other replica is in. If unspecified, defaults to the first database's resource group.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of the Azure SQL Server. You can configure the default using az configure --defaults sql-server=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Do not prompt for confirmation.
Property | Value |
---|---|
Default value: | False |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az sql db replica list-links
List the replicas of a database and their replication status.
az sql db replica list-links [--ids]
[--name]
[--resource-group]
[--server]
[--subscription]
Examples
List the replicas of a database and their replication status. (autogenerated)
az sql db replica list-links --name MyAzureSQLDatabase --resource-group MyResourceGroup --server myserver
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of the Azure SQL Database.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of the Azure SQL Server. You can configure the default using az configure --defaults sql-server=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az sql db replica set-primary
Set the primary replica database by failing over from the current primary replica database.
az sql db replica set-primary [--allow-data-loss]
[--ids]
[--name]
[--resource-group]
[--server]
[--subscription]
Examples
Set the primary replica database by failing over from the current primary replica database. (autogenerated)
az sql db replica set-primary --allow-data-loss --name MyDatabase --resource-group MyResourceGroup --server myserver --subscription MySubscription
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
If specified, the failover operation will allow data loss.
Property | Value |
---|---|
Default value: | False |
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of the database to fail over.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of the resource group containing the secondary replica that will become the new primary.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of the server containing the secondary replica that will become the new primary. You can configure the default using az configure --defaults sql-server=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |