Skip to content

Commit

Permalink
GA Az.Migrate (#14265)
Browse files Browse the repository at this point in the history
* Move Migrate to master

* Az.Migrate OOB release

Co-authored-by: azurepowershell <[email protected]>
  • Loading branch information
VeryEarly and azurepowershell authored Feb 22, 2021
1 parent 446db11 commit 55f0be8
Show file tree
Hide file tree
Showing 168 changed files with 2,433 additions and 1,250 deletions.
267 changes: 141 additions & 126 deletions src/Migrate/Az.Migrate.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,135 +3,150 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 1/13/2021
# Generated on: 2/19/2021
#

@{

# Script module or binary module file associated with this manifest.
RootModule = './Az.Migrate.psm1'

# Version number of this module.
ModuleVersion = '0.2.0'

# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'

# ID used to uniquely identify this module
GUID = 'c638312b-9fd1-4611-a5cc-11a8caa5b698'

# Author of this module
Author = 'Microsoft Corporation'

# Company or vendor of this module
CompanyName = 'Microsoft Corporation'

# Copyright statement for this module
Copyright = 'Microsoft Corporation. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Microsoft Azure PowerShell: Migrate cmdlets'

# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '5.1'

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
DotNetFrameworkVersion = '4.7.2'

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.2.5'; })

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = './bin/Az.Migrate.private.dll'

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = './Az.Migrate.format.ps1xml'

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

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

# 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.
CmdletsToExport = @()

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

# 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.
AliasesToExport = '*'

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# 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.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'Azure','ResourceManager','ARM','PSModule','Migrate'

# A URL to the license for this module.
LicenseUri = 'https://aka.ms/azps-license'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/Azure/azure-powershell'

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '* Bug fixed in update replication migration item to pass all properties (changed/unchanged) to service, and not just the changed ones.
* Bug fixed in enable migrate to pick correct run as account id for VMware Cbt provider.
* Added new parameter (MachineName) in get replication migration item, to get replication migration item by friendly name.
* 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.
* Fix to in online URLs of existing code doc.'


# Prerelease string of this module
# Prerelease = ''

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false

# External dependent modules of this module
# ExternalModuleDependencies = @()

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

# Script module or binary module file associated with this manifest.
RootModule = './Az.Migrate.psm1'

# Version number of this module.
ModuleVersion = '1.0.0'

# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'

# ID used to uniquely identify this module
GUID = 'c638312b-9fd1-4611-a5cc-11a8caa5b698'

# Author of this module
Author = 'Microsoft Corporation'

# Company or vendor of this module
CompanyName = 'Microsoft Corporation'

# Copyright statement for this module
Copyright = 'Microsoft Corporation. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Microsoft Azure PowerShell: Migrate cmdlets'

# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '5.1'

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
DotNetFrameworkVersion = '4.7.2'

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# CLRVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.2.5'; })

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = './bin/Az.Migrate.private.dll'

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = './Az.Migrate.format.ps1xml'

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# 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.
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',
'Initialize-AzMigrateReplicationInfrastructure',
'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'

# 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.
CmdletsToExport = @()

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

# 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.
AliasesToExport = '*'

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# 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.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'Azure','ResourceManager','ARM','PSModule','Migrate'

# A URL to the license for this module.
LicenseUri = 'https://aka.ms/azps-license'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/Azure/azure-powershell'

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '* Az.Migrate GA
* Incorporated Initialize-AzMigrateReplicationInfrastructure as a cmdlet in the Az.Migrate module, from the external script that is run currently today.
* Made some parameters of New-AzMigrateServerReplication, New-AzMigrateDiskMapping case insensitive.
* Added support for scale appliance change, to handle new V3 keys.'

# Prerelease string of this module
# Prerelease = ''

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false

# External dependent modules of this module
# ExternalModuleDependencies = @()

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}

7 changes: 7 additions & 0 deletions src/Migrate/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
- Additional information about change #1
-->
## Upcoming Release

## Version 1.0.0
* Az.Migrate GA
* Incorporated Initialize-AzMigrateReplicationInfrastructure as a cmdlet in the Az.Migrate module, from the external script that is run currently today.
* Made some parameters of New-AzMigrateServerReplication, New-AzMigrateDiskMapping case insensitive.
* Added support for scale appliance change, to handle new V3 keys.

## Version 0.2.0
* Bug fixed in update replication migration item to pass all properties (changed/unchanged) to service, and not just the changed ones.
* Bug fixed in enable migrate to pick correct run as account id for VMware Cbt provider.
Expand Down
4 changes: 2 additions & 2 deletions src/Migrate/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: Guid("49de559e-8965-4e80-ba75-d2f2266a0abd")]
[assembly: AssemblyVersion("0.2.0")]
[assembly: AssemblyFileVersion("0.2.0")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
37 changes: 24 additions & 13 deletions src/Migrate/custom/Get-AzMigrateDiscoveredServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Get All discovered servers in a migrate project.
.Description
Get Azure migrate server commandlet fetches all servers in a migrate project.
.Link
https://docs.microsoft.com/en-us/powershell/module/az.migrate/get-azmigratediscoveredserver
https://docs.microsoft.com/powershell/module/az.migrate/get-azmigratediscoveredserver
#>

function Get-AzMigrateDiscoveredServer {
Expand Down Expand Up @@ -76,18 +76,29 @@ function Get-AzMigrateDiscoveredServer {
throw "Server Discovery Solution not found."
}

$extendedDetails = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] | ConvertFrom-Json
$appMapV2 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] | ConvertFrom-Json
$appMapV3 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] | ConvertFrom-Json
$appMap = @{}

# Fetch all appliance from V2 map first. Then these can be updated if found again in V3 map.
foreach ($item in $appMapV2) {
$appMap[$item.ApplianceName] = $item.SiteId
}

foreach ($item in $appMapV3) {
$t = $item.psobject.properties
$appMap[$t.Name] = $t.Value.SiteId
}

# Regex to match site name.
$r = '(?<=/Microsoft.OffAzure/VMwareSites/).*$'

$siteNameTmp = ""
if ($parameterSet.Contains("Site")) {
if ($parameterSet -match "Site") {
#Fetch by site scenario. This is when site name filter is provided.
$siteFound = 0
foreach ($det in $extendedDetails) {
if ($det.ApplianceName -eq $ApplianceName) {
$siteArmId = $det.SiteId
foreach ($kvp in $appMap.GetEnumerator()) {
if ($kvp.Key -eq $ApplianceName) {
$siteArmId = $kvp.Value
if ($siteArmId -match $r) {
$siteNameTmp = $Matches[0]
$siteFound = 1
Expand All @@ -98,7 +109,7 @@ function Get-AzMigrateDiscoveredServer {
$siteMachines = Get-AzMigrateMachine -ResourceGroupName $ResourceGroupName -SiteName $siteNameTmp -SubscriptionId $SubscriptionId

if ($DisplayName) {
$filteredMachines = $siteMachines | Where-Object {$_.DisplayName.Contains($DisplayName)}
$filteredMachines = $siteMachines | Where-Object {$_.DisplayName -match $DisplayName}
return $filteredMachines
}
else {
Expand All @@ -118,8 +129,8 @@ function Get-AzMigrateDiscoveredServer {
$projectSdsMachines = [System.Collections.ArrayList]::new()

if ($parameterSet -eq 'List') {
foreach ($det in $extendedDetails) {
$siteArmId = $det.SiteId
foreach ($kvp in $appMap.GetEnumerator()) {
$siteArmId = $kvp.Value

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

if ($DisplayName) {
$filteredMachines = $projectSdsMachines | Where-Object {$_.DisplayName.Contains($DisplayName)}
$filteredMachines = $projectSdsMachines | Where-Object {$_.DisplayName -match $DisplayName}
return $filteredMachines
}
else {
return $projectSdsMachines
}
}
elseif ($parameterSet -eq 'Get') {
foreach ($det in $extendedDetails) {
$siteArmId = $det.SiteId
foreach ($kvp in $appMap.GetEnumerator()) {
$siteArmId = $kvp.Value

if ($siteArmId -match $r) {
$siteNameTmp = $Matches[0]
Expand Down
Loading

0 comments on commit 55f0be8

Please sign in to comment.