Share via


az datamigration sql-vm

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-vm command. Learn more about extensions.

Manage database migrations to SQL VM.

Commands

Name Description Type Status
az datamigration sql-vm cancel

Stop in-progress database migration to SQL VM.

Extension GA
az datamigration sql-vm create

Create a new database migration to a given SQL VM.

Extension GA
az datamigration sql-vm cutover

Initiate cutover for in-progress online database migration to SQL VM.

Extension GA
az datamigration sql-vm show

Retrieve the specified database migration for a given SQL VM.

Extension GA
az datamigration sql-vm wait

Place the CLI in a waiting state until a condition of the datamigration sql-vm is met.

Extension GA

az datamigration sql-vm cancel

Stop in-progress database migration to SQL VM.

az datamigration sql-vm cancel --migration-operation-id
                               [--ids]
                               [--no-wait]
                               [--resource-group]
                               [--sql-vm-name]
                               [--subscription]
                               [--target-db-name]

Examples

Stop ongoing migration for the database.

az datamigration sql-vm cancel --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" --resource-group "testrg" --sql-vm-name "testvm" --target-db-name "db1"

Required Parameters

--migration-operation-id

ID tracking migration operation.

Optional Parameters

--ids

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.

--no-wait

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

Default value: False
--resource-group -g

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

--sql-vm-name

Name of the target SQL Virtual Machine.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--target-db-name

The name of the target database.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az datamigration sql-vm create

Create a new database migration to a given SQL VM.

az datamigration sql-vm create --resource-group
                               --sql-vm-name
                               --target-db-name
                               [--migration-service]
                               [--no-wait]
                               [--offline-configuration]
                               [--scope]
                               [--source-database-name]
                               [--source-location]
                               [--source-sql-connection]
                               [--target-db-collation]
                               [--target-location]

Examples

Create or Update Database Migration resource with fileshare as source for backup files.

az datamigration sql-vm create --source-location '{\"fileShare\":{\"path\":\"\\\\SharedBackup\\user\",\"password\":\"placeholder\",\"username\":\"Server\\name\"}}' --target-location account-key="abcd" storage-account-resource-id="account.database.windows.net" --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" --offline-configuration last-backup-name="last_backup_file_name" offline=true --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm" --source-database-name "aaa" --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" --resource-group "testrg" --sql-vm-name "testvm" --target-db-name "db1"

Create or Update Database Migration resource with Azure Blob storage as source for backup files.

az datamigration sql-vm create --source-location '{\"AzureBlob\":{\"storageAccountResourceId\":\"/subscriptions/1111-2222-3333-4444/resourceGroups/RG/prooviders/Microsoft.Storage/storageAccounts/MyStorage\",\"accountKey\":\"======AccountKey====\",\"blobContainerName\":\"ContainerName-X\"}}' --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" --offline-configuration last-backup-name="last_backup_file_name" offline=true --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm" --source-database-name "aaa" --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" --resource-group "testrg" --sql-vm-name "testvm" --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>.

--sql-vm-name

Name of the target SQL Virtual Machine.

--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.

Default value: False
--offline-configuration

Offline configuration.

Usage: --offline-configuration offline=XX last-backup-name=XX

offline: Offline migration last-backup-name: Last backup name for offline migration. This is optional for migrations from file share. If it is not provided, then the service will determine the last backup file name based on latest backup files present in file share.

--scope

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

--source-database-name

Name of the source database.

--source-location

Source location of backups. Expected value: json-string/json-file/@json-file.

--source-sql-connection

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.

--target-db-collation

Database collation to be used for the target database.

--target-location

Target location for copying backups.

Usage: --target-location storage-account-resource-id=XX account-key=XX

storage-account-resource-id: Resource Id of the storage account copying backups. account-key: Storage Account Key.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az datamigration sql-vm cutover

Initiate cutover for in-progress online database migration to SQL VM.

az datamigration sql-vm cutover --migration-operation-id
                                [--ids]
                                [--no-wait]
                                [--resource-group]
                                [--sql-vm-name]
                                [--subscription]
                                [--target-db-name]

Examples

Cutover online migration operation for the database.

az datamigration sql-vm cutover --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" --resource-group "testrg" --sql-vm-name "testvm" --target-db-name "db1"

Required Parameters

--migration-operation-id

ID tracking migration operation.

Optional Parameters

--ids

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.

--no-wait

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

Default value: False
--resource-group -g

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

--sql-vm-name

Name of the target SQL Virtual Machine.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--target-db-name

The name of the target database.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az datamigration sql-vm show

Retrieve the specified database migration for a given SQL VM.

az datamigration sql-vm show [--expand]
                             [--ids]
                             [--migration-operation-id]
                             [--resource-group]
                             [--sql-vm-name]
                             [--subscription]
                             [--target-db-name]

Examples

Get Sql VM database Migration with the expand parameter.

az datamigration sql-vm show --expand "MigrationStatusDetails" --resource-group "testrg" --sql-vm-name "testvm" --target-db-name "db1"

Get Sql VM database Migration without the expand parameter.

az datamigration sql-vm show --resource-group "testrg" --sql-vm-name "testvm" --target-db-name "db1"

Optional Parameters

--expand

Complete migration details be included in the response.

--ids

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.

--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.

--resource-group -g

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

--sql-vm-name

Name of the target SQL Virtual Machine.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--target-db-name

The name of the target database.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az datamigration sql-vm wait

Place the CLI in a waiting state until a condition of the datamigration sql-vm is met.

az datamigration sql-vm wait [--created]
                             [--custom]
                             [--deleted]
                             [--exists]
                             [--expand]
                             [--ids]
                             [--interval]
                             [--migration-operation-id]
                             [--resource-group]
                             [--sql-vm-name]
                             [--subscription]
                             [--target-db-name]
                             [--timeout]
                             [--updated]

Examples

Pause executing next line of CLI script until the datamigration sql-vm is successfully created.

az datamigration sql-vm wait --resource-group "testrg" --sql-vm-name "testvm" --target-db-name "db1" --created

Optional Parameters

--created

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

Default value: False
--custom

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

--deleted

Wait until deleted.

Default value: False
--exists

Wait until the resource exists.

Default value: False
--expand

Complete migration details be included in the response.

--ids

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.

--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.

--resource-group -g

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

--sql-vm-name

Name of the target SQL Virtual Machine.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--target-db-name

The name of the target database.

--timeout

Maximum wait in seconds.

Default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.