Skip to content

Commit 8e7038c

Browse files
Move ResourceMover to release-2021-03-02 (#14310)
Co-authored-by: Dingmeng Xue <[email protected]>
1 parent 75e94c4 commit 8e7038c

File tree

445 files changed

+16466
-7881
lines changed

Some content is hidden

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

445 files changed

+16466
-7881
lines changed

src/ResourceMover/Az.ResourceMover.format.ps1xml

Lines changed: 398 additions & 146 deletions
Large diffs are not rendered by default.

src/ResourceMover/Az.ResourceMover.psd1

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 9/15/2020
6+
# Generated on: 2/24/2021
77
#
88

99
@{
@@ -45,7 +45,7 @@ PowerShellVersion = '5.1'
4545
DotNetFrameworkVersion = '4.7.2'
4646

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

5050
# Processor architecture (None, X86, Amd64) required by this module
5151
# ProcessorArchitecture = ''
@@ -72,8 +72,10 @@ FormatsToProcess = './Az.ResourceMover.format.ps1xml'
7272
FunctionsToExport = 'Add-AzResourceMoverMoveResource',
7373
'Get-AzResourceMoverMoveCollection',
7474
'Get-AzResourceMoverMoveResource',
75+
'Get-AzResourceMoverRequiredForResources',
7576
'Get-AzResourceMoverUnresolvedDependency',
76-
'Invoke-AzResourceMoverCommit', 'Invoke-AzResourceMoverDiscard',
77+
'Invoke-AzResourceMoverBulkRemove', 'Invoke-AzResourceMoverCommit',
78+
'Invoke-AzResourceMoverDiscard',
7779
'Invoke-AzResourceMoverInitiateMove',
7880
'Invoke-AzResourceMoverPrepare',
7981
'New-AzResourceMoverMoveCollection',
@@ -88,7 +90,7 @@ CmdletsToExport = @()
8890
# VariablesToExport = @()
8991

9092
# 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.
91-
AliasesToExport = '*'
93+
AliasesToExport = 'Update-AzResourceMoverMoveResource', '*'
9294

9395
# DSC resources to export from this module
9496
# DscResourcesToExport = @()
@@ -117,7 +119,7 @@ PrivateData = @{
117119
# IconUri = ''
118120

119121
# ReleaseNotes of this module
120-
ReleaseNotes = '* First preview release for module Az.ResourceMover'
122+
# ReleaseNotes = ''
121123

122124
# Prerelease string of this module
123125
# Prerelease = ''

src/ResourceMover/Az.ResourceMover.psm1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
}
2525
}
2626
if(-not $accountsModule) {
27-
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.8.1' } | Measure-Object).Count -gt 0
27+
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.2.3' } | Measure-Object).Count -gt 0
2828
if($hasAdequateVersion) {
29-
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.8.1 -Scope Global -PassThru
29+
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.2.3 -Scope Global -PassThru
3030
}
3131
}
3232
}
3333

3434
if(-not $accountsModule) {
35-
Write-Error "`nThis module requires $accountsName version 1.8.1 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
36-
} elseif (($accountsModule.Version -lt [System.Version]'1.8.1') -and (-not $localAccounts)) {
37-
Write-Error "`nThis module requires $accountsName version 1.8.1 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
35+
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
36+
} elseif (($accountsModule.Version -lt [System.Version]'2.2.3') -and (-not $localAccounts)) {
37+
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
3838
}
3939
Write-Information "Loaded Module '$($accountsModule.Name)'"
4040

src/ResourceMover/Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Added new cmdlets `Invoke-AzResourceMoverBulkRemove`, `Get-AzResourceMoverRequiredForResources`
22+
* Added alias to `Add-AzResourceMoverMoveResource`: `Update-AzResourceMoverMoveResource`
23+
* Flattened object "ResourceSettings"
2124

2225
## Version 0.1.0
2326
* First preview release for module Az.ResourceMover

src/ResourceMover/build-module.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ $null = New-Item -ItemType Directory -Force -Path $examplesFolder
122122

123123
if($NoDocs) {
124124
Write-Host -ForegroundColor Green 'Creating exports...'
125-
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs
125+
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs -ExamplesFolder $examplesFolder
126126
} else {
127127
Write-Host -ForegroundColor Green 'Creating exports and docs...'
128128
$moduleDescription = 'Microsoft Azure PowerShell: ResourceMover cmdlets'

src/ResourceMover/check-dependencies.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if(Test-Path -Path $localModulesPath) {
4646
$env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
4747
}
4848

49-
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '1.8.1'
49+
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.2.3'
5050
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1'
5151

5252
$tools = Join-Path $PSScriptRoot 'tools'
@@ -56,7 +56,7 @@ $resourceModule = Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestS
5656
if ($Resources.IsPresent -and (-not (Test-Path -Path $resourceModule))) {
5757
Write-Host -ForegroundColor Green "Building local Resource module used for test..."
5858
Set-Location $resourceDir
59-
$null = autorest-beta .\readme.md --output-folder=$HOME/.PSSharedModules/Resources
59+
$null = autorest .\readme.md --use:@autorest/powershell@3.0.414 --output-folder=$HOME/.PSSharedModules/Resources
6060
$null = Copy-Item custom/* $HOME/.PSSharedModules/Resources/custom/
6161
Set-Location $HOME/.PSSharedModules/Resources
6262
$null = .\build-module.ps1

src/ResourceMover/custom/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ These provide functionality to our HTTP pipeline and other useful features. In s
3131

3232
### Attributes
3333
For processing the cmdlets, we've created some additional attributes:
34-
- `Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.DescriptionAttribute`
34+
- `Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.DescriptionAttribute`
3535
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
36-
- `Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.DoNotExportAttribute`
36+
- `Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.DoNotExportAttribute`
3737
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.ResourceMover`.
38-
- `Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.InternalExportAttribute`
38+
- `Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.InternalExportAttribute`
3939
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.ResourceMover`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder.
40-
- `Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.ProfileAttribute`
40+
- `Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.ProfileAttribute`
4141
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
Lines changed: 101 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,105 @@
1-
### Example 1: Adding a resource to the move collection.
1+
### Example 1: Add a resource to the Move Collection.
22
```powershell
3-
PS C:\> Add-AzResourceMoverMoveResource -ResourceGroupName RG-MoveCollection-demoRM -MoveCollectionName "PS-centralus-westcentralus-demoRM" -SourceId "/subscriptions/e80eb9fa-c996-4435-aa32-5af6f3d3077c/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM" -Name PSDemoVM -ResourceSettingResourceType "Microsoft.Compute/virtualMachines" -ResourceSettingTargetResourceName PSDemoVM
4-
5-
Output:
6-
7-
Code :
8-
DependsOn : {}
9-
DependsOnOverride : {}
10-
Detail :
11-
ExistingTargetId :
12-
Id : /subscriptions/e80eb9fa-c996-4435-aa32-5af6f3d3077c/resourceGroups/RG-MoveCollection-demoRM/providers/Microsoft.Migr
13-
ate/MoveCollections/PS-centralus-westcentralus-demoRM/MoveResources/PSDemoVM
14-
Message :
15-
MoveStatusCode : DependencyComputationPending
16-
MoveStatusDetail : {}
17-
MoveStatusJobName :
18-
MoveStatusJobProgress :
19-
MoveStatusMessage : The dependency computation is not completed for resource - /subscriptions/e80eb9fa-c996-4435-aa32-5af6f3d3077c/resou
20-
rceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM.
21-
Possible Causes: Dependency computation is pending for resource.
22-
Recommended Action: Validate dependencies to compute the dependencies.
23-
24-
MoveStatusMoveState : PreparePending
25-
MoveStatusTarget :
26-
MoveStatusTargetId :
27-
Name : PSDemoVM
28-
ProvisioningState : Succeeded
29-
ResourceSettingResourceType : Microsoft.Compute/virtualMachines
30-
ResourceSettingTargetResourceName : PSDemoVM
31-
SourceId : /subscriptions/e80eb9fa-c996-4435-aa32-5af6f3d3077c/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachi
32-
nes/PSDemoVM
33-
SourceResourceSettingResourceType : Microsoft.Compute/virtualMachines
34-
SourceResourceSettingTargetResourceName : PSDemoVM
35-
Target :
36-
TargetId :
37-
Type
3+
PS C:\> Add-AzResourceMoverMoveResource -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-centralus-westcentralus-demoRMS" -SourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM" -Name "PSDemoVM" -ResourceSetting $targetResourceSettingsObj
4+
5+
DependsOn : {}
6+
DependsOnOverride : {}
7+
ErrorsPropertiesCode :
8+
ErrorsPropertiesDetail :
9+
ErrorsPropertiesMessage :
10+
ErrorsPropertiesTarget :
11+
ExistingTargetId :
12+
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-MoveCollection-demoRMS/providers/Microsoft.Migrate/moveCollections/PS-centralus-westcentralus-demoRMS/moveResources/PSDemoVM
13+
IsResolveRequired : False
14+
JobStatusJobName :
15+
JobStatusJobProgress :
16+
MoveStatusErrorsPropertiesCode : DependencyComputationPending
17+
MoveStatusErrorsPropertiesDetail : {}
18+
MoveStatusErrorsPropertiesMessage : The dependency computation is not completed for resource - /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM. Possible Causes: Dependency computation is pending for resource. Recommended Action: Validate dependencies to compute the dependencies.
19+
MoveStatusErrorsPropertiesTarget :
20+
MoveStatusMoveState : PreparePending
21+
Name : PSDemoVM
22+
ProvisioningState : Succeeded
23+
ResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api202101.VirtualMachineResourceSettings
24+
SourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM
25+
SourceResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api202101.VirtualMachineResourceSettings
26+
TargetId :
27+
Type :
28+
29+
PS C:\> $targetResourceSettingsObj = New-Object Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api202101.VirtualMachineResourceSettings
30+
PS C:\> $targetResourceSettingsObj.ResourceType = "Microsoft.Compute/virtualMachines"
31+
$targetResourceSettingsObj.TargetResourceName = "PSDemoVM"
32+
33+
```
34+
35+
Add a resource to the Move Collection.
36+
37+
### Example 2: Add a resource to the Move Collection that has existing target resource.
38+
```powershell
39+
PS C:\> Add-AzResourceMoverMoveResource -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-centralus-westcentralus-demoRMS" -SourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/psdemorm" -Name "psdemorm" -ExistingTargetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/PSDemoRM-target"
40+
41+
DependsOn : {}
42+
DependsOnOverride : {}
43+
ErrorsPropertiesCode :
44+
ErrorsPropertiesDetail :
45+
ErrorsPropertiesMessage :
46+
ErrorsPropertiesTarget :
47+
ExistingTargetId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/PSDemoRM-target
48+
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-MoveCollection-demoRMS/providers/Microsoft.Migrate/moveCollections/PS-centralus-westcentralus-demoRMS/moveResources/psdemorm
49+
IsResolveRequired : False
50+
JobStatusJobName :
51+
JobStatusJobProgress :
52+
MoveStatusErrorsPropertiesCode :
53+
MoveStatusErrorsPropertiesDetail :
54+
MoveStatusErrorsPropertiesMessage :
55+
MoveStatusErrorsPropertiesTarget :
56+
MoveStatusMoveState : CommitPending
57+
Name : psdemorm
58+
ProvisioningState : Succeeded
59+
ResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api202101.ResourceSettings
60+
SourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/psdemorm
61+
SourceResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api202101.ResourceSettings
62+
TargetId :
63+
Type :
64+
65+
```
66+
67+
Add a resource to the Move Collection that has existing target resource.
68+
69+
### Example 3: Update target resource settings after the Move Resource has been added.
70+
```powershell
71+
PS C:\> Update-AzResourceMoverMoveResource -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-centralus-westcentralus-demoRMS" -SourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM" -Name "PSDemoVM" -ResourceSetting $TargetResourceSettingObj
72+
73+
74+
DependsOn : {/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Network/networkInterfaces/psdemov
75+
m111, /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/PSDemoRM}
76+
DependsOnOverride : {}
77+
ErrorsPropertiesCode :
78+
ErrorsPropertiesDetail :
79+
ErrorsPropertiesMessage :
80+
ErrorsPropertiesTarget :
81+
ExistingTargetId :
82+
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-MoveCollection-demoRMS/providers/Microsoft.Migrate/moveCollections/PS-centralus-westcentralus-demoRMS/moveResources/PSDemoVM
83+
IsResolveRequired : True
84+
JobStatusJobName :
85+
JobStatusJobProgress :
86+
MoveStatusErrorsPropertiesCode :
87+
MoveStatusErrorsPropertiesDetail :
88+
MoveStatusErrorsPropertiesMessage :
89+
MoveStatusErrorsPropertiesTarget :
90+
MoveStatusMoveState : PreparePending
91+
Name : PSDemoVM
92+
ProvisioningState : Succeeded
93+
ResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api202101.VirtualMachineResourceSettings
94+
SourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM
95+
SourceResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api202101.VirtualMachineResourceSettings
96+
TargetId :
97+
Type :
98+
99+
PS C:\> $moveResourceObj = Get-AzResourceMoverMoveResource -MoveCollectionName "PS-centralus-westcentralus-demoRMS1" -ResourceGroupName "RG-MoveCollection-demoRMS" -Name "PSDemoVM"
100+
PS C:\> $TargetResourceSettingObj = $moveResourceObj.ResourceSetting
101+
$TargetResourceSettingObj.TargetResourceName="PSDemoVM-target"
38102
39103
```
40104

41-
Adding a resource to the move collection within the specified subscription.
105+
Update target resource settings after the Move Resource has been added.

0 commit comments

Comments
 (0)