שתף באמצעות


az datamigration

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

Manage Data Migration.

Commands

Name Description Type Status
az datamigration get-assessment

Start assessment on SQL Server instance(s).

Extension GA
az datamigration get-sku-recommendation

Give SKU recommendations for Azure SQL offerings.

Extension GA
az datamigration login-migration

Migrate logins from the source Sql Servers to the target Azure Sql Servers.

Extension GA
az datamigration performance-data-collection

Collect performance data for given SQL Server instance(s).

Extension GA
az datamigration register-integration-runtime

Register Database Migration Service on Integration Runtime.

Extension GA
az datamigration sql-db

Manage database migrations to SQL DB.

Extension GA
az datamigration sql-db cancel

Stop in-progress database migration to SQL DB.

Extension GA
az datamigration sql-db create

Create a new database migration to a given SQL Db. This command can migrate data from the selected source database tables to the target database tables. If the target database have no table existing, please use New-AzDataMigrationSqlServerSchema command to migrate schema objects from source database to target databse. The link of New-AzDataMigrationSqlServerSchema is https://learn.microsoft.com/cli/azure/datamigration?view=azure-cli-latest#az-datamigration-sql-server-schema.

Extension GA
az datamigration sql-db delete

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

Extension GA
az datamigration sql-db show

Retrieve the specified database migration for a given SQL DB.

Extension GA
az datamigration sql-db wait

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

Extension GA
az datamigration sql-managed-instance

Manage database migrations to SQL Managed Instance.

Extension GA
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-server-schema

Migrate schema from the source Sql Servers to the target Azure Sql Servers.

Extension GA
az datamigration sql-service

Manage Database Migration Service.

Extension GA
az datamigration sql-service create

Create Database Migration Service.

Extension GA
az datamigration sql-service delete

Delete Database Migration Service.

Extension GA
az datamigration sql-service delete-node

Delete the integration runtime node.

Extension GA
az datamigration sql-service list

Retrieve all Database Migration Services in the resource group. And Retrieve all Database Migration Services in the subscription.

Extension GA
az datamigration sql-service list-auth-key

Retrieve the List of Authentication Keys for Self Hosted Integration Runtime.

Extension GA
az datamigration sql-service list-integration-runtime-metric

Retrieve the registered Integration Runtine nodes and their monitoring data for a given Database Migration Service.

Extension GA
az datamigration sql-service list-migration

Retrieve the List of database migrations attached to the service.

Extension GA
az datamigration sql-service regenerate-auth-key

Regenerate a new set of Authentication Keys for Self Hosted Integration Runtime.

Extension GA
az datamigration sql-service show

Retrieve the Database Migration Service.

Extension GA
az datamigration sql-service update

Update Database Migration Service.

Extension GA
az datamigration sql-service wait

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

Extension GA
az datamigration sql-vm

Manage database migrations to SQL VM.

Extension GA
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 tde-migration

Migrate TDE certificate from source SQL Server to the target Azure SQL Server.

Extension GA

az datamigration get-assessment

Start assessment on SQL Server instance(s).

az datamigration get-assessment [--config-file-path]
                                [--connection-string]
                                [--output-folder]
                                [--overwrite]

Examples

Run SQL Assessment on given SQL Server using connection string.

az datamigration get-assessment --connection-string "Data Source=LabServer.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" --output-folder "C:\AssessmentOutput" --overwrite

Run SQL Assessment on given SQL Server using assessment config file.

az datamigration get-assessment --config-file-path "C:\Users\user\document\config.json"

Run SQL Assessment on multiple SQL Servers in one call using connection string.

az datamigration get-assessment --connection-string "Data Source=LabServer1.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" "Data Source=LabServer2.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" --output-folder "C:\AssessmentOutput" --overwrite

Optional Parameters

--config-file-path

Path of the ConfigFile.

--connection-string

SQL Server Connection Strings.

--output-folder

Output folder to store assessment report.

--overwrite

Enable this parameter to overwrite the existing assessment report.

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.

az datamigration get-sku-recommendation

Give SKU recommendations for Azure SQL offerings.

az datamigration get-sku-recommendation [--config-file-path]
                                        [--database-allow-list]
                                        [--database-deny-list]
                                        [--display-result]
                                        [--elastic-strategy]
                                        [--end-time]
                                        [--output-folder]
                                        [--overwrite]
                                        [--scaling-factor]
                                        [--start-time]
                                        [--target-percentile]
                                        [--target-platform]
                                        [--target-sql-instance]

Examples

Get SKU recommendation for given SQL Server using command line.

az datamigration get-sku-recommendation --output-folder "C:\PerfCollectionOutput" --database-allow-list AdventureWorks1 AdventureWorks2 --display-result --overwrite

Get SKU recommendation for given SQL Server using assessment config file.

az datamigration get-sku-recommendation --config-file-path "C:\Users\user\document\config.json"

Optional Parameters

--config-file-path

Path of the ConfigFile.

--database-allow-list

Space separated list of names of databases to be allowed for SKU recommendation consideration while excluding all others. Only set one of the following or neither: databaseAllowList, databaseDenyList. Default: null.

--database-deny-list

Space separated list of names of databases to not be considered for SKU recommendation. Only set one of the following or neither: databaseAllowList, databaseDenyList. Default: null.

--display-result

Whether or not to print the SKU recommendation results to the console. Enable this parameter to display result.

Default value: False
--elastic-strategy

Whether or not to use the elastic strategy for SKU recommendations based on resource usage profiling. Enable this parameter to use elastic strategy.

Default value: False
--end-time

UTC end time of performance data points to consider during aggregation, in YYYY-MM-DD HH:MM format. Only used for baseline (non-elastic) strategy. Default: all data points collected will be considered.

--output-folder

Output folder where performance data of the SQL Server is stored. The value here must be the same as the one used in PerfDataCollection.

--overwrite

Whether or not to overwrite any existing SKU recommendation reports. Enable this paramater to overwrite.

Default value: False
--scaling-factor

Scaling (comfort) factor used during SKU recommendation. For example, if it is determined that there is a 4 vCore CPU requirement with a scaling factor of 150%, then the true CPU requirement will be 6 vCores.

Default value: 100
--start-time

UTC start time of performance data points to consider during aggregation, in YYYY-MM-DD HH:MM format. Only used for baseline (non-elastic) strategy. Default: all data points collected will be considered.

--target-percentile

Percentile of data points to be used during aggregation of the performance data. Only used for baseline (non-elastic) strategy.

Default value: 95
--target-platform

Target platform for SKU recommendation: either AzureSqlDatabase, AzureSqlManagedInstance, AzureSqlVirtualMachine, or Any. If Any is selected, then SKU recommendations for all three target platforms will be evaluated, and the best fit will be returned.

Default value: Any
--target-sql-instance

Name of the SQL instance for which SKU should be recommendeded. Default: outputFolder will be scanned for files created by the PerfDataCollection action, and recommendations will be provided for every instance found.

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

Migrate logins from the source Sql Servers to the target Azure Sql Servers.

az datamigration login-migration [--aad-domain-name]
                                 [--config-file-path]
                                 [--csv-file-path]
                                 [--list-of-login]
                                 [--output-folder]
                                 [--src-sql-connection-str]
                                 [--tgt-sql-connection-str]

Examples

Run Migrate logins from the source Sql Servers to the target Azure Sql Servers using Parameters.

az datamigration login-migration --src-sql-connection-str  "data source=servername;user id=userid;password=;initial catalog=master;TrustServerCertificate=True" --tgt-sql-connection-str  "data source=servername;user id=userid;password=;initial catalog=master;TrustServerCertificate=True" --csv-file-path "C:\CSVFile" --list-of-login "loginname1" "loginname2" --output-folder "C:\OutputFolder" --aad-domain-name "AADDomainName"

Run Migrate logins from the source Sql Servers to the target Azure Sql Servers using config file.

az datamigration login-migration --config-file-path "C:\Users\user\document\config.json"

Optional Parameters

--aad-domain-name

Required if Windows logins are included in the list of logins to be migrated.

--config-file-path

Path of the ConfigFile.

--csv-file-path

Location of CSV file of logins. Use only one parameter between this and listOfLogin.

--list-of-login

List of logins in string format. If large number of logins need to be migrated, use CSV file option.

--output-folder

Default: %LocalAppData%/Microsoft/SqlLoginMigrations) Folder where logs will be written.

--src-sql-connection-str

Connection string(s) for the source SQL instance(s), using the formal connection string format.

--tgt-sql-connection-str

Connection string(s) for the target SQL instance(s), using the formal connection string format.

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 performance-data-collection

Collect performance data for given SQL Server instance(s).

az datamigration performance-data-collection [--config-file-path]
                                             [--connection-string]
                                             [--number-of-iteration]
                                             [--output-folder]
                                             [--perf-query-interval]
                                             [--static-query-interval]
                                             [--time]

Examples

Collect performance data of a given SQL Server using connection string.

az datamigration performance-data-collection --connection-string "Data Source=LabServer.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" --output-folder "C:\PerfCollectionOutput" --number-of-iteration 5 --perf-query-interval 10 --static-query-interval 60

Collect performance data of multiple SQL Servers in one call using connection string.

az datamigration performance-data-collection --connection-string "Data Source=LabServer1.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" "Data Source=LabServer2.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" --output-folder "C:\PerfCollectionOutput" --number-of-iteration 5 --perf-query-interval 10 --static-query-interval 60

Collect performance data of a given SQL Server using assessment config file.

az datamigration performance-data-collection --config-file-path "C:\Users\user\document\config.json"

Collect performance data of a given SQL Server by specifying a time limit. If the time limit specified is before the complition of a iteration cycle, the process will end without saving the last cycle performance data.

az datamigration performance-data-collection --connection-string "Data Source=LabServer.database.net;Initial Catalog=master;Integrated Security=False;User Id=User;Password=password" --output-folder "C:\PerfCollectionOutput" --number-of-iteration 5 --perf-query-interval 10 --static-query-interval 60 --time 60

Optional Parameters

--config-file-path

Path of the ConfigFile.

--connection-string

SQL Server Connection Strings.

--number-of-iteration

Number of iterations of performance data collection to perform before persisting to file. For example, with default values, performance data will be persisted every 30 seconds * 20 iterations = 10 minutes. Minimum: 2.

Default value: 20
--output-folder

Output folder to store performance data.

--perf-query-interval

Interval at which to query performance data, in seconds.

Default value: 30
--static-query-interval

Interval at which to query and persist static configuration data, in seconds.

Default value: 3600
--time

Time after which the command execution automatically stops, in seconds. If this parameter is not specified manual intervention will be required to stop the command execution.

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 register-integration-runtime

Register Database Migration Service on Integration Runtime.

az datamigration register-integration-runtime --auth-key
                                              [--installed-ir-path]
                                              [--ir-path]

Examples

Register Sql Migration Service on Self Hosted Integration Runtime.

az datamigration register-integration-runtime --auth-key "IR@00000-0000000-000000-aaaaa-bbbb-cccc"

Install Integration Runtime and register a Sql Migration Service on it.

az datamigration register-integration-runtime --auth-key "IR@00000-0000000-000000-aaaaa-bbbb-cccc" --ir-path "C:\Users\user\Downloads\IntegrationRuntime.msi"

Read the Integration Runtime from given installation location.

az datamigration register-integration-runtime --auth-key "IR@00000-0000000-000000-aaaaa-bbbb-cccc" --installed-ir-path "D:\My Softwares\Microsoft Integration Runtime\5.0"

Required Parameters

--auth-key

AuthKey of SQL Migration Service.

Optional Parameters

--installed-ir-path

Version folder path in the Integration Runtime installed location. This can be provided when IR is installed but the command is failing to read it. Format: "\Microsoft Integration Runtime<Version>".

--ir-path

Path of Integration Runtime MSI.

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

Migrate schema from the source Sql Servers to the target Azure Sql Servers.

az datamigration sql-server-schema [--action {DeploySchema, GenerateScript, MigrateSchema}]
                                   [--config-file-path]
                                   [--input-script-file-path]
                                   [--output-folder]
                                   [--src-sql-connection-str]
                                   [--tgt-sql-connection-str]

Examples

Run Migrate database objects from the source SQL Server to the target Azure SQL Database using Parameters.

az datamigration sql-server-schema --action "MigrateSchema" --src-sql-connection-str "Server=;Initial Catalog=;User ID=;Password=" --tgt-sql-connection-str "Server=;Initial Catalog=;User ID=;Password="

Run Generate TSQL schema script from the source SQL Server using Parameters.

az datamigration sql-server-schema --action "GenerateScript" --src-sql-connection-str "Server=;Initial Catalog=;User ID=;Password=" --tgt-sql-connection-str "Server=;Initial Catalog=;User ID=;Password="  --output-folder "C:\OutputFolder"

Run Deploy TSQL script to the target Azure SQL Database using Parameters.

az datamigration sql-server-schema --action "GenerateScript" --src-sql-connection-str "Server=;Initial Catalog=;User ID=;Password=" --tgt-sql-connection-str "Server=;Initial Catalog=;User ID=;Password="  --input-script-file-path "C:\OutputFolder\script.sql"

Run Migrate database objects from the source SQL Server to the target Azure SQL Database using ConfigFile.

az datamigration sql-server-schema --config-file-path "C:\configfile.json"

Optional Parameters

--action

Select one schema migration action. MigrateSchema is to migrate the database objects to Azure SQL Database target. GenerateScript is to generate an editable TSQL schema script that can be used to run on the target to deploy the objects. DeploySchema is to run the TSQL script generated from -GenerateScript action on the target to deploy the objects.

Accepted values: DeploySchema, GenerateScript, MigrateSchema
--config-file-path

Path of the ConfigFile. Accepted parameter names in configfile.json is Action, sourceConnectionString, targetConnectionString, inputScriptFilePath and outputFolder.

--input-script-file-path

Location of an editable TSQL schema script. Use this parameter only with DeploySchema Action.

--output-folder

Default: %LocalAppData%/Microsoft/SqlSchemaMigration) Folder where logs will be written and the generated TSQL schema script by GenerateScript Action.

--src-sql-connection-str

Connection string for the source SQL instance, using the formal connection string format.

--tgt-sql-connection-str

Connection string for the target SQL instance, using the formal connection string format.

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

Migrate TDE certificate from source SQL Server to the target Azure SQL Server.

az datamigration tde-migration [--database-name]
                               [--network-share-domain]
                               [--network-share-password]
                               [--network-share-path]
                               [--network-share-user-name]
                               [--source-sql-connection-string]
                               [--target-managed-instance-name]
                               [--target-resource-group-name]
                               [--target-subscription-id]

Examples

Migrate TDE certificate from source SQL Server to the target Azure SQL Server.

az datamigration tde-migration --source-sql-connection-string "data source=servername;user id=userid;password=;initial catalog=master;TrustServerCertificate=True" --target-subscription-id "00000000-0000-0000-0000-000000000000" --target-resource-group-name "ResourceGroupName" --target-managed-instance-name "TargetManagedInstanceName" --network-share-path "\NetworkShare\Folder" --network-share-domain "NetworkShare" --network-share-user-name "NetworkShareUserName" --network-share-password "" --database-name "TdeDb_0" "TdeDb_1" "TdeDb_2"

Optional Parameters

--database-name --dbname

Source database name.

--network-share-domain --networkdomain

Network share domain.

--network-share-password --networkpw

Network share password.

--network-share-path --networkpath

Network share path.

--network-share-user-name --networkuser

Network share user name.

--source-sql-connection-string --srcsqlcs

Connection string for the source SQL instance, using the formal connection string format.

--target-managed-instance-name --tgtname

Name of the Azure SQL Server.

--target-resource-group-name --tgtrg

Resource group name of the target Azure SQL server.

--target-subscription-id --tgtsubscription

Subscription Id of the target Azure SQL server.

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.