New-AzDataMigrationSqlServerSchema

Migrate Sql Server Schema from the source Sql Servers to the target Azure Sql Servers.

Syntax

New-AzDataMigrationSqlServerSchema
   -ConfigFilePath <String>
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzDataMigrationSqlServerSchema
   -Action <String>
   -SourceConnectionString <String>
   -TargetConnectionString <String>
   [-InputScriptFilePath <String>]
   [-OutputFolder <String>]
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Migrate Sql Server Schema from the source Sql Servers to the target Azure Sql Servers.

Examples

Example 1: Run Migrate database objects from the source SQL Server to the target Azure SQL Database using Parameters

New-AzDataMigrationSqlServerSchema -Action "MigrateSchema" -SourceConnectionString "Server=;Initial Catalog=;User ID=;Password=" -TargetConnectionString "Server=;Initial Catalog=;User ID=;Password="

Starting schema migration...

Total number of object collected: 35
Total elapsed time: 00:00:08.8905823
DDL triggers: 4
Full text catalogs: 2
Plan guides: 2
Roles: 1
Schemas: 5
Stored procedures: 5
Tables: 10
User defined functions: 4
Users: 2

The number of scripted objects: 55
Progress: 100%
Total elapsed time: 00:00:39.9983180

The number of deployed script batches: 110/110
Progress: 100%
Total elapsed time: 00:00:05.6789103

This command runs Run SqlServerSchema Migrations on given SQL Server using the connection string.

Example 2: Run Generate TSQL schema script from the source SQL Server using Parameters

New-AzDataMigrationSqlServerSchema -Action "GenerateScript" -SourceConnectionString "Server=;Initial Catalog=;User ID=;Password=" -TargetConnectionString "Server=;Initial Catalog=;User ID=;Password=" -OutputFolder "C:\OutputFolder"

Starting schema script generation...

Total number of object collected: 35
Total elapsed time: 00:00:07.3789860
DDL triggers: 4
Full text catalogs: 2
Plan guides: 2
Roles: 1
Schemas: 5
Stored procedures: 5
Tables: 10
User defined functions: 4
Users: 2

The number of scripted objects: 55
Progress: 100%
Total elapsed time: 00:00:40.9745837

This command runs Run Generate TSQL schema script on given SQL Server using the connection string.

Example 3: Run Deploy TSQL script to the target Azure SQL Database using Parameters

New-AzDataMigrationSqlServerSchema -Action "DeploySchema" -SourceConnectionString "Server=;Initial Catalog=;User ID=;Password=" -TargetConnectionString "Server=;Initial Catalog=;User ID=;Password=" -InputScriptFilePath "C:\OutputFolder\script.sql"

Starting schema deployment...

The number of deployed script batches: 110/110
Progress: 100%
Total elapsed time: 00:00:05.7519257

This command runs Deploy TSQL script to the target Azure SQL Database on given SQL Server using the connection string.

Example 4: Run Migrate database objects from the source SQL Server to the target Azure SQL Database using ConfigFile

New-AzDataMigrationSqlServerSchema -ConfigFilePath "C:\configfile.json"

configfile.json example:
{
  "Action": "GenerateScript",
  "sourceConnectionString": "Server=;Initial Catalog=;User ID=;Password=",
  "targetConnectionString": "Server=;Initial Catalog=;User ID=;Password=",
  "inputScriptFilePath": "C:\OutputFolder\script.sql",
  "outputFolder": "C:\OutputFolder\script.sql"
}

Starting schema deployment...

The number of deployed script batches: 110/110
Progress: 100%
Total elapsed time: 00:00:05.7519257

This command runs Run SqlServerSchema Command from the source Sql Servers to the target Azure Sql Servers using config file.

Parameters

-Action

Required. Select one schema migration action. The valid values are: MigrateSchema, GenerateScript, DeploySchema. 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.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ConfigFilePath

Path of the ConfigFile

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputScriptFilePath

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OutputFolder

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SourceConnectionString

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

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-TargetConnectionString

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

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Boolean