Skip to content

Commit 23f6a39

Browse files
authored
Update spec to support Az 5.2 (#69)
1 parent 69d88f7 commit 23f6a39

File tree

74 files changed

+14664
-10957
lines changed

Some content is hidden

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

74 files changed

+14664
-10957
lines changed

.github/CONTRIBUTING.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,19 @@ We recommend that you use [Visual Studio Code](https://docs.microsoft.com/dotnet
4848

4949
- New features must have unit tests and supporting documentation in order to be accepted.
5050

51-
- To run your tests locally you need to add the path to the module directory `<your_path>\azure-powershell-migration\powershell-module` to the environment variable `$env:PSModulePath`.
51+
- Execute tests
52+
```
53+
# add the path to the module directory to the environment variable
54+
$env:PSModulePath += ";<your_path>\azure-powershell-migration\powershell-module"
5255
53-
Run your test with `Invoke-Pester -TestName "Name_of_your_test"`
56+
# Pester 5.x has breaking change. 4.10.1 is required.
57+
Install-Module -Name Pester -RequiredVersion 4.10.1
58+
59+
cd <your_path>\azure-powershell-migration\powershell-module\Az.Tools.Migration
60+
61+
# Execute all test cases
62+
Invoke-Pester -TestName "*tests"
63+
```
5464

5565
- Any resources or code that may also be used for the VSCode extension should be placed in the `common` folder at the root of this repository.
5666

docs/quickstart-migrate-azurerm-to-az-automatically.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ points that require changes when moving from AzureRM to the Az PowerShell cmdlet
4444
4545
```powershell
4646
# Generate an upgrade plan for the specified PowerShell script and save it to a variable.
47-
$Plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 4.8.0 -FilePath 'C:\Scripts\my-azure-script.ps1'
47+
$Plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.2.0 -FilePath 'C:\Scripts\my-azure-script.ps1'
4848
```
4949

5050
```powershell
5151
# Generate an upgrade plan for all the scripts and module files in the specified folder and save it to a variable.
52-
$Plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 4.8.0 -DirectoryPath 'C:\Scripts'
52+
$Plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.2.0 -DirectoryPath 'C:\Scripts'
5353
```
5454

5555
Review the results of the upgrade plan.
@@ -108,7 +108,7 @@ $Results | Where-Object UpgradeResult -ne UpgradeCompleted | Format-List
108108
during upgrade plan generation, a warning is returned.
109109
* File I/O operations use default encoding. Unusual file encoding situations may cause problems.
110110
* AzureRM cmdlets passed as arguments to Pester unit test mock statements aren't detected.
111-
* Currently, only Az PowerShell module version 4.8.0 is supported as a target.
111+
* Currently, only Az PowerShell module version 5.2.0 is supported as a target.
112112

113113
## Next steps
114114

powershell-module/Az.Tools.Migration/Functions/Public/Get-AzUpgradeAliasSpec.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ function Get-AzUpgradeAliasSpec
1111
Specify the version of the module to import command aliases from.
1212
1313
.EXAMPLE
14-
PS C:\> Get-AzUpgradeAliasSpec -ModuleVersion "4.8.0"
15-
Returns the cmdlet alias mappings table for Az 4.8.0.
14+
PS C:\> Get-AzUpgradeAliasSpec -ModuleVersion "5.2.0"
15+
Returns the cmdlet alias mappings table for Az 5.2.0.
1616
#>
1717
[CmdletBinding()]
1818
Param

powershell-module/Az.Tools.Migration/Functions/Public/Invoke-AzUpgradeModulePlan.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function Invoke-AzUpgradeModulePlan
2323
The following example invokes the upgrade plan for a PowerShell module named "myModule" and saves the updated file contents into new files (leaving original files unmodified).
2424
2525
# step 1: generate a plan and save it to a variable.
26-
$plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 4.8.0 -DirectoryPath 'C:\Scripts\myModule'
26+
$plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.2.0 -DirectoryPath 'C:\Scripts\myModule'
2727
2828
# step 2: write the plan to the console to review the upgrade steps, warnings, and errors.
2929
$plan
@@ -38,7 +38,7 @@ function Invoke-AzUpgradeModulePlan
3838
The following example invokes the upgrade plan for a PowerShell module named "myModule" and modifies the existing files in place.
3939
4040
# step 1: generate a plan and save it to a variable.
41-
$plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 4.8.0 -DirectoryPath 'C:\Scripts\myModule'
41+
$plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.2.0 -DirectoryPath 'C:\Scripts\myModule'
4242
4343
# step 2: write the plan to the console to review the upgrade steps, warnings, and errors.
4444
$plan

powershell-module/Az.Tools.Migration/Functions/Public/New-AzUpgradeModulePlan.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function New-AzUpgradeModulePlan
1111
Specifies the AzureRM module version used in your existing PowerShell scripts(s) or modules.
1212
1313
.PARAMETER ToAzVersion
14-
Specifies the Az module version to upgrade to. Currently, only Az version 4.8.0 is supported.
14+
Specifies the Az module version to upgrade to. Currently, only Az version 5.2.0 is supported.
1515
1616
.PARAMETER FilePath
1717
Specifies the path to a single PowerShell file.
@@ -34,32 +34,32 @@ function New-AzUpgradeModulePlan
3434
.EXAMPLE
3535
The following example generates a new Az module upgrade plan for the script file 'C:\Scripts\my-azure-script.ps1'.
3636
37-
New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 4.8.0 -FilePath 'C:\Scripts\my-azure-script.ps1'
37+
New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.2.0 -FilePath 'C:\Scripts\my-azure-script.ps1'
3838
3939
.EXAMPLE
4040
The following example generates a new Az module upgrade plan for the script and module files located under C:\Scripts.
4141
42-
New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 4.8.0 -DirectoryPath 'C:\Scripts'
42+
New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.2.0 -DirectoryPath 'C:\Scripts'
4343
4444
.EXAMPLE
4545
The following example generates a new Az module upgrade plan for the script and module files under C:\Scripts.
4646
4747
$references = Find-AzUpgradeCommandReference -DirectoryPath 'C:\Scripts' -AzureRmVersion '6.13.1'
48-
New-AzUpgradeModulePlan -ToAzVersion 4.8.0 -AzureRmCmdReference $references
48+
New-AzUpgradeModulePlan -ToAzVersion 5.2.0 -AzureRmCmdReference $references
4949
5050
.EXAMPLE
5151
The following example generates a new Az module upgrade plan for the script and module files under several directories.
5252
Module specs are pre-loaded here to avoid re-loading the spec each time a plan is generated.
5353
5454
# pre-load specifications
5555
$armSpec = Get-AzUpgradeCmdletSpec -ModuleName "AzureRM" -ModuleVersion "6.13.1"
56-
$azSpec = Get-AzUpgradeCmdletSpec -ModuleName "Az" -ModuleVersion "4.8.0"
57-
$azAliases = Get-AzUpgradeAliasSpec -ModuleVersion "4.8.0"
56+
$azSpec = Get-AzUpgradeCmdletSpec -ModuleName "Az" -ModuleVersion "5.2.0"
57+
$azAliases = Get-AzUpgradeAliasSpec -ModuleVersion "5.2.0"
5858
5959
# execute a batch of module upgrades
60-
$plan1 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts1' -FromAzureRmVersion '6.13.1' -ToAzVersion '4.8.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
61-
$plan2 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts2' -FromAzureRmVersion '6.13.1' -ToAzVersion '4.8.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
62-
$plan3 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts3' -FromAzureRmVersion '6.13.1' -ToAzVersion '4.8.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
60+
$plan1 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts1' -FromAzureRmVersion '6.13.1' -ToAzVersion '5.2.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
61+
$plan2 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts2' -FromAzureRmVersion '6.13.1' -ToAzVersion '5.2.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
62+
$plan3 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts3' -FromAzureRmVersion '6.13.1' -ToAzVersion '5.2.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
6363
#>
6464
[CmdletBinding()]
6565
Param
@@ -103,7 +103,7 @@ function New-AzUpgradeModulePlan
103103
Mandatory=$true,
104104
HelpMessage='Specify the Az module version to upgrade to.')]
105105
[System.String]
106-
[ValidateSet('4.8.0')]
106+
[ValidateSet('5.2.0')]
107107
$ToAzVersion,
108108

109109
[Parameter(Mandatory=$false)]

0 commit comments

Comments
 (0)