Skip to content

Commit

Permalink
Support Az 6.1 (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
dingmeng-xue authored Jun 23, 2021
1 parent b1fba7a commit 3516ce0
Show file tree
Hide file tree
Showing 84 changed files with 23,366 additions and 6,092 deletions.
1 change: 1 addition & 0 deletions docs/how-to-update-az-module-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Occasionally, these should be updated to latest. This document describes how to
Have the following installed on your system:

* PowerShell 7.x or later.
* Pester 4.10.1 (5.* cannot work due to breaking change)
* Cloned the [azure-powershell-migration](https://github.com/Azure/azure-powershell-migration)
GitHub repository to your local computer.

Expand Down
6 changes: 3 additions & 3 deletions docs/quickstart-migrate-azurerm-to-az-automatically.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ points that require changes when moving from AzureRM to the Az PowerShell cmdlet
```powershell
# Generate an upgrade plan for the specified PowerShell script and save it to a variable.
$Plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.6.0 -FilePath 'C:\Scripts\my-azure-script.ps1'
$Plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 6.1.0 -FilePath 'C:\Scripts\my-azure-script.ps1'
```

```powershell
# Generate an upgrade plan for all the scripts and module files in the specified folder and save it to a variable.
$Plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.6.0 -DirectoryPath 'C:\Scripts'
$Plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 6.1.0 -DirectoryPath 'C:\Scripts'
```

Review the results of the upgrade plan.
Expand Down Expand Up @@ -106,7 +106,7 @@ $Results | Where-Object UpgradeResult -ne UpgradeCompleted | Format-List

* File I/O operations use default encoding. Unusual file encoding situations may cause problems.
* AzureRM cmdlets passed as arguments to Pester unit test mock statements aren't detected.
* Currently, only Az PowerShell module version 5.6.0 is supported as a target.
* Currently, only Az PowerShell module version 6.1.0 is supported as a target.

## Next steps

Expand Down
4 changes: 2 additions & 2 deletions powershell-module/Az.Tools.Migration/Az.Tools.Migration.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RootModule = 'Az.Tools.Migration.psm1'

# Version number of this module.
ModuleVersion = '1.1.1'
ModuleVersion = '1.1.2'

# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'
Expand Down Expand Up @@ -108,7 +108,7 @@
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '* Fixed a bug in Invoke-AzUpgradeModulePlan where dynamic parameters are incorrectly updated (issue #81).'
ReleaseNotes = '* Upgrade Az version to 6.1.0'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ function Get-AzUpgradeAliasSpec
Specify the version of the module to import command aliases from.
.EXAMPLE
PS C:\> Get-AzUpgradeAliasSpec -ModuleVersion "5.6.0"
Returns the cmdlet alias mappings table for Az 5.6.0.
PS C:\> Get-AzUpgradeAliasSpec -ModuleVersion "6.1.0"
Returns the cmdlet alias mappings table for Az 6.1.0.
#>
[CmdletBinding()]
Param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Invoke-AzUpgradeModulePlan
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).
# step 1: generate a plan and save it to a variable.
$plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.6.0 -DirectoryPath 'C:\Scripts\myModule'
$plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 6.1.0 -DirectoryPath 'C:\Scripts\myModule'
# step 2: write the plan to the console to review the upgrade steps, warnings, and errors.
$plan
Expand All @@ -38,7 +38,7 @@ function Invoke-AzUpgradeModulePlan
The following example invokes the upgrade plan for a PowerShell module named "myModule" and modifies the existing files in place.
# step 1: generate a plan and save it to a variable.
$plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.6.0 -DirectoryPath 'C:\Scripts\myModule'
$plan = New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 6.1.0 -DirectoryPath 'C:\Scripts\myModule'
# step 2: write the plan to the console to review the upgrade steps, warnings, and errors.
$plan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function New-AzUpgradeModulePlan
Specifies the AzureRM module version used in your existing PowerShell scripts(s) or modules.
.PARAMETER ToAzVersion
Specifies the Az module version to upgrade to. Currently, only Az version 5.6.0 is supported.
Specifies the Az module version to upgrade to. Currently, only Az version 6.1.0 is supported.
.PARAMETER FilePath
Specifies the path to a single PowerShell file.
Expand All @@ -34,32 +34,32 @@ function New-AzUpgradeModulePlan
.EXAMPLE
The following example generates a new Az module upgrade plan for the script file 'C:\Scripts\my-azure-script.ps1'.
New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.6.0 -FilePath 'C:\Scripts\my-azure-script.ps1'
New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 6.1.0 -FilePath 'C:\Scripts\my-azure-script.ps1'
.EXAMPLE
The following example generates a new Az module upgrade plan for the script and module files located under C:\Scripts.
New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 5.6.0 -DirectoryPath 'C:\Scripts'
New-AzUpgradeModulePlan -FromAzureRmVersion 6.13.1 -ToAzVersion 6.1.0 -DirectoryPath 'C:\Scripts'
.EXAMPLE
The following example generates a new Az module upgrade plan for the script and module files under C:\Scripts.
$references = Find-AzUpgradeCommandReference -DirectoryPath 'C:\Scripts' -AzureRmVersion '6.13.1'
New-AzUpgradeModulePlan -ToAzVersion 5.6.0 -AzureRmCmdReference $references
New-AzUpgradeModulePlan -ToAzVersion 6.1.0 -AzureRmCmdReference $references
.EXAMPLE
The following example generates a new Az module upgrade plan for the script and module files under several directories.
Module specs are pre-loaded here to avoid re-loading the spec each time a plan is generated.
# pre-load specifications
$armSpec = Get-AzUpgradeCmdletSpec -ModuleName "AzureRM" -ModuleVersion "6.13.1"
$azSpec = Get-AzUpgradeCmdletSpec -ModuleName "Az" -ModuleVersion "5.6.0"
$azAliases = Get-AzUpgradeAliasSpec -ModuleVersion "5.6.0"
$azSpec = Get-AzUpgradeCmdletSpec -ModuleName "Az" -ModuleVersion "6.1.0"
$azAliases = Get-AzUpgradeAliasSpec -ModuleVersion "6.1.0"
# execute a batch of module upgrades
$plan1 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts1' -FromAzureRmVersion '6.13.1' -ToAzVersion '5.6.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
$plan2 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts2' -FromAzureRmVersion '6.13.1' -ToAzVersion '5.6.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
$plan3 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts3' -FromAzureRmVersion '6.13.1' -ToAzVersion '5.6.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
$plan1 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts1' -FromAzureRmVersion '6.13.1' -ToAzVersion '6.1.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
$plan2 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts2' -FromAzureRmVersion '6.13.1' -ToAzVersion '6.1.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
$plan3 = New-AzUpgradeModulePlan -DirectoryPath 'C:\Scripts3' -FromAzureRmVersion '6.13.1' -ToAzVersion '6.1.0' -AzureRmModuleSpec $armSpec -AzModuleSpec $azSpec -AzAliasMappingSpec $azAliases
#>
[CmdletBinding()]
Param
Expand Down Expand Up @@ -103,7 +103,7 @@ function New-AzUpgradeModulePlan
Mandatory=$true,
HelpMessage='Specify the Az module version to upgrade to.')]
[System.String]
[ValidateSet('5.6.0')]
[ValidateSet('6.1.0')]
$ToAzVersion,

[Parameter(Mandatory=$false)]
Expand Down
Loading

0 comments on commit 3516ce0

Please sign in to comment.