|
1 | 1 |
|
2 | 2 | # ---------------------------------------------------------------------------------- |
3 | | -# |
4 | | -# Copyright Microsoft Corporation |
| 3 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
5 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 5 | # you may not use this file except in compliance with the License. |
7 | 6 | # You may obtain a copy of the License at |
|
11 | 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | 11 | # See the License for the specific language governing permissions and |
13 | 12 | # limitations under the License. |
| 13 | +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code |
| 14 | +# is regenerated. |
14 | 15 | # ---------------------------------------------------------------------------------- |
15 | 16 |
|
16 | 17 | <# |
17 | 18 | .Synopsis |
18 | 19 | Get All discovered servers in a migrate project. |
19 | 20 | .Description |
20 | 21 | Get Azure migrate server commandlet fetches all servers in a migrate project. |
| 22 | +.Example |
| 23 | +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest |
| 24 | +.Example |
| 25 | +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 |
| 26 | +.Example |
| 27 | +Get-AzMigrateDiscoveredServer -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest |
| 28 | +.Example |
| 29 | +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 |
| 30 | +.Example |
| 31 | +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -DisplayName Contoso | Format-Table DisplayName,Name,Type |
| 32 | +.Example |
| 33 | +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -ApplianceName BBVMwareAVS -DisplayName Contoso | Format-Table DisplayName,Name,Type |
| 34 | +.Example |
| 35 | +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName "test-rg" -ProjectName "testproj" -SourceMachineType "HyperV" | Format-Table DisplayName,Name,Type |
| 36 | +
|
| 37 | +.Outputs |
| 38 | +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IHyperVMachine |
| 39 | +.Outputs |
| 40 | +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IVMwareMachine |
21 | 41 | .Link |
22 | 42 | https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratediscoveredserver |
23 | 43 | #> |
24 | | - |
25 | 44 | function Get-AzMigrateDiscoveredServer { |
26 | | - [OutputType( |
27 | | - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine], |
28 | | - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine])] |
29 | | - [CmdletBinding(DefaultParameterSetName = 'List', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] |
30 | | - param ( |
31 | | - [Parameter(Mandatory)] |
32 | | - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
33 | | - [System.String] |
34 | | - # Specifies the migrate project name. |
35 | | - ${ProjectName}, |
36 | | - |
37 | | - [Parameter(Mandatory)] |
38 | | - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
39 | | - [System.String] |
40 | | - # Specifies the resource group name. |
41 | | - ${ResourceGroupName}, |
42 | | - |
43 | | - [Parameter(ParameterSetName = 'Get', Mandatory)] |
44 | | - [Parameter(ParameterSetName = 'GetInSite', Mandatory)] |
45 | | - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
46 | | - [System.String] |
47 | | - # Specifies the source machine name. This is an internal Name. For users, use display name. |
48 | | - ${Name}, |
49 | | - |
50 | | - [Parameter(ParameterSetName = 'List')] |
51 | | - [Parameter(ParameterSetName = 'ListInSite')] |
52 | | - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
53 | | - [System.String] |
54 | | - # Specifies the source machine display name. |
55 | | - ${DisplayName}, |
56 | | - |
57 | | - [Parameter(ParameterSetName = 'GetInSite', Mandatory)] |
58 | | - [Parameter(ParameterSetName = 'ListInSite', Mandatory)] |
59 | | - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
60 | | - [System.String] |
61 | | - # Specifies the appliance name. This internally maps to a site. |
62 | | - ${ApplianceName}, |
63 | | - |
64 | | - [Parameter()] |
65 | | - [ValidateSet("VMware", "HyperV")] |
66 | | - [ArgumentCompleter( { "VMware", "HyperV" })] |
67 | | - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
68 | | - [System.String] |
69 | | - # Specifies the source machine type. Currently, only HyperV and VMware are supported. |
70 | | - ${SourceMachineType} = "VMware", |
71 | | - |
72 | | - [Parameter()] |
73 | | - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
74 | | - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] |
75 | | - [System.String[]] |
76 | | - # Specifies the subscription id. |
77 | | - ${SubscriptionId} |
78 | | - ) |
79 | | - |
| 45 | +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IVMwareMachine], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IHyperVMachine])] |
| 46 | +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] |
| 47 | +param( |
| 48 | + [Parameter(Mandatory)] |
| 49 | + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
| 50 | + [System.String] |
| 51 | + # Specifies the migrate project name. |
| 52 | + ${ProjectName}, |
| 53 | + |
| 54 | + [Parameter(Mandatory)] |
| 55 | + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
| 56 | + [System.String] |
| 57 | + # Specifies the resource group name. |
| 58 | + ${ResourceGroupName}, |
| 59 | + |
| 60 | + [Parameter(ParameterSetName='List')] |
| 61 | + [Parameter(ParameterSetName='ListInSite')] |
| 62 | + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
| 63 | + [System.String] |
| 64 | + # Specifies the source machine display name. |
| 65 | + ${DisplayName}, |
| 66 | + |
| 67 | + [Parameter()] |
| 68 | + [ValidateSet("VMware", "HyperV")] |
| 69 | + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
| 70 | + [System.String] |
| 71 | + # Specifies the source machine type. |
| 72 | + # Currently, only HyperV and VMware are supported. |
| 73 | + ${SourceMachineType} = "VMware", |
| 74 | + |
| 75 | + [Parameter()] |
| 76 | + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
| 77 | + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] |
| 78 | + [System.String[]] |
| 79 | + # Specifies the subscription id. |
| 80 | + ${SubscriptionId}, |
| 81 | + |
| 82 | + [Parameter(ParameterSetName='GetInSite', Mandatory)] |
| 83 | + [Parameter(ParameterSetName='Get', Mandatory)] |
| 84 | + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
| 85 | + [System.String] |
| 86 | + # Specifies the source machine name. |
| 87 | + # This is an internal Name. |
| 88 | + # For users, use display name. |
| 89 | + ${Name}, |
| 90 | + |
| 91 | + [Parameter(ParameterSetName='GetInSite', Mandatory)] |
| 92 | + [Parameter(ParameterSetName='ListInSite', Mandatory)] |
| 93 | + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] |
| 94 | + [System.String] |
| 95 | + # Specifies the appliance name. |
| 96 | + # This internally maps to a site. |
| 97 | + ${ApplianceName} |
| 98 | +) |
| 99 | + |
80 | 100 | process { |
81 | 101 | $parameterSet = $PSCmdlet.ParameterSetName |
82 | 102 | $hasApplianceName = $PSBoundParameters.ContainsKey("ApplianceName") |
83 | 103 |
|
84 | 104 | $discoverySolutionName = "Servers-Discovery-ServerDiscovery" |
85 | | - $discoverySolution = Az.Migrate\Get-AzMigrateSolution -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -MigrateProjectName $ProjectName -Name $discoverySolutionName |
| 105 | + $discoverySolution = Az.Migrate.private\Get-AzMigrateSolution_Get -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -MigrateProjectName $ProjectName -Name $discoverySolutionName |
86 | 106 | if ($discoverySolution.Name -ne $discoverySolutionName) |
87 | 107 | { |
88 | 108 | throw "Server Discovery Solution not found." |
|
0 commit comments