Skip to content

Commit c4a0b38

Browse files
author
Maddie Clayton
authored
Merge pull request #5874 from hitenjava/preview
DMS - Add powershell support for migration to Managed Instance.
2 parents 792136f + 657baea commit c4a0b38

File tree

100 files changed

+33168
-5504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+33168
-5504
lines changed

src/ResourceManager/DataMigration/AzureRM.DataMigration.Netcore.psd1

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ CompanyName = 'Microsoft Corporation'
3030
Copyright = 'Microsoft Corporation. All rights reserved.'
3131

3232
# Description of the functionality provided by this module
33-
Description = '[PowerShell .Net Core] Microsoft Azure PowerShell - Data Migration Service cmdlets for Azure Sql'
33+
Description = '[PowerShell .Net Core] Microsoft Azure PowerShell - Database Migration Service cmdlets for Azure Sql'
3434

3535
# Minimum version of the Windows PowerShell engine required by this module
3636
PowerShellVersion = '5.1'
@@ -72,29 +72,37 @@ NestedModules = @('.\Microsoft.Azure.Commands.DataMigration.dll')
7272
FunctionsToExport = @()
7373

7474
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
75-
CmdletsToExport = 'New-AzureRmDataMigrationDatabaseInfo',
76-
'New-AzureRmDataMigrationConnectionInfo',
77-
'New-AzureRmDataMigrationProject',
78-
'Remove-AzureRmDataMigrationProject',
79-
'New-AzureRmDataMigrationSqlServerSqlDbSelectedDB',
80-
'Get-AzureRmDataMigrationProject', 'Get-AzureRmDataMigrationService',
81-
'New-AzureRmDataMigrationService',
82-
'Remove-AzureRmDataMigrationService', 'New-AzureRmDataMigrationTask',
83-
'Get-AzureRmDataMigrationTask', 'Remove-AzureRmDataMigrationTask',
84-
'Start-AzureRmDataMigrationService',
85-
'Stop-AzureRmDataMigrationService', 'Stop-AzureRmDataMigrationTask'
75+
CmdletsToExport =
76+
'New-AzureRmDataMigrationDatabaseInfo',
77+
'New-AzureRmDataMigrationConnectionInfo',
78+
'New-AzureRmDataMigrationProject',
79+
'Remove-AzureRmDataMigrationProject',
80+
'Get-AzureRmDataMigrationProject',
81+
'Get-AzureRmDataMigrationService',
82+
'New-AzureRmDataMigrationService',
83+
'Remove-AzureRmDataMigrationService',
84+
'New-AzureRmDataMigrationTask',
85+
'Get-AzureRmDataMigrationTask',
86+
'Remove-AzureRmDataMigrationTask',
87+
'Start-AzureRmDataMigrationService',
88+
'Stop-AzureRmDataMigrationService',
89+
'Stop-AzureRmDataMigrationTask',
90+
'New-AzureRmDataMigrationSelectedDB',
91+
'New-AzureRmDataMigrationFileShare'
8692

8793
# Variables to export from this module
8894
# VariablesToExport = @()
8995

9096
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
9197
AliasesToExport = 'Get-AzureRmDms', 'Get-AzureRmDmsTask', 'Get-AzureRmDmsProject',
92-
'New-AzureRmDms', 'New-AzureRmDmsConnInfo', 'New-AzureRmDmsDBInfo',
93-
'New-AzureRmDmsSqlServerSqlDbSelectedDB', 'New-AzureRmDmsTask',
94-
'New-AzureRmDmsProject', 'Remove-AzureRmDmsProject',
95-
'Remove-AzureRmDms', 'Remove-AzureRmDmsTask',
96-
'Start-AzureRmDmsService', 'Stop-AzureRmDmsTask',
97-
'Stop-AzureRmDmsService'
98+
'New-AzureRmDms', 'New-AzureRmDmsConnInfo', 'New-AzureRmDmsDBInfo',
99+
'New-AzureRmDmsTask',
100+
'New-AzureRmDmsProject', 'Remove-AzureRmDmsProject',
101+
'Remove-AzureRmDms', 'Remove-AzureRmDmsTask',
102+
'Start-AzureRmDmsService', 'Stop-AzureRmDmsTask',
103+
'Stop-AzureRmDmsService',
104+
'New-AzureRmDmsSelectedDB',
105+
'New-AzureRmDmsFileShare'
98106

99107
# DSC resources to export from this module
100108
# DscResourcesToExport = @()
@@ -124,7 +132,7 @@ PrivateData = @{
124132
# IconUri = ''
125133

126134
# ReleaseNotes of this module
127-
ReleaseNotes = 'Initial Release'
135+
ReleaseNotes = ''
128136

129137
# Prerelease string of this module
130138
# Prerelease = ''

src/ResourceManager/DataMigration/AzureRM.DataMigration.psd1

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 11/14/2017
6+
# Generated on: 04/04/2018
77
#
88

99
@{
@@ -30,7 +30,7 @@ CompanyName = 'Microsoft Corporation'
3030
Copyright = 'Microsoft Corporation. All rights reserved.'
3131

3232
# Description of the functionality provided by this module
33-
Description = 'Microsoft Azure PowerShell - Data Migration Service cmdlets for Azure Sql'
33+
Description = 'Microsoft Azure PowerShell - Database Migration Service cmdlets for Azure Sql'
3434

3535
# Minimum version of the Windows PowerShell engine required by this module
3636
PowerShellVersion = '5.0'
@@ -72,31 +72,37 @@ NestedModules = @('.\Microsoft.Azure.Commands.DataMigration.dll')
7272
FunctionsToExport = @()
7373

7474
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
75-
CmdletsToExport = 'New-AzureRmDataMigrationDatabaseInfo',
76-
'New-AzureRmDataMigrationConnectionInfo',
77-
'New-AzureRmDataMigrationProject',
78-
'Remove-AzureRmDataMigrationProject',
79-
'New-AzureRmDataMigrationSqlServerSqlDbSelectedDB',
80-
'Get-AzureRmDataMigrationProject',
81-
'Get-AzureRmDataMigrationService',
82-
'New-AzureRmDataMigrationService',
83-
'Remove-AzureRmDataMigrationService',
84-
'New-AzureRmDataMigrationTask', 'Get-AzureRmDataMigrationTask',
85-
'Remove-AzureRmDataMigrationTask',
86-
'Start-AzureRmDataMigrationService',
87-
'Stop-AzureRmDataMigrationService', 'Stop-AzureRmDataMigrationTask'
75+
CmdletsToExport =
76+
'New-AzureRmDataMigrationDatabaseInfo',
77+
'New-AzureRmDataMigrationConnectionInfo',
78+
'New-AzureRmDataMigrationProject',
79+
'Remove-AzureRmDataMigrationProject',
80+
'Get-AzureRmDataMigrationProject',
81+
'Get-AzureRmDataMigrationService',
82+
'New-AzureRmDataMigrationService',
83+
'Remove-AzureRmDataMigrationService',
84+
'New-AzureRmDataMigrationTask',
85+
'Get-AzureRmDataMigrationTask',
86+
'Remove-AzureRmDataMigrationTask',
87+
'Start-AzureRmDataMigrationService',
88+
'Stop-AzureRmDataMigrationService',
89+
'Stop-AzureRmDataMigrationTask',
90+
'New-AzureRmDataMigrationSelectedDB',
91+
'New-AzureRmDataMigrationFileShare'
8892

8993
# Variables to export from this module
9094
# VariablesToExport = @()
9195

9296
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
9397
AliasesToExport = 'Get-AzureRmDms', 'Get-AzureRmDmsTask', 'Get-AzureRmDmsProject',
9498
'New-AzureRmDms', 'New-AzureRmDmsConnInfo', 'New-AzureRmDmsDBInfo',
95-
'New-AzureRmDmsSqlServerSqlDbSelectedDB', 'New-AzureRmDmsTask',
99+
'New-AzureRmDmsTask',
96100
'New-AzureRmDmsProject', 'Remove-AzureRmDmsProject',
97101
'Remove-AzureRmDms', 'Remove-AzureRmDmsTask',
98102
'Start-AzureRmDmsService', 'Stop-AzureRmDmsTask',
99-
'Stop-AzureRmDmsService'
103+
'Stop-AzureRmDmsService',
104+
'New-AzureRmDmsSelectedDB',
105+
'New-AzureRmDmsFileShare'
100106

101107
# DSC resources to export from this module
102108
# DscResourcesToExport = @()
@@ -140,4 +146,4 @@ PrivateData = @{
140146
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
141147
# DefaultCommandPrefix = ''
142148

143-
}
149+
}

src/ResourceManager/DataMigration/Changelog.md renamed to src/ResourceManager/DataMigration/ChangeLog.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21-
* Set minimum dependency of module to PowerShell 5.0
21+
* Set minimum dependency of module to PowerShell 5.0
22+
* Add powershell cmdlets for SQL to Azure SQL DB Managed Instance migration scenario.
23+
24+
## Version 0.1.0
25+
* Add powershell cmdlets for creating Azure Database Migration service and projects.
26+
* Add powershell cmdlets for SQL to Azure SQL DB migration scenario.

src/ResourceManager/DataMigration/Commands.DataMigration.Test/Commands.DataMigration.Test.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@
5858
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.5.0-preview\lib\net45\Microsoft.Azure.Management.Authorization.dll</HintPath>
5959
<Private>True</Private>
6060
</Reference>
61-
<Reference Include="Microsoft.Azure.Management.DataMigration, Version=0.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
62-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataMigration.0.1.2-preview\lib\net452\Microsoft.Azure.Management.DataMigration.dll</HintPath>
61+
<Reference Include="Microsoft.Azure.Management.DataMigration, Version=0.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
62+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataMigration.0.3.0-preview\lib\net452\Microsoft.Azure.Management.DataMigration.dll</HintPath>
63+
<Private>True</Private>
6364
</Reference>
6465
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6566
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.20.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>

src/ResourceManager/DataMigration/Commands.DataMigration.Test/DataMigrationAppSettings.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
// --------------------------------------------------------------------------------------------------------------------
2-
// <copyright file="DataMigrationAppSettings.cs" company="Microsoft">
3-
// Copyright (c) Microsoft Corporation.
4-
// </copyright>
5-
// --------------------------------------------------------------------------------------------------------------------
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
614

7-
using Newtonsoft.Json;
8-
using Newtonsoft.Json.Linq;
915
using System;
1016
using System.IO;
17+
using Newtonsoft.Json;
18+
using Newtonsoft.Json.Linq;
1119

1220
namespace Microsoft.Azure.Commands.DataMigration.Test
1321
{
@@ -54,7 +62,7 @@ private void LoadConfigFile()
5462

5563
public string GetValue(string configName)
5664
{
57-
string value = (string) config[configName];
65+
string value = (string)config[configName];
5866

5967
if (string.IsNullOrEmpty(value))
6068
{

src/ResourceManager/DataMigration/Commands.DataMigration.Test/DataMigrationConfig.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
// --------------------------------------------------------------------------------------------------------------------
2-
// <copyright file="DMConfig.cs" company="Microsoft">
3-
// Copyright (c) Microsoft Corporation.
4-
// </copyright>
5-
// --------------------------------------------------------------------------------------------------------------------
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
614

7-
using Microsoft.Azure.Commands.DataMigration.Test;
815
using System;
16+
using Microsoft.Azure.Commands.DataMigration.Test;
917

1018
namespace Microsoft.Azure.Commands
1119
{
@@ -22,7 +30,7 @@ public static bool GetConfigBool(string configName)
2230

2331
try
2432
{
25-
if(bool.TryParse(GetConfigString(configName), out result))
33+
if (bool.TryParse(GetConfigString(configName), out result))
2634
{
2735
// Do nothing here as value can be True/False
2836
}

src/ResourceManager/DataMigration/Commands.DataMigration.Test/ScenarioTests/Common.ps1

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ function Create-DataMigrationService($rg)
8585
}
8686

8787
function Create-ProjectSqlSqlDb($rg, $service)
88+
{
89+
return Create-Project $rg $service SQLDB
90+
}
91+
92+
function Create-ProjectSqlSqlDbMi($rg, $service)
93+
{
94+
return Create-Project $rg $service SQLMI
95+
}
96+
97+
function Create-Project($rg, $service, $targetPlatform)
8898
{
8999
$ProjectName = Get-ProjectName
90100
$db1 = New-ProjectDbInfos
@@ -93,7 +103,7 @@ function Create-ProjectSqlSqlDb($rg, $service)
93103
$sourceConnInfo = New-SourceSqlConnectionInfo
94104
$targetConnInfo = New-TargetSqlConnectionInfo
95105

96-
$project = New-AzureRmDataMigrationProject -ResourceGroupName $rg.ResourceGroupName -ServiceName $service.Name -ProjectName $ProjectName -Location $rg.Location -SourceType SQL -TargetType SQLDB -SourceConnection $sourceConnInfo -TargetConnection $targetConnInfo -DatabaseInfo $dbList
106+
$project = New-AzureRmDataMigrationProject -ResourceGroupName $rg.ResourceGroupName -ServiceName $service.Name -ProjectName $ProjectName -Location $rg.Location -SourceType SQL -TargetType $targetPlatform -SourceConnection $sourceConnInfo -TargetConnection $targetConnInfo -DatabaseInfo $dbList
97107

98108
return $project
99109
}
@@ -121,6 +131,14 @@ function New-TargetSqlConnectionInfo
121131
return $connectioninfo
122132
}
123133

134+
function New-TargetSqlMiConnectionInfo
135+
{
136+
$dataSource = [Microsoft.Azure.Commands.DataMigrationConfig]::GetConfigString("SQLDBMI_TARGET_DATASOURCE")
137+
$connectioninfo = New-AzureRmDmsConnInfo -ServerType SQL -DataSource $dataSource -AuthType SqlAuthentication -TrustServerCertificate:$true
138+
139+
return $connectioninfo
140+
}
141+
124142
function Get-Creds($userName, $password)
125143
{
126144
$secpasswd = ConvertTo-SecureString -String $password -AsPlainText -Force

src/ResourceManager/DataMigration/Commands.DataMigration.Test/ScenarioTests/DataMigrationTestController.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
16+
using System.Collections.Generic;
17+
using System.IO;
18+
using System.Linq;
1519
using Microsoft.Azure.Commands.Common.Authentication;
20+
using Microsoft.Azure.Commands.DataMigration.Test;
1621
using Microsoft.Azure.Management.Authorization;
1722
using Microsoft.Azure.Management.DataMigration;
1823
using Microsoft.Azure.Management.Resources;
@@ -21,11 +26,6 @@
2126
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
2227
using Microsoft.WindowsAzure.Commands.ScenarioTest;
2328
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
24-
using System;
25-
using System.Collections.Generic;
26-
using System.IO;
27-
using System.Linq;
28-
using Microsoft.Azure.Commands.DataMigration.Test;
2929

3030
namespace Microsoft.Azure.Commands.ScenarioTest.DmsTest
3131
{
@@ -48,7 +48,7 @@ public DataMigrationTestController()
4848
{
4949
helper = new EnvironmentSetupHelper();
5050
DataMigrationAppSettings settings = DataMigrationAppSettings.Instance;
51-
if(settings == null)
51+
if (settings == null)
5252
{
5353
throw new ArgumentException("DMS Config File Appsettings.json not loaded properly");
5454
}
@@ -145,7 +145,7 @@ private void SetupManagementClients(MockContext context)
145145
private DataMigrationServiceClient GetDmsClient(MockContext context)
146146
{
147147
DataMigrationServiceClient client = context.GetServiceClient<DataMigrationServiceClient>(Rest.ClientRuntime.Azure.TestFramework.TestEnvironmentFactory.GetTestEnvironment());
148-
148+
149149
client.LongRunningOperationRetryTimeout = DefaultTimeOut;
150150

151151
return client;
@@ -173,6 +173,6 @@ private int DefaultTimeOut
173173
return defaultTimeOut;
174174
}
175175
}
176-
176+
177177
}
178178
}

0 commit comments

Comments
 (0)