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
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 Virtual Machine.
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-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
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the target SQL Virtual Machine.
The name of the target database.
Optional Parameters
Resource Id of the Migration Service.
Do not wait for the long-running operation to finish.
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.
Resource Id of the target resource (SQL VM, SQL Managed Instance or SQL DB).
Name of the source database.
Source location of backups. Expected value: json-string/json-file/@json-file.
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.
Database collation to be used for the target database.
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
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-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
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 Virtual Machine.
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-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
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 Virtual Machine.
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-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
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 Virtual Machine.
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.