Skip to content

Commit 55f0be8

Browse files
VeryEarlyazurepowershell
andauthored
GA Az.Migrate (#14265)
* Move Migrate to master * Az.Migrate OOB release Co-authored-by: azurepowershell <[email protected]>
1 parent 446db11 commit 55f0be8

File tree

168 files changed

+2433
-1250
lines changed

Some content is hidden

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

168 files changed

+2433
-1250
lines changed

src/Migrate/Az.Migrate.psd1

Lines changed: 141 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -3,135 +3,150 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 1/13/2021
6+
# Generated on: 2/19/2021
77
#
88

99
@{
1010

11-
# Script module or binary module file associated with this manifest.
12-
RootModule = './Az.Migrate.psm1'
13-
14-
# Version number of this module.
15-
ModuleVersion = '0.2.0'
16-
17-
# Supported PSEditions
18-
CompatiblePSEditions = 'Core', 'Desktop'
19-
20-
# ID used to uniquely identify this module
21-
GUID = 'c638312b-9fd1-4611-a5cc-11a8caa5b698'
22-
23-
# Author of this module
24-
Author = 'Microsoft Corporation'
25-
26-
# Company or vendor of this module
27-
CompanyName = 'Microsoft Corporation'
28-
29-
# Copyright statement for this module
30-
Copyright = 'Microsoft Corporation. All rights reserved.'
31-
32-
# Description of the functionality provided by this module
33-
Description = 'Microsoft Azure PowerShell: Migrate cmdlets'
34-
35-
# Minimum version of the PowerShell engine required by this module
36-
PowerShellVersion = '5.1'
37-
38-
# Name of the PowerShell host required by this module
39-
# PowerShellHostName = ''
40-
41-
# Minimum version of the PowerShell host required by this module
42-
# PowerShellHostVersion = ''
43-
44-
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45-
DotNetFrameworkVersion = '4.7.2'
46-
47-
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48-
# ClrVersion = ''
49-
50-
# Processor architecture (None, X86, Amd64) required by this module
51-
# ProcessorArchitecture = ''
52-
53-
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.2.5'; })
55-
56-
# Assemblies that must be loaded prior to importing this module
57-
RequiredAssemblies = './bin/Az.Migrate.private.dll'
58-
59-
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60-
# ScriptsToProcess = @()
61-
62-
# Type files (.ps1xml) to be loaded when importing this module
63-
# TypesToProcess = @()
64-
65-
# Format files (.ps1xml) to be loaded when importing this module
66-
FormatsToProcess = './Az.Migrate.format.ps1xml'
67-
68-
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
69-
# NestedModules = @()
70-
71-
# Functions 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 functions to export.
72-
FunctionsToExport = 'Get-AzMigrateDiscoveredServer', 'Get-AzMigrateJob', 'Get-AzMigrateProject', 'Get-AzMigrateReplicationFabric', 'Get-AzMigrateReplicationPolicy', 'Get-AzMigrateReplicationProtectionContainer', 'Get-AzMigrateReplicationProtectionContainerMapping', 'Get-AzMigrateReplicationRecoveryServicesProvider', 'Get-AzMigrateRunAsAccount', 'Get-AzMigrateServerReplication', 'Get-AzMigrateSite', 'Get-AzMigrateSolution', 'New-AzMigrateDiskMapping', 'New-AzMigrateNicMapping', 'New-AzMigrateProject', 'New-AzMigrateReplicationPolicy', 'New-AzMigrateReplicationProtectionContainerMapping', 'New-AzMigrateServerReplication', 'Register-AzMigrateProjectTool', 'Remove-AzMigrateProject', 'Remove-AzMigrateServerReplication', 'Restart-AzMigrateServerReplication', 'Set-AzMigrateServerReplication', 'Start-AzMigrateServerMigration', 'Start-AzMigrateTestMigration', 'Start-AzMigrateTestMigrationCleanup'
73-
74-
# 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 = @()
76-
77-
# Variables to export from this module
78-
# VariablesToExport = @()
79-
80-
# 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.
81-
AliasesToExport = '*'
82-
83-
# DSC resources to export from this module
84-
# DscResourcesToExport = @()
85-
86-
# List of all modules packaged with this module
87-
# ModuleList = @()
88-
89-
# List of all files packaged with this module
90-
# FileList = @()
91-
92-
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
93-
PrivateData = @{
94-
95-
PSData = @{
96-
97-
# Tags applied to this module. These help with module discovery in online galleries.
98-
Tags = 'Azure','ResourceManager','ARM','PSModule','Migrate'
99-
100-
# A URL to the license for this module.
101-
LicenseUri = 'https://aka.ms/azps-license'
102-
103-
# A URL to the main website for this project.
104-
ProjectUri = 'https://github.com/Azure/azure-powershell'
105-
106-
# A URL to an icon representing this module.
107-
# IconUri = ''
108-
109-
# ReleaseNotes of this module
110-
ReleaseNotes = '* Bug fixed in update replication migration item to pass all properties (changed/unchanged) to service, and not just the changed ones.
111-
* Bug fixed in enable migrate to pick correct run as account id for VMware Cbt provider.
112-
* Added new parameter (MachineName) in get replication migration item, to get replication migration item by friendly name.
113-
* Bug fixed in enable migrate to stop passing Target Boot Diagnostic Storage Account if it is in a different subscription id than the target VM.
114-
* Fix to in online URLs of existing code doc.'
115-
116-
117-
# Prerelease string of this module
118-
# Prerelease = ''
119-
120-
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
121-
# RequireLicenseAcceptance = $false
122-
123-
# External dependent modules of this module
124-
# ExternalModuleDependencies = @()
125-
126-
} # End of PSData hashtable
127-
128-
} # End of PrivateData hashtable
129-
130-
# HelpInfo URI of this module
131-
# HelpInfoURI = ''
132-
133-
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
134-
# DefaultCommandPrefix = ''
135-
11+
# Script module or binary module file associated with this manifest.
12+
RootModule = './Az.Migrate.psm1'
13+
14+
# Version number of this module.
15+
ModuleVersion = '1.0.0'
16+
17+
# Supported PSEditions
18+
CompatiblePSEditions = 'Core', 'Desktop'
19+
20+
# ID used to uniquely identify this module
21+
GUID = 'c638312b-9fd1-4611-a5cc-11a8caa5b698'
22+
23+
# Author of this module
24+
Author = 'Microsoft Corporation'
25+
26+
# Company or vendor of this module
27+
CompanyName = 'Microsoft Corporation'
28+
29+
# Copyright statement for this module
30+
Copyright = 'Microsoft Corporation. All rights reserved.'
31+
32+
# Description of the functionality provided by this module
33+
Description = 'Microsoft Azure PowerShell: Migrate cmdlets'
34+
35+
# Minimum version of the PowerShell engine required by this module
36+
PowerShellVersion = '5.1'
37+
38+
# Name of the PowerShell host required by this module
39+
# PowerShellHostName = ''
40+
41+
# Minimum version of the PowerShell host required by this module
42+
# PowerShellHostVersion = ''
43+
44+
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45+
DotNetFrameworkVersion = '4.7.2'
46+
47+
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48+
# CLRVersion = ''
49+
50+
# Processor architecture (None, X86, Amd64) required by this module
51+
# ProcessorArchitecture = ''
52+
53+
# Modules that must be imported into the global environment prior to importing this module
54+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.2.5'; })
55+
56+
# Assemblies that must be loaded prior to importing this module
57+
RequiredAssemblies = './bin/Az.Migrate.private.dll'
58+
59+
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60+
# ScriptsToProcess = @()
61+
62+
# Type files (.ps1xml) to be loaded when importing this module
63+
# TypesToProcess = @()
64+
65+
# Format files (.ps1xml) to be loaded when importing this module
66+
FormatsToProcess = './Az.Migrate.format.ps1xml'
67+
68+
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
69+
# NestedModules = @()
70+
71+
# Functions 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 functions to export.
72+
FunctionsToExport = 'Get-AzMigrateDiscoveredServer', 'Get-AzMigrateJob',
73+
'Get-AzMigrateProject', 'Get-AzMigrateReplicationFabric',
74+
'Get-AzMigrateReplicationPolicy',
75+
'Get-AzMigrateReplicationProtectionContainer',
76+
'Get-AzMigrateReplicationProtectionContainerMapping',
77+
'Get-AzMigrateReplicationRecoveryServicesProvider',
78+
'Get-AzMigrateRunAsAccount', 'Get-AzMigrateServerReplication',
79+
'Get-AzMigrateSite', 'Get-AzMigrateSolution',
80+
'Initialize-AzMigrateReplicationInfrastructure',
81+
'New-AzMigrateDiskMapping', 'New-AzMigrateNicMapping',
82+
'New-AzMigrateProject', 'New-AzMigrateReplicationPolicy',
83+
'New-AzMigrateReplicationProtectionContainerMapping',
84+
'New-AzMigrateServerReplication', 'Register-AzMigrateProjectTool',
85+
'Remove-AzMigrateProject', 'Remove-AzMigrateServerReplication',
86+
'Restart-AzMigrateServerReplication',
87+
'Set-AzMigrateServerReplication', 'Start-AzMigrateServerMigration',
88+
'Start-AzMigrateTestMigration',
89+
'Start-AzMigrateTestMigrationCleanup'
90+
91+
# 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.
92+
CmdletsToExport = @()
93+
94+
# Variables to export from this module
95+
# VariablesToExport = @()
96+
97+
# 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.
98+
AliasesToExport = '*'
99+
100+
# DSC resources to export from this module
101+
# DscResourcesToExport = @()
102+
103+
# List of all modules packaged with this module
104+
# ModuleList = @()
105+
106+
# List of all files packaged with this module
107+
# FileList = @()
108+
109+
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
110+
PrivateData = @{
111+
112+
PSData = @{
113+
114+
# Tags applied to this module. These help with module discovery in online galleries.
115+
Tags = 'Azure','ResourceManager','ARM','PSModule','Migrate'
116+
117+
# A URL to the license for this module.
118+
LicenseUri = 'https://aka.ms/azps-license'
119+
120+
# A URL to the main website for this project.
121+
ProjectUri = 'https://github.com/Azure/azure-powershell'
122+
123+
# A URL to an icon representing this module.
124+
# IconUri = ''
125+
126+
# ReleaseNotes of this module
127+
ReleaseNotes = '* Az.Migrate GA
128+
* Incorporated Initialize-AzMigrateReplicationInfrastructure as a cmdlet in the Az.Migrate module, from the external script that is run currently today.
129+
* Made some parameters of New-AzMigrateServerReplication, New-AzMigrateDiskMapping case insensitive.
130+
* Added support for scale appliance change, to handle new V3 keys.'
131+
132+
# Prerelease string of this module
133+
# Prerelease = ''
134+
135+
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
136+
# RequireLicenseAcceptance = $false
137+
138+
# External dependent modules of this module
139+
# ExternalModuleDependencies = @()
140+
141+
} # End of PSData hashtable
142+
143+
} # End of PrivateData hashtable
144+
145+
# HelpInfo URI of this module
146+
# HelpInfoURI = ''
147+
148+
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
149+
# DefaultCommandPrefix = ''
150+
136151
}
137152

src/Migrate/Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
22+
## Version 1.0.0
23+
* Az.Migrate GA
24+
* Incorporated Initialize-AzMigrateReplicationInfrastructure as a cmdlet in the Az.Migrate module, from the external script that is run currently today.
25+
* Made some parameters of New-AzMigrateServerReplication, New-AzMigrateDiskMapping case insensitive.
26+
* Added support for scale appliance change, to handle new V3 keys.
27+
2128
## Version 0.2.0
2229
* Bug fixed in update replication migration item to pass all properties (changed/unchanged) to service, and not just the changed ones.
2330
* Bug fixed in enable migrate to pick correct run as account id for VMware Cbt provider.

src/Migrate/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
[assembly: ComVisible(false)]
2525
[assembly: CLSCompliant(false)]
2626
[assembly: Guid("49de559e-8965-4e80-ba75-d2f2266a0abd")]
27-
[assembly: AssemblyVersion("0.2.0")]
28-
[assembly: AssemblyFileVersion("0.2.0")]
27+
[assembly: AssemblyVersion("1.0.0")]
28+
[assembly: AssemblyFileVersion("1.0.0")]

src/Migrate/custom/Get-AzMigrateDiscoveredServer.ps1

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Get All discovered servers in a migrate project.
1919
.Description
2020
Get Azure migrate server commandlet fetches all servers in a migrate project.
2121
.Link
22-
https://docs.microsoft.com/en-us/powershell/module/az.migrate/get-azmigratediscoveredserver
22+
https://docs.microsoft.com/powershell/module/az.migrate/get-azmigratediscoveredserver
2323
#>
2424

2525
function Get-AzMigrateDiscoveredServer {
@@ -76,18 +76,29 @@ function Get-AzMigrateDiscoveredServer {
7676
throw "Server Discovery Solution not found."
7777
}
7878

79-
$extendedDetails = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] | ConvertFrom-Json
79+
$appMapV2 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] | ConvertFrom-Json
80+
$appMapV3 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] | ConvertFrom-Json
81+
$appMap = @{}
82+
83+
# Fetch all appliance from V2 map first. Then these can be updated if found again in V3 map.
84+
foreach ($item in $appMapV2) {
85+
$appMap[$item.ApplianceName] = $item.SiteId
86+
}
87+
88+
foreach ($item in $appMapV3) {
89+
$t = $item.psobject.properties
90+
$appMap[$t.Name] = $t.Value.SiteId
91+
}
8092

8193
# Regex to match site name.
8294
$r = '(?<=/Microsoft.OffAzure/VMwareSites/).*$'
83-
8495
$siteNameTmp = ""
85-
if ($parameterSet.Contains("Site")) {
96+
if ($parameterSet -match "Site") {
8697
#Fetch by site scenario. This is when site name filter is provided.
8798
$siteFound = 0
88-
foreach ($det in $extendedDetails) {
89-
if ($det.ApplianceName -eq $ApplianceName) {
90-
$siteArmId = $det.SiteId
99+
foreach ($kvp in $appMap.GetEnumerator()) {
100+
if ($kvp.Key -eq $ApplianceName) {
101+
$siteArmId = $kvp.Value
91102
if ($siteArmId -match $r) {
92103
$siteNameTmp = $Matches[0]
93104
$siteFound = 1
@@ -98,7 +109,7 @@ function Get-AzMigrateDiscoveredServer {
98109
$siteMachines = Get-AzMigrateMachine -ResourceGroupName $ResourceGroupName -SiteName $siteNameTmp -SubscriptionId $SubscriptionId
99110

100111
if ($DisplayName) {
101-
$filteredMachines = $siteMachines | Where-Object {$_.DisplayName.Contains($DisplayName)}
112+
$filteredMachines = $siteMachines | Where-Object {$_.DisplayName -match $DisplayName}
102113
return $filteredMachines
103114
}
104115
else {
@@ -118,8 +129,8 @@ function Get-AzMigrateDiscoveredServer {
118129
$projectSdsMachines = [System.Collections.ArrayList]::new()
119130

120131
if ($parameterSet -eq 'List') {
121-
foreach ($det in $extendedDetails) {
122-
$siteArmId = $det.SiteId
132+
foreach ($kvp in $appMap.GetEnumerator()) {
133+
$siteArmId = $kvp.Value
123134

124135
if ($siteArmId -match $r) {
125136
$siteNameTmp = $Matches[0]
@@ -131,16 +142,16 @@ function Get-AzMigrateDiscoveredServer {
131142
}
132143

133144
if ($DisplayName) {
134-
$filteredMachines = $projectSdsMachines | Where-Object {$_.DisplayName.Contains($DisplayName)}
145+
$filteredMachines = $projectSdsMachines | Where-Object {$_.DisplayName -match $DisplayName}
135146
return $filteredMachines
136147
}
137148
else {
138149
return $projectSdsMachines
139150
}
140151
}
141152
elseif ($parameterSet -eq 'Get') {
142-
foreach ($det in $extendedDetails) {
143-
$siteArmId = $det.SiteId
153+
foreach ($kvp in $appMap.GetEnumerator()) {
154+
$siteArmId = $kvp.Value
144155

145156
if ($siteArmId -match $r) {
146157
$siteNameTmp = $Matches[0]

0 commit comments

Comments
 (0)