az datamigration sql-managed-instance
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-managed-instance command. Learn more about extensions.
Manage database migrations to SQL Managed Instance.
Commands
Name | Description | Type | Status |
---|---|---|---|
az datamigration sql-managed-instance cancel |
Stop in-progress database migration to SQL Managed Instance. |
Extension | GA |
az datamigration sql-managed-instance create |
Create a new database migration to a given SQL Managed Instance. |
Extension | GA |
az datamigration sql-managed-instance cutover |
Initiate cutover for in-progress online database migration to SQL Managed Instance. |
Extension | GA |
az datamigration sql-managed-instance show |
Retrieve the specified database migration for a given SQL Managed Instance. |
Extension | GA |
az datamigration sql-managed-instance wait |
Place the CLI in a waiting state until a condition of the datamigration sql-managed-instance is met. |
Extension | GA |
az datamigration sql-managed-instance cancel
Stop in-progress database migration to SQL Managed Instance.
az datamigration sql-managed-instance cancel --migration-operation-id
[--ids]
[--managed-instance-name]
[--no-wait]
[--resource-group]
[--subscription]
[--target-db-name]
Examples
Stop ongoing migration for the database.
az datamigration sql-managed-instance cancel --managed-instance-name "managedInstance1" --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" --resource-group "testrg" --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.
Name of the target SQL Managed Instance.
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 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-managed-instance create
Create a new database migration to a given SQL Managed Instance.
az datamigration sql-managed-instance create --managed-instance-name
--resource-group
--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-managed-instance create --managed-instance-name "managedInstance1" --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.Sql/managedInstances/instance" --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" --target-db-name "db1"
Create or Update Database Migration resource with Azure Blob storage as source for backup files.
az datamigration sql-managed-instance create --managed-instance-name "managedInstance1" --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.Sql/managedInstances/instance" --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" --target-db-name "db1"
Required Parameters
Name of the target SQL Managed Instance.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
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-managed-instance cutover
Initiate cutover for in-progress online database migration to SQL Managed Instance.
az datamigration sql-managed-instance cutover --migration-operation-id
[--ids]
[--managed-instance-name]
[--no-wait]
[--resource-group]
[--subscription]
[--target-db-name]
Examples
Cutover online migration operation for the database.
az datamigration sql-managed-instance cutover --managed-instance-name "managedInstance1" --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" --resource-group "testrg" --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.
Name of the target SQL Managed Instance.
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 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-managed-instance show
Retrieve the specified database migration for a given SQL Managed Instance.
az datamigration sql-managed-instance show [--expand]
[--ids]
[--managed-instance-name]
[--migration-operation-id]
[--resource-group]
[--subscription]
[--target-db-name]
Examples
Get Sql MI database Migration with the expand parameter.
az datamigration sql-managed-instance show --expand "MigrationStatusDetails" --managed-instance-name "managedInstance1" --resource-group "testrg" --target-db-name "db1"
Get Sql MI database Migration without the expand parameter.
az datamigration sql-managed-instance show --managed-instance-name "managedInstance1" --resource-group "testrg" --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.
Name of the target SQL Managed Instance.
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 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-managed-instance wait
Place the CLI in a waiting state until a condition of the datamigration sql-managed-instance is met.
az datamigration sql-managed-instance wait [--created]
[--custom]
[--deleted]
[--exists]
[--expand]
[--ids]
[--interval]
[--managed-instance-name]
[--migration-operation-id]
[--resource-group]
[--subscription]
[--target-db-name]
[--timeout]
[--updated]
Examples
Pause executing next line of CLI script until the datamigration sql-managed-instance is successfully created.
az datamigration sql-managed-instance wait --managed-instance-name "managedInstance1" --resource-group "testrg" --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.
Name of the target SQL Managed Instance.
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 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.