File tree Expand file tree Collapse file tree 4 files changed +24
-40
lines changed Expand file tree Collapse file tree 4 files changed +24
-40
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,28 @@ if ($targetAzurePs -eq $latestVersion) {
4848
4949$serviceName = Get-VstsInput - Name ConnectedServiceNameARM - Require
5050$endpoint = Get-VstsEndpoint - Name $serviceName - Require
51- $env: PSModulePath = Get-VstsTaskVariable - Name " AZ_PS_MODULE_PATH"
51+
52+ $azureRMModulePath = " C:\Modules\azurerm_2.1.0"
53+ $azureModulePath = " C:\Modules\azure_2.1.0"
54+ $azPSModulePath = $env: PSModulePath
55+
56+ if ($azPSModulePath.split (" ;" ) -contains $azureRMModulePath ) {
57+ $azPSModulePath = (($azPSModulePath ).Split(" ;" ) | ? { $_ -ne $azureRMModulePath }) -join " ;"
58+ write-verbose " $azureRMModulePath removed. Restart the prompt for the changes to take effect."
59+ }
60+ else {
61+ write-verbose " $azureRMModulePath is not present in $azPSModulePath "
62+ }
63+
64+ if ($azPSModulePath.split (" ;" ) -contains $azureModulePath ) {
65+ $azPSModulePath = (($azPSModulePath ).Split(" ;" ) | ? { $_ -ne $azureModulePath }) -join " ;"
66+ write-verbose " $azureModulePath removed. Restart the prompt for the changes to take effect."
67+ }
68+ else {
69+ write-verbose " $azureModulePath is not present in $azPSModulePath "
70+ }
71+
72+ $env: PSModulePath = $azPSModulePath
5273
5374Update-PSModulePathForHostedAgent - targetAzurePs $targetAzurePs
5475
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1717 "version" : {
1818 "Major" : 4 ,
1919 "Minor" : 157 ,
20- "Patch" : 3
20+ "Patch" : 4
2121 },
2222 "preview" : true ,
2323 "releaseNotes" : " Added support for Az Module and cross platform agents." ,
143143 }
144144 ],
145145 "instanceNameFormat" : " Azure PowerShell script: $(ScriptType)" ,
146- "prejobexecution" : {
147- "PowerShell3" : {
148- "target" : " PreJobExecutionAzurePowerShell.ps1" ,
149- "platforms" : [
150- " windows"
151- ]
152- }
153- },
154146 "execution" : {
155147 "PowerShell3" : {
156148 "target" : " azurepowershell.ps1" ,
Original file line number Diff line number Diff line change 1717 "version" : {
1818 "Major" : 4 ,
1919 "Minor" : 157 ,
20- "Patch" : 3
20+ "Patch" : 4
2121 },
2222 "preview" : true ,
2323 "releaseNotes" : " ms-resource:loc.releaseNotes" ,
143143 }
144144 ],
145145 "instanceNameFormat" : " ms-resource:loc.instanceNameFormat" ,
146- "prejobexecution" : {
147- "PowerShell3" : {
148- "target" : " PreJobExecutionAzurePowerShell.ps1" ,
149- "platforms" : [
150- " windows"
151- ]
152- }
153- },
154146 "execution" : {
155147 "PowerShell3" : {
156148 "target" : " azurepowershell.ps1" ,
You can’t perform that action at this time.
0 commit comments