Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Tasks/AzureCLIV2/azureclitask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,18 @@ export class azureclitask {
if (versionCommand) {
azVersionResult = tl.execSync("az", "version");

if (azVersionResult.code !== 0 || azVersionResult.stderr) {
tl.debug("az version failed, falling back to 'az --version'");
if (azVersionResult.code !== 0 || azVersionResult.stderr || !azVersionResult.stdout || azVersionResult.stdout.trim() === '') {
tl.debug("az version failed or returned empty output, falling back to 'az --version'");
azVersionResult = tl.execSync("az", "--version");
}
}
}
else {
// Default case: always run with "--version"
azVersionResult = tl.execSync("az", "--version");
}

Utility.throwIfError(azVersionResult);
tl.debug(`---------------------print the value of azversion result--------------------: ${azVersionResult.stdout}`);
this.isSupportCertificateParameter = this.isAzVersionGreaterOrEqual(azVersionResult.stdout, "2.66.0");
await validateAzModuleVersion("azure-Cli", azVersionResult.stdout, "Azure-Cli", minorVersionTolerance)

Expand Down Expand Up @@ -226,6 +227,7 @@ export class azureclitask {
}

if (!versionMatch || versionMatch.length < 2) {
tl.debug(`---------------------print the value of version match--------------------: ${versionMatch}`);
tl.error(`Can't parse az version from: ${azVersionResultOutput}`);
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureCLIV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"version": {
"Major": 2,
"Minor": 264,
"Patch": 0
"Patch": 20
},
"minimumAgentVersion": "2.0.0",
"instanceNameFormat": "Azure CLI $(scriptPath)",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureCLIV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"version": {
"Major": 2,
"Minor": 264,
"Patch": 0
"Patch": 20
},
"minimumAgentVersion": "2.0.0",
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down