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

az datamigration sql-db cancel

Stop in-progress database migration to SQL DB.

az datamigration sql-db create

Create a new database migration to a given SQL DB.

az datamigration sql-db delete

Delete an in-progress or completed database migration to SQL DB.

az datamigration sql-db show

Retrieve the specified database migration for a given SQL DB.

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 cancel

Stop in-progress database migration to SQL DB.

az datamigration sql-db cancel --migration-operation-id
                               --resource-group
                               --sqldb-instance-name
                               --target-db-name
                               [--no-wait]

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

--migration-operation-id

ID tracking migration operation.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--sqldb-instance-name

Name of the target SQL Database Server.

--target-db-name

The name of the target database.

Optional Parameters

--no-wait

Do not wait for the long-running operation to finish.

az datamigration sql-db create

Create a new database migration to a given SQL DB.

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

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--sqldb-instance-name

Name of the target SQL Database Server.

--target-db-name

The name of the target database.

Optional Parameters

--migration-service

Resource Id of the Migration Service.

--no-wait

Do not wait for the long-running operation to finish.

--scope

Resource Id of the target resource (SQL VM, SQL Managed Instance or SQL DB).

--source-database-name

Name of the source database.

--source-sql-connection

Source SQL Server connection details.

--table-list

List of tables to copy.

--target-db-collation

Database collation to be used for the target database.

--target-sql-connection

Target SQL DB connection details.

az datamigration sql-db delete

Delete an in-progress or completed database migration to SQL DB.

az datamigration sql-db delete --resource-group
                               --sqldb-instance-name
                               --target-db-name
                               [--force {false, true}]
                               [--no-wait]
                               [--yes]

Examples

Delete Database Migration resource.

az datamigration sql-db delete --resource-group "testrg" --sqldb-instance-name "sqldbinstance" --target-db-name "db1"

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--sqldb-instance-name

Name of the target SQL Database Server.

--target-db-name

The name of the target database.

Optional Parameters

--force

Optional force delete boolean. If this is provided as true, migration will be deleted even if active.

accepted values: false, true
--no-wait

Do not wait for the long-running operation to finish.

--yes -y

Do not prompt for confirmation.

az datamigration sql-db show

Retrieve the specified database migration for a given SQL DB.

az datamigration sql-db show --resource-group
                             --sqldb-instance-name
                             --target-db-name
                             [--expand]
                             [--migration-operation-id]

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"

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--sqldb-instance-name

Name of the target SQL Database Server.

--target-db-name

The name of the target database.

Optional Parameters

--expand

Complete migration details be included in the response.

--migration-operation-id

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.

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 --resource-group
                             --sqldb-instance-name
                             --target-db-name
                             [--created]
                             [--custom]
                             [--deleted]
                             [--exists]
                             [--expand]
                             [--interval]
                             [--migration-operation-id]
                             [--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

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--sqldb-instance-name

Name of the target SQL Database Server.

--target-db-name

The name of the target database.

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

--exists

Wait until the resource exists.

--expand

Complete migration details be included in the response.

--interval

Polling interval in seconds.

default value: 30
--migration-operation-id

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.

--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.