Share via


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

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

--managed-instance-name

Name of the target SQL Managed Instance.

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

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

--managed-instance-name

Name of the target SQL Managed Instance.

--resource-group -g

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

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

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

--managed-instance-name

Name of the target SQL Managed Instance.

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

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

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

--managed-instance-name

Name of the target SQL Managed Instance.

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

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

--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
--managed-instance-name

Name of the target SQL Managed Instance.

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

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