Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Migrate")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.9.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.9.0")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.10.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.10.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
15 changes: 11 additions & 4 deletions src/Migrate/Migrate.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ module-version: 3.0.13
title: Migrate
subject-prefix: 'Migrate'

use-extension:
"@autorest/powershell": "3.x"

directive:
# Correct some swagger operationIds
- from: Microsoft.OffAzure/stable/2020-01-01/migrate.json
Expand Down Expand Up @@ -167,7 +164,7 @@ directive:
where:
verb: Invoke$
subject: ^ResyncReplicationMigrationItem
variant: ^ResyncViaIdentityExpanded$|^ResyncViaIdentity$|^Resync$
variant: ^(?!ResyncExpanded$).*
remove: true
- from: Microsoft.RecoveryServices/stable/2024-01-01/service.json
where:
Expand Down Expand Up @@ -273,6 +270,16 @@ directive:
verb: Update$
subject: Project$
remove: true
- from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
where:
verb: Remove
subject: VCenterVcenter
remove: true
- from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
where:
verb: Update
subject: ReplicationRecoveryServicesProvider|VCenter
remove: true
- from: Microsoft.RecoveryServices/stable/2024-01-01/service.json
where:
subject: ^ReplicationRecoveryPlan|ReplicationRecoveryServiceProvider$|ReplicationEvent$|ReplicationAlertSetting$|ReplicationLogicalNetwork$|^ReplicationProtectedItem|^ReplicationNetwork|^ReplicationStorage|RecoveryPoint$|ProtectableItem$|FabricGateway$|FabricToAad$|ReplicationvCenter$
Expand Down
4 changes: 2 additions & 2 deletions src/Migrate/Migrate.Autorest/custom/Az.Migrate.custom.psm1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# region Generated
# Load the private module dll
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.Migrate.private.dll')
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Migrate.private.dll')

# Load the internal module
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.Migrate.internal.psm1'
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.Migrate.internal.psm1'
if(Test-Path $internalModulePath) {
$null = Import-Module -Name $internalModulePath
}
Expand Down
2 changes: 1 addition & 1 deletion src/Migrate/Migrate.Autorest/custom/AzLocalDiskInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;

namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models
{
public class AzLocalDiskInput
{
Expand Down
2 changes: 1 addition & 1 deletion src/Migrate/Migrate.Autorest/custom/AzLocalNicInput.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models
{
public class AzLocalNicInput
{
Expand Down
136 changes: 78 additions & 58 deletions src/Migrate/Migrate.Autorest/custom/Get-AzMigrateDiscoveredServer.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -11,78 +10,99 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
# is regenerated.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Get All discovered servers in a migrate project.
.Description
Get Azure migrate server commandlet fetches all servers in a migrate project.
.Example
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
.Example
Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
.Example
Get-AzMigrateDiscoveredServer -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
.Example
Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
.Example
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -DisplayName Contoso | Format-Table DisplayName,Name,Type
.Example
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -ApplianceName BBVMwareAVS -DisplayName Contoso | Format-Table DisplayName,Name,Type
.Example
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName "test-rg" -ProjectName "testproj" -SourceMachineType "HyperV" | Format-Table DisplayName,Name,Type

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IHyperVMachine
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IVMwareMachine
.Link
https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratediscoveredserver
#>

function Get-AzMigrateDiscoveredServer {
[OutputType(
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine],
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine])]
[CmdletBinding(DefaultParameterSetName = 'List', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param (
[Parameter(Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the migrate project name.
${ProjectName},

[Parameter(Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the resource group name.
${ResourceGroupName},

[Parameter(ParameterSetName = 'Get', Mandatory)]
[Parameter(ParameterSetName = 'GetInSite', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the source machine name. This is an internal Name. For users, use display name.
${Name},

[Parameter(ParameterSetName = 'List')]
[Parameter(ParameterSetName = 'ListInSite')]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the source machine display name.
${DisplayName},

[Parameter(ParameterSetName = 'GetInSite', Mandatory)]
[Parameter(ParameterSetName = 'ListInSite', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the appliance name. This internally maps to a site.
${ApplianceName},

[Parameter()]
[ValidateSet("VMware", "HyperV")]
[ArgumentCompleter( { "VMware", "HyperV" })]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the source machine type. Currently, only HyperV and VMware are supported.
${SourceMachineType} = "VMware",

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
[System.String[]]
# Specifies the subscription id.
${SubscriptionId}
)

[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IVMwareMachine], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IHyperVMachine])]
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the migrate project name.
${ProjectName},

[Parameter(Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the resource group name.
${ResourceGroupName},

[Parameter(ParameterSetName='List')]
[Parameter(ParameterSetName='ListInSite')]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the source machine display name.
${DisplayName},

[Parameter()]
[ValidateSet("VMware", "HyperV")]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the source machine type.
# Currently, only HyperV and VMware are supported.
${SourceMachineType} = "VMware",

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String[]]
# Specifies the subscription id.
${SubscriptionId},

[Parameter(ParameterSetName='GetInSite', Mandatory)]
[Parameter(ParameterSetName='Get', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the source machine name.
# This is an internal Name.
# For users, use display name.
${Name},

[Parameter(ParameterSetName='GetInSite', Mandatory)]
[Parameter(ParameterSetName='ListInSite', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
[System.String]
# Specifies the appliance name.
# This internally maps to a site.
${ApplianceName}
)

process {
$parameterSet = $PSCmdlet.ParameterSetName
$hasApplianceName = $PSBoundParameters.ContainsKey("ApplianceName")

$discoverySolutionName = "Servers-Discovery-ServerDiscovery"
$discoverySolution = Az.Migrate\Get-AzMigrateSolution -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -MigrateProjectName $ProjectName -Name $discoverySolutionName
$discoverySolution = Az.Migrate.private\Get-AzMigrateSolution_Get -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -MigrateProjectName $ProjectName -Name $discoverySolutionName
if ($discoverySolution.Name -ne $discoverySolutionName)
{
throw "Server Discovery Solution not found."
Expand Down
Loading
Loading