az datamigration sql-db
Note
This reference is part of the datamigration extension for the Azure CLI (version 2.15.0 or higher). The extension will automatically install the first time you run an az datamigration sql-db command. Learn more about extensions.
Manage database migrations to SQL DB.
Commands
Name | Description | Type | Status |
---|---|---|---|
az datamigration sql-db cancel |
Stop in-progress database migration to SQL DB. |
Extension | GA |
az datamigration sql-db create |
Create a new database migration to a given SQL Db. This command can migrate data from the selected source database tables to the target database tables. If the target database have no table existing, please use New-AzDataMigrationSqlServerSchema command to migrate schema objects from source database to target databse. The link of New-AzDataMigrationSqlServerSchema is https://learn.microsoft.com/cli/azure/datamigration?view=azure-cli-latest#az-datamigration-sql-server-schema. |
Extension | GA |
az datamigration sql-db delete |
Delete an in-progress or completed database migration to SQL DB. |
Extension | GA |
az datamigration sql-db show |
Retrieve the specified database migration for a given SQL DB. |
Extension | GA |
az datamigration sql-db wait |
Place the CLI in a waiting state until a condition of the datamigration sql-db is met. |
Extension | GA |
az datamigration sql-db cancel
Stop in-progress database migration to SQL DB.
az datamigration sql-db cancel --migration-operation-id
[--ids]
[--no-wait]
[--resource-group]
[--sqldb-instance-name]
[--subscription]
[--target-db-name]
Examples
Stop ongoing migration for the database.
az datamigration sql-db cancel --migration-operation-id "9a90bb84-e70f-46f7-b0ae-1aef5b3b9f07" --resource-group "testrg" --sqldb-instance-name "sqldbinstance" --target-db-name "db1"
Required Parameters
ID tracking migration operation.
Optional Parameters
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.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the target SQL Database Server.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
The name of the target database.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
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.
az datamigration sql-db create
Create a new database migration to a given SQL Db. This command can migrate data from the selected source database tables to the target database tables. If the target database have no table existing, please use New-AzDataMigrationSqlServerSchema command to migrate schema objects from source database to target databse. The link of New-AzDataMigrationSqlServerSchema is https://learn.microsoft.com/cli/azure/datamigration?view=azure-cli-latest#az-datamigration-sql-server-schema.
az datamigration sql-db create --resource-group
--sqldb-instance-name
--target-db-name
[--migration-service]
[--no-wait]
[--scope]
[--source-database-name]
[--source-sql-connection]
[--table-list]
[--target-db-collation]
[--target-sql-connection]
Examples
Create or Update Database Migration resource with Maximum parameters.
az datamigration sql-db create --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/servers/sqldbinstance" --source-database-name "aaa" --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" --table-list "[Schema1].[TableName1]" "[Schema2].[TableName2]" --target-sql-connection authentication="SqlAuthentication" data-source="sqldbinstance" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" --resource-group "testrg" --sqldb-instance-name "sqldbinstance" --target-db-name "db1"
Create or Update Database Migration resource with Minimum parameters.
az datamigration sql-db create --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/servers/sqldbinstance" --source-database-name "aaa" --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" --target-sql-connection authentication="SqlAuthentication" data-source="sqldbinstance" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" --resource-group "testrg" --sqldb-instance-name "sqldbinstance" --target-db-name "db1"
Required Parameters
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the target SQL Database Server.
The name of the target database.
Optional Parameters
Resource Id of the Migration Service.
Do not wait for the long-running operation to finish.
Resource Id of the target resource (SQL VM, SQL Managed Instance or SQL DB).
Name of the source database.
Source SQL Server connection details.
Usage: --source-sql-connection data-source=XX authentication=XX user-name=XX password=XX encrypt-connection=XX trust-server-certificate=XX
data-source: Data source. authentication: Authentication type. user-name: User name to connect to source SQL. password: Password to connect to source SQL. encrypt-connection: Whether to encrypt connection or not. trust-server-certificate: Whether to trust server certificate or not.
List of tables to copy.
Database collation to be used for the target database.
Target SQL DB connection details.
Usage: --target-sql-connection data-source=XX authentication=XX user-name=XX password=XX encrypt-connection=XX trust-server-certificate=XX
data-source: Data source. authentication: Authentication type. user-name: User name to connect to source SQL. password: Password to connect to source SQL. encrypt-connection: Whether to encrypt connection or not. trust-server-certificate: Whether to trust server certificate or not.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
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.
az datamigration sql-db delete
Delete an in-progress or completed database migration to SQL DB.
az datamigration sql-db delete [--force {false, true}]
[--ids]
[--no-wait]
[--resource-group]
[--sqldb-instance-name]
[--subscription]
[--target-db-name]
[--yes]
Examples
Delete Database Migration resource.
az datamigration sql-db delete --resource-group "testrg" --sqldb-instance-name "sqldbinstance" --target-db-name "db1"
Optional Parameters
Optional force delete boolean. If this is provided as true, migration will be deleted even if active.
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.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the target SQL Database Server.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
The name of the target database.
Do not prompt for confirmation.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
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.
az datamigration sql-db show
Retrieve the specified database migration for a given SQL DB.
az datamigration sql-db show [--expand]
[--ids]
[--migration-operation-id]
[--resource-group]
[--sqldb-instance-name]
[--subscription]
[--target-db-name]
Examples
Get Sql DB database Migration with the expand parameter.
az datamigration sql-db show --expand "MigrationStatusDetails" --resource-group "testrg" --sqldb-instance-name "sqldbinstance" --target-db-name "db1"
Get Sql DB database Migration without the expand parameter.
az datamigration sql-db show --resource-group "testrg" --sqldb-instance-name "sqldbinstance" --target-db-name "db1"
Optional Parameters
Complete migration details be included in the response.
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.
Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the target SQL Database Server.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
The name of the target database.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
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.
az datamigration sql-db wait
Place the CLI in a waiting state until a condition of the datamigration sql-db is met.
az datamigration sql-db wait [--created]
[--custom]
[--deleted]
[--exists]
[--expand]
[--ids]
[--interval]
[--migration-operation-id]
[--resource-group]
[--sqldb-instance-name]
[--subscription]
[--target-db-name]
[--timeout]
[--updated]
Examples
Pause executing next line of CLI script until the datamigration sql-db is successfully created.
az datamigration sql-db wait --resource-group "testrg" --sqldb-instance-name "sqldbinstance" --target-db-name "db1" --created
Pause executing next line of CLI script until the datamigration sql-db is successfully deleted.
az datamigration sql-db wait --resource-group "testrg" --sqldb-instance-name "sqldbinstance" --target-db-name "db1" --deleted
Optional Parameters
Wait until created with 'provisioningState' at 'Succeeded'.
Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].
Wait until deleted.
Wait until the resource exists.
Complete migration details be included in the response.
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.
Polling interval in seconds.
Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the target SQL Database Server.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
The name of the target database.
Maximum wait in seconds.
Wait until updated with provisioningState at 'Succeeded'.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
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.
Azure CLI