Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure cli path undefined fix. #8953

Merged
merged 3 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"loc.input.label.args": "Arguments",
"loc.input.help.args": "Arguments passed to the script",
"loc.input.label.addSpnToEnvironment": "Access service principal details in script",
"loc.input.help.addSpnToEnvironment": "Adds service principal id and key of the Azure subscription endpoint you chose, to the script's execution environment. You can use these variables: `$servicePrincipalId` and `$servicePrincipalKey` in your script",
"loc.input.help.addSpnToEnvironment": "Adds service principal id and key of the Azure subscription endpoint you chose to the script's execution environment. You can use these variables: `$servicePrincipalId` and `$servicePrincipalKey` in your script",
hiyadav marked this conversation as resolved.
Show resolved Hide resolved
"loc.input.label.cwd": "Working Directory",
"loc.input.help.cwd": "Current working directory where the script is run. Empty is the root of the repo (build) or artifacts (release), which is $(System.DefaultWorkingDirectory)",
"loc.input.label.failOnStandardError": "Fail on Standard Error",
Expand All @@ -27,5 +27,6 @@
"loc.messages.AzureSDKNotFound": "Azure CLI 2.x is not installed on this machine.",
"loc.messages.FailedToLogout": "The following error occurred while logging out: %s",
"loc.messages.LoginFailed": "Azure login failed",
"loc.messages.ErrorInSettingUpSubscription": "Error in setting up subscription"
"loc.messages.ErrorInSettingUpSubscription": "Error in setting up subscription",
"loc.messages.SettingAzureConfigDir": "Setting AZURE_CONFIG_DIR env variable to: %s"
}
11 changes: 8 additions & 3 deletions Tasks/AzureCLIV1/azureclitask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,19 @@ export class azureclitask {

private static setConfigDirectory(): void {
var configDirName: string = "c" + new Date().getTime(); // 'c' denotes config
var basePath: string;
if (tl.osType().match(/^Win/)) {
this.azCliConfigPath = path.join(process.env.USERPROFILE, ".azclitask", configDirName);
basePath = process.env.USERPROFILE;
}
else {
this.azCliConfigPath = path.join(process.env.HOME, ".azclitask", configDirName);
basePath = process.env.HOME;
}

process.env['AZURE_CONFIG_DIR'] = this.azCliConfigPath;
if (!!basePath) {
this.azCliConfigPath = path.join(basePath, ".azclitask", configDirName);
tl.debug(tl.loc('SettingAzureConfigDir', this.azCliConfigPath));
process.env['AZURE_CONFIG_DIR'] = this.azCliConfigPath;
}
}

private static logoutAzure() {
Expand Down
5 changes: 3 additions & 2 deletions Tasks/AzureCLIV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"version": {
"Major": 1,
"Minor": 143,
hiyadav marked this conversation as resolved.
Show resolved Hide resolved
"Patch": 2
"Patch": 3
},
"minimumAgentVersion": "2.0.0",
"instanceNameFormat": "Azure CLI $(scriptPath)",
Expand Down Expand Up @@ -134,6 +134,7 @@
"AzureSDKNotFound": "Azure CLI 2.x is not installed on this machine.",
"FailedToLogout": "The following error occurred while logging out: %s",
"LoginFailed": "Azure login failed",
"ErrorInSettingUpSubscription": "Error in setting up subscription"
"ErrorInSettingUpSubscription": "Error in setting up subscription",
"SettingAzureConfigDir": "Setting AZURE_CONFIG_DIR env variable to: %s"
}
}
5 changes: 3 additions & 2 deletions Tasks/AzureCLIV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"version": {
"Major": 1,
"Minor": 143,
"Patch": 2
"Patch": 3
},
"minimumAgentVersion": "2.0.0",
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down Expand Up @@ -134,6 +134,7 @@
"AzureSDKNotFound": "ms-resource:loc.messages.AzureSDKNotFound",
"FailedToLogout": "ms-resource:loc.messages.FailedToLogout",
"LoginFailed": "ms-resource:loc.messages.LoginFailed",
"ErrorInSettingUpSubscription": "ms-resource:loc.messages.ErrorInSettingUpSubscription"
"ErrorInSettingUpSubscription": "ms-resource:loc.messages.ErrorInSettingUpSubscription",
"SettingAzureConfigDir": "ms-resource:loc.messages.SettingAzureConfigDir"
}
}