Skip to content

Commit dd37a10

Browse files
kirill-ivlevDmitrii Bobreshev (Akvelon INC)
and
Dmitrii Bobreshev (Akvelon INC)
authored
Add support of HTTP Proxy for AzureCLIV2 task (#19931)
* Add support of HTTP Proxy for AzureCLIV2 task * fix messages & rebuild task with right versions * bump task version * Add support of HTTP Proxy for AzureCLIV2 task - Added loc files --------- Co-authored-by: Dmitrii Bobreshev (Akvelon INC) <[email protected]>
1 parent 63938db commit dd37a10

File tree

13 files changed

+70
-31
lines changed

13 files changed

+70
-31
lines changed

Tasks/AzureCLIV2/Strings/resources.resjson/en-US/resources.resjson

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@
4848
"loc.messages.JS_InvalidErrorActionPreference": "Invalid ErrorActionPreference '%s'. The value must be one of: 'Stop', 'Continue', or 'SilentlyContinue'",
4949
"loc.messages.GlobalCliConfigAgentVersionWarning": "For agent version < 2.115.0, only global Azure CLI configuration can be used",
5050
"loc.messages.UnacceptedScriptLocationValue": "%s is not a valid value for task input 'Script Location' (scriptLocation in YAML). Value can either be'inlineScript' or 'scriptPath'",
51-
"loc.messages.ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at %s See https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections."
51+
"loc.messages.ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at %s See https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections.",
52+
"loc.messages.ProxyConfig": "az tool is configured to use %s as proxy server"
5253
}

Tasks/AzureCLIV2/azureclitask.ts

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ export class azureclitask {
1414
public static async runMain(): Promise<void> {
1515
var toolExecutionError = null;
1616
var exitCode: number = 0;
17+
18+
if(tl.getBoolFeatureFlag('AZP_AZURECLIV2_SETUP_PROXY_ENV')) {
19+
const proxyConfig: tl.ProxyConfiguration | null = tl.getHttpProxyConfiguration();
20+
if (proxyConfig) {
21+
process.env['HTTP_PROXY'] = proxyConfig.proxyFormattedUrl;
22+
process.env['HTTPS_PROXY'] = proxyConfig.proxyFormattedUrl;
23+
tl.debug(tl.loc('ProxyConfigMessage', proxyConfig.proxyUrl));
24+
}
25+
}
26+
1727
try{
1828
var scriptType: ScriptType = ScriptTypeFactory.getSriptType();
1929
var tool: any = await scriptType.getTool();

Tasks/AzureCLIV2/task.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"demands": [],
2020
"version": {
2121
"Major": 2,
22-
"Minor": 239,
23-
"Patch": 4
22+
"Minor": 241,
23+
"Patch": 0
2424
},
2525
"minimumAgentVersion": "2.0.0",
2626
"instanceNameFormat": "Azure CLI $(scriptPath)",
@@ -210,6 +210,7 @@
210210
"JS_InvalidErrorActionPreference": "Invalid ErrorActionPreference '%s'. The value must be one of: 'Stop', 'Continue', or 'SilentlyContinue'",
211211
"GlobalCliConfigAgentVersionWarning": "For agent version < 2.115.0, only global Azure CLI configuration can be used",
212212
"UnacceptedScriptLocationValue": "%s is not a valid value for task input 'Script Location' (scriptLocation in YAML). Value can either be'inlineScript' or 'scriptPath'",
213-
"ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at %s See https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections."
213+
"ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at %s See https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections.",
214+
"ProxyConfig":"az tool is configured to use %s as proxy server"
214215
}
215216
}

Tasks/AzureCLIV2/task.loc.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"demands": [],
2020
"version": {
2121
"Major": 2,
22-
"Minor": 239,
23-
"Patch": 4
22+
"Minor": 241,
23+
"Patch": 0
2424
},
2525
"minimumAgentVersion": "2.0.0",
2626
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
@@ -210,6 +210,7 @@
210210
"JS_InvalidErrorActionPreference": "ms-resource:loc.messages.JS_InvalidErrorActionPreference",
211211
"GlobalCliConfigAgentVersionWarning": "ms-resource:loc.messages.GlobalCliConfigAgentVersionWarning",
212212
"UnacceptedScriptLocationValue": "ms-resource:loc.messages.UnacceptedScriptLocationValue",
213-
"ExpiredServicePrincipalMessageWithLink": "ms-resource:loc.messages.ExpiredServicePrincipalMessageWithLink"
213+
"ExpiredServicePrincipalMessageWithLink": "ms-resource:loc.messages.ExpiredServicePrincipalMessageWithLink",
214+
"ProxyConfig": "ms-resource:loc.messages.ProxyConfig"
214215
}
215216
}

_generated/AzureCLIV2.versionmap.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Default|2.239.4
2-
Node20_229_2|2.239.5
1+
Default|2.241.0
2+
Node20_229_2|2.241.1

_generated/AzureCLIV2/Strings/resources.resjson/en-US/resources.resjson

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@
4848
"loc.messages.JS_InvalidErrorActionPreference": "Invalid ErrorActionPreference '%s'. The value must be one of: 'Stop', 'Continue', or 'SilentlyContinue'",
4949
"loc.messages.GlobalCliConfigAgentVersionWarning": "For agent version < 2.115.0, only global Azure CLI configuration can be used",
5050
"loc.messages.UnacceptedScriptLocationValue": "%s is not a valid value for task input 'Script Location' (scriptLocation in YAML). Value can either be'inlineScript' or 'scriptPath'",
51-
"loc.messages.ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at %s See https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections."
51+
"loc.messages.ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at %s See https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections.",
52+
"loc.messages.ProxyConfig": "az tool is configured to use %s as proxy server"
5253
}

_generated/AzureCLIV2/azureclitask.ts

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ export class azureclitask {
1414
public static async runMain(): Promise<void> {
1515
var toolExecutionError = null;
1616
var exitCode: number = 0;
17+
18+
if(tl.getBoolFeatureFlag('AZP_AZURECLIV2_SETUP_PROXY_ENV')) {
19+
const proxyConfig: tl.ProxyConfiguration | null = tl.getHttpProxyConfiguration();
20+
if (proxyConfig) {
21+
process.env['HTTP_PROXY'] = proxyConfig.proxyFormattedUrl;
22+
process.env['HTTPS_PROXY'] = proxyConfig.proxyFormattedUrl;
23+
tl.debug(tl.loc('ProxyConfigMessage', proxyConfig.proxyUrl));
24+
}
25+
}
26+
1727
try{
1828
var scriptType: ScriptType = ScriptTypeFactory.getSriptType();
1929
var tool: any = await scriptType.getTool();

_generated/AzureCLIV2/task.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"demands": [],
2020
"version": {
2121
"Major": 2,
22-
"Minor": 239,
23-
"Patch": 4
22+
"Minor": 241,
23+
"Patch": 0
2424
},
2525
"minimumAgentVersion": "2.0.0",
2626
"instanceNameFormat": "Azure CLI $(scriptPath)",
@@ -210,10 +210,11 @@
210210
"JS_InvalidErrorActionPreference": "Invalid ErrorActionPreference '%s'. The value must be one of: 'Stop', 'Continue', or 'SilentlyContinue'",
211211
"GlobalCliConfigAgentVersionWarning": "For agent version < 2.115.0, only global Azure CLI configuration can be used",
212212
"UnacceptedScriptLocationValue": "%s is not a valid value for task input 'Script Location' (scriptLocation in YAML). Value can either be'inlineScript' or 'scriptPath'",
213-
"ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at\u00A0%s See\u00A0https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections."
213+
"ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at\u00A0%s See\u00A0https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections.",
214+
"ProxyConfig": "az tool is configured to use %s as proxy server"
214215
},
215216
"_buildConfigMapping": {
216-
"Default": "2.239.4",
217-
"Node20_229_2": "2.239.5"
217+
"Default": "2.241.0",
218+
"Node20_229_2": "2.241.1"
218219
}
219220
}

_generated/AzureCLIV2/task.loc.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"demands": [],
2020
"version": {
2121
"Major": 2,
22-
"Minor": 239,
23-
"Patch": 4
22+
"Minor": 241,
23+
"Patch": 0
2424
},
2525
"minimumAgentVersion": "2.0.0",
2626
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
@@ -210,10 +210,11 @@
210210
"JS_InvalidErrorActionPreference": "ms-resource:loc.messages.JS_InvalidErrorActionPreference",
211211
"GlobalCliConfigAgentVersionWarning": "ms-resource:loc.messages.GlobalCliConfigAgentVersionWarning",
212212
"UnacceptedScriptLocationValue": "ms-resource:loc.messages.UnacceptedScriptLocationValue",
213-
"ExpiredServicePrincipalMessageWithLink": "ms-resource:loc.messages.ExpiredServicePrincipalMessageWithLink"
213+
"ExpiredServicePrincipalMessageWithLink": "ms-resource:loc.messages.ExpiredServicePrincipalMessageWithLink",
214+
"ProxyConfig": "ms-resource:loc.messages.ProxyConfig"
214215
},
215216
"_buildConfigMapping": {
216-
"Default": "2.239.4",
217-
"Node20_229_2": "2.239.5"
217+
"Default": "2.241.0",
218+
"Node20_229_2": "2.241.1"
218219
}
219220
}

_generated/AzureCLIV2_Node20/Strings/resources.resjson/en-US/resources.resjson

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@
4848
"loc.messages.JS_InvalidErrorActionPreference": "Invalid ErrorActionPreference '%s'. The value must be one of: 'Stop', 'Continue', or 'SilentlyContinue'",
4949
"loc.messages.GlobalCliConfigAgentVersionWarning": "For agent version < 2.115.0, only global Azure CLI configuration can be used",
5050
"loc.messages.UnacceptedScriptLocationValue": "%s is not a valid value for task input 'Script Location' (scriptLocation in YAML). Value can either be'inlineScript' or 'scriptPath'",
51-
"loc.messages.ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at %s See https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections."
51+
"loc.messages.ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at %s See https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections.",
52+
"loc.messages.ProxyConfig": "az tool is configured to use %s as proxy server"
5253
}

_generated/AzureCLIV2_Node20/azureclitask.ts

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ export class azureclitask {
1414
public static async runMain(): Promise<void> {
1515
var toolExecutionError = null;
1616
var exitCode: number = 0;
17+
18+
if(tl.getBoolFeatureFlag('AZP_AZURECLIV2_SETUP_PROXY_ENV')) {
19+
const proxyConfig: tl.ProxyConfiguration | null = tl.getHttpProxyConfiguration();
20+
if (proxyConfig) {
21+
process.env['HTTP_PROXY'] = proxyConfig.proxyFormattedUrl;
22+
process.env['HTTPS_PROXY'] = proxyConfig.proxyFormattedUrl;
23+
tl.debug(tl.loc('ProxyConfigMessage', proxyConfig.proxyUrl));
24+
}
25+
}
26+
1727
try{
1828
var scriptType: ScriptType = ScriptTypeFactory.getSriptType();
1929
var tool: any = await scriptType.getTool();

_generated/AzureCLIV2_Node20/task.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"demands": [],
2020
"version": {
2121
"Major": 2,
22-
"Minor": 239,
23-
"Patch": 5
22+
"Minor": 241,
23+
"Patch": 1
2424
},
2525
"minimumAgentVersion": "2.0.0",
2626
"instanceNameFormat": "Azure CLI $(scriptPath)",
@@ -214,10 +214,11 @@
214214
"JS_InvalidErrorActionPreference": "Invalid ErrorActionPreference '%s'. The value must be one of: 'Stop', 'Continue', or 'SilentlyContinue'",
215215
"GlobalCliConfigAgentVersionWarning": "For agent version < 2.115.0, only global Azure CLI configuration can be used",
216216
"UnacceptedScriptLocationValue": "%s is not a valid value for task input 'Script Location' (scriptLocation in YAML). Value can either be'inlineScript' or 'scriptPath'",
217-
"ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at\u00A0%s See\u00A0https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections."
217+
"ExpiredServicePrincipalMessageWithLink": "Secret expired, update service connection at\u00A0%s See\u00A0https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections.",
218+
"ProxyConfig": "az tool is configured to use %s as proxy server"
218219
},
219220
"_buildConfigMapping": {
220-
"Default": "2.239.4",
221-
"Node20_229_2": "2.239.5"
221+
"Default": "2.241.0",
222+
"Node20_229_2": "2.241.1"
222223
}
223224
}

_generated/AzureCLIV2_Node20/task.loc.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"demands": [],
2020
"version": {
2121
"Major": 2,
22-
"Minor": 239,
23-
"Patch": 5
22+
"Minor": 241,
23+
"Patch": 1
2424
},
2525
"minimumAgentVersion": "2.0.0",
2626
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
@@ -214,10 +214,11 @@
214214
"JS_InvalidErrorActionPreference": "ms-resource:loc.messages.JS_InvalidErrorActionPreference",
215215
"GlobalCliConfigAgentVersionWarning": "ms-resource:loc.messages.GlobalCliConfigAgentVersionWarning",
216216
"UnacceptedScriptLocationValue": "ms-resource:loc.messages.UnacceptedScriptLocationValue",
217-
"ExpiredServicePrincipalMessageWithLink": "ms-resource:loc.messages.ExpiredServicePrincipalMessageWithLink"
217+
"ExpiredServicePrincipalMessageWithLink": "ms-resource:loc.messages.ExpiredServicePrincipalMessageWithLink",
218+
"ProxyConfig": "ms-resource:loc.messages.ProxyConfig"
218219
},
219220
"_buildConfigMapping": {
220-
"Default": "2.239.4",
221-
"Node20_229_2": "2.239.5"
221+
"Default": "2.241.0",
222+
"Node20_229_2": "2.241.1"
222223
}
223224
}

0 commit comments

Comments
 (0)