Skip to content

Commit f5b22d9

Browse files
Update PS AzureRM -> Az (#19879)
* Update PS AzureRM -> Az - Remove AzureRM only if it was installed - Try to initialize az modules only certain versions * Update PS AzureRM -> Az - Remove AzureRM only if it was installed - Try to initialize az modules only certain versions * Update PS AzureRM -> Az - Remove AzureRM only if it was installed - Try to initialize az modules only certain versions
1 parent e285285 commit f5b22d9

File tree

62 files changed

+184
-187
lines changed

Some content is hidden

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

62 files changed

+184
-187
lines changed

Tasks/AzureCloudPowerShellDeploymentV1/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"author": "Microsoft Corporation",
1717
"version": {
1818
"Major": 1,
19-
"Minor": 239,
20-
"Patch": 2
19+
"Minor": 240,
20+
"Patch": 0
2121
},
2222
"demands": [
2323
"azureps"

Tasks/AzureCloudPowerShellDeploymentV1/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"author": "Microsoft Corporation",
1717
"version": {
1818
"Major": 1,
19-
"Minor": 239,
20-
"Patch": 2
19+
"Minor": 240,
20+
"Patch": 0
2121
},
2222
"demands": [
2323
"azureps"

Tasks/AzureCloudPowerShellDeploymentV2/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"author": "Microsoft Corporation",
1717
"version": {
1818
"Major": 2,
19-
"Minor": 239,
20-
"Patch": 2
19+
"Minor": 240,
20+
"Patch": 0
2121
},
2222
"demands": [
2323
"azureps"

Tasks/AzureCloudPowerShellDeploymentV2/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"author": "Microsoft Corporation",
1717
"version": {
1818
"Major": 2,
19-
"Minor": 239,
20-
"Patch": 2
19+
"Minor": 240,
20+
"Patch": 0
2121
},
2222
"demands": [
2323
"azureps"

Tasks/AzureFileCopyV1/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 1,
16-
"Minor": 239,
17-
"Patch": 4
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV1/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 1,
16-
"Minor": 239,
17-
"Patch": 4
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV2/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 2,
16-
"Minor": 239,
17-
"Patch": 6
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV2/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 2,
16-
"Minor": 239,
17-
"Patch": 6
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV3/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 3,
16-
"Minor": 239,
17-
"Patch": 6
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV3/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 3,
16-
"Minor": 239,
17-
"Patch": 6
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV4/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 4,
16-
"Minor": 239,
17-
"Patch": 6
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV4/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 4,
16-
"Minor": 239,
17-
"Patch": 6
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV5/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 5,
16-
"Minor": 239,
17-
"Patch": 8
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV5/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 5,
16-
"Minor": 239,
17-
"Patch": 8
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV6/task.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 6,
1616
"Minor": 240,
17-
"Patch": 0
17+
"Patch": 2
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV6/task.loc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 6,
1616
"Minor": 240,
17-
"Patch": 0
17+
"Patch": 2
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzurePowerShellV2/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 2,
20-
"Minor": 239,
21-
"Patch": 2
20+
"Minor": 240,
21+
"Patch": 0
2222
},
2323
"demands": [
2424
"azureps"

Tasks/AzurePowerShellV2/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 2,
20-
"Minor": 239,
21-
"Patch": 2
20+
"Minor": 240,
21+
"Patch": 0
2222
},
2323
"demands": [
2424
"azureps"

Tasks/AzurePowerShellV3/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 3,
20-
"Minor": 239,
21-
"Patch": 2
20+
"Minor": 240,
21+
"Patch": 0
2222
},
2323
"releaseNotes": "Added support for Fail on standard error and ErrorActionPreference",
2424
"demands": [

Tasks/AzurePowerShellV3/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 3,
20-
"Minor": 239,
21-
"Patch": 2
20+
"Minor": 240,
21+
"Patch": 0
2222
},
2323
"releaseNotes": "ms-resource:loc.releaseNotes",
2424
"demands": [

Tasks/AzurePowerShellV4/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 4,
20-
"Minor": 239,
21-
"Patch": 6
20+
"Minor": 240,
21+
"Patch": 0
2222
},
2323
"releaseNotes": "Added support for Az Module and cross platform agents.",
2424
"groups": [

Tasks/AzurePowerShellV4/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 4,
20-
"Minor": 239,
21-
"Patch": 6
20+
"Minor": 240,
21+
"Patch": 0
2222
},
2323
"releaseNotes": "ms-resource:loc.releaseNotes",
2424
"groups": [

Tasks/AzurePowerShellV5/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 5,
20-
"Minor": 239,
21-
"Patch": 10
20+
"Minor": 240,
21+
"Patch": 0
2222
},
2323
"releaseNotes": "Added support for Az Module and cross platform agents.",
2424
"groups": [

Tasks/AzurePowerShellV5/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 5,
20-
"Minor": 239,
21-
"Patch": 10
20+
"Minor": 240,
21+
"Patch": 0
2222
},
2323
"releaseNotes": "ms-resource:loc.releaseNotes",
2424
"groups": [

Tasks/Common/VstsAzureHelpers_/InitializeAzModuleFunctions.ps1

+12-15
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function Initialize-AzModules {
9090

9191
try {
9292
$azAccountsModuleName = "Az.Accounts"
93-
$azAccountsVersion = Import-SpecificAzModule -moduleName $azAccountsModuleName -tryInstallModule:$tryInstallModule
93+
$azAccountsVersion = Import-SpecificAzModule -moduleName $azAccountsModuleName -tryInstallModule:$tryInstallModule -minimumMajorVersion 2
9494
Write-Verbose "'$azAccountsModuleName' is available with version $azAccountsVersion."
9595

9696
# Update-AzConfig is a part of Az.Accounts
@@ -112,11 +112,11 @@ function Initialize-AzModules {
112112
}
113113

114114
$azResourcesModuleName = "Az.Resources"
115-
$azResourcesVersion = Import-SpecificAzModule -moduleName $azResourcesModuleName -tryInstallModule:$tryInstallModule
115+
$azResourcesVersion = Import-SpecificAzModule -moduleName $azResourcesModuleName -tryInstallModule:$tryInstallModule -minimumMajorVersion 6
116116
Write-Verbose "'$azResourcesModuleName' is available with version $azResourcesVersion."
117117

118118
$azStorageModuleName = "Az.Storage"
119-
$azStorageVersion = Import-SpecificAzModule -moduleName $azStorageModuleName -tryInstallModule:$tryInstallModule
119+
$azStorageVersion = Import-SpecificAzModule -moduleName $azStorageModuleName -tryInstallModule:$tryInstallModule -minimumMajorVersion 4
120120
Write-Verbose "'$azStorageModuleName' is available with version $azStorageVersion."
121121
return $azAccountsVersion
122122
} finally {
@@ -133,14 +133,17 @@ function Import-SpecificAzModule {
133133
[string]$moduleName,
134134

135135
[Parameter()]
136-
[switch]$tryInstallModule
136+
[switch]$tryInstallModule,
137+
138+
[Parameter(Mandatory=$true)]
139+
[int]$minimumMajorVersion
137140
)
138141
Trace-VstsEnteringInvocation $MyInvocation
139142
try {
140143
Write-Verbose "Attempting to find the latest available version of module '$moduleName'."
141144
$module = Get-Module -Name $moduleName -ListAvailable | Sort-Object Version -Descending | Select-Object -First 1
142145

143-
if ($module) {
146+
if ($module -and ($module.Version.Major -ge $minimumMajorVersion)) {
144147
Write-Verbose "Module '$moduleName' version $($module.Version) was found."
145148
} elseif ($tryInstallModule -eq $true) {
146149
Write-Verbose "Unable to find module '$moduleName' from the module path. Installing '$moduleName' module."
@@ -150,8 +153,8 @@ function Import-SpecificAzModule {
150153
$module = Get-Module -Name $moduleName -ListAvailable | Sort-Object Version -Descending | Select-Object -First 1
151154
}
152155

153-
if (-not $module) {
154-
throw (Get-VstsLocString -Key AZ_ModuleNotFound -ArgumentList $moduleName)
156+
if (-not $module -or ($module.Version.Major -lt $minimumMajorVersion) ) {
157+
throw (Get-VstsLocString -Key AZ_ModuleNotFound -ArgumentList $minimumMajorVersion, $moduleName)
155158
}
156159

157160
Write-Host "##[command]Import-Module -Name $($module.Path) -Global -PassThru -Force"
@@ -223,16 +226,10 @@ function Uninstall-AzureRMModules {
223226
Write-Verbose "Uninstalling AzureRM modules."
224227

225228
if ((Get-Module -ListAvailable -Name Az.Accounts) -and (Get-Command Uninstall-AzureRm -ErrorAction SilentlyContinue)) {
226-
Write-Host "##[command]Uninstall-AzureRm"
227-
Uninstall-AzureRm
228-
229-
Write-Verbose "Making sure all AzureRM modules are gone after the uninstall."
230-
231229
$azureRmModules = Get-Module -ListAvailable -Name AzureRM.* | Select-Object Name,Version
232230
if ($azureRmModules) {
233-
Foreach ($azureRmModule in $azureRmModules) {
234-
Write-Verbose "'$($azureRmModule)' AzureRM module found."
235-
}
231+
Write-Host "##[command]Uninstall-AzureRm"
232+
Uninstall-AzureRm
236233
}
237234
else {
238235
Write-Verbose "No AzureRM modules found."

Tasks/SqlAzureDacpacDeploymentV1/task.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"author": "Microsoft Corporation",
1717
"version": {
1818
"Major": 1,
19-
"Minor": 239,
20-
"Patch": 2
19+
"Minor": 240,
20+
"Patch": 0
2121
},
2222
"demands": [
2323
"sqlpackage"

Tasks/SqlAzureDacpacDeploymentV1/task.loc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"author": "Microsoft Corporation",
1717
"version": {
1818
"Major": 1,
19-
"Minor": 239,
20-
"Patch": 2
19+
"Minor": 240,
20+
"Patch": 0
2121
},
2222
"demands": [
2323
"sqlpackage"
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Default|2.239.6
2-
Node20_229_2|2.239.7
1+
Default|2.240.0
2+
Node20_229_2|2.240.1

_generated/AzureFileCopyV2/task.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 2,
16-
"Minor": 239,
17-
"Patch": 6
16+
"Minor": 240,
17+
"Patch": 0
1818
},
1919
"demands": [
2020
"azureps"
@@ -374,7 +374,7 @@
374374
"ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired."
375375
},
376376
"_buildConfigMapping": {
377-
"Default": "2.239.6",
378-
"Node20_229_2": "2.239.7"
377+
"Default": "2.240.0",
378+
"Node20_229_2": "2.240.1"
379379
}
380380
}

0 commit comments

Comments
 (0)