mirror of
https://github.com/azure/login.git
synced 2026-03-13 18:17:09 -04:00
fix #403
This commit is contained in:
@@ -17,6 +17,9 @@ export class AzureCliLogin {
|
||||
async login() {
|
||||
core.info(`Running Azure CLI Login.`);
|
||||
this.azPath = await io.which("az", true);
|
||||
if (!this.azPath) {
|
||||
throw new Error("Azure CLI is not found in the runner.");
|
||||
}
|
||||
core.debug(`Azure CLI path: ${this.azPath}`);
|
||||
|
||||
let output: string = "";
|
||||
|
||||
@@ -71,6 +71,9 @@ export class AzPSUtils {
|
||||
};
|
||||
|
||||
let psPath: string = await io.which(AzPSConstants.PowerShell_CmdName, true);
|
||||
if (!psPath) {
|
||||
throw new Error("PowerShell is not found in the runner.");
|
||||
}
|
||||
await exec.exec(`"${psPath}"`, ["-Command", psScript], options)
|
||||
if (commandStdErr) {
|
||||
throw new Error('Azure PowerShell login failed with errors.');
|
||||
|
||||
@@ -14,7 +14,8 @@ export function setUserAgent(): void {
|
||||
export async function cleanupAzCLIAccounts(): Promise<void> {
|
||||
let azPath = await io.which("az", true);
|
||||
if (!azPath) {
|
||||
throw new Error("Azure CLI is not found in the runner.");
|
||||
core.warning("Azure CLI is not found in the runner.");
|
||||
return;
|
||||
}
|
||||
core.debug(`Azure CLI path: ${azPath}`);
|
||||
core.info("Clearing azure cli accounts from the local cache.");
|
||||
@@ -24,7 +25,8 @@ export async function cleanupAzCLIAccounts(): Promise<void> {
|
||||
export async function cleanupAzPSAccounts(): Promise<void> {
|
||||
let psPath: string = await io.which(AzPSConstants.PowerShell_CmdName, true);
|
||||
if (!psPath) {
|
||||
throw new Error("PowerShell is not found in the runner.");
|
||||
core.warning("PowerShell is not found in the runner.");
|
||||
return;
|
||||
}
|
||||
core.debug(`PowerShell path: ${psPath}`);
|
||||
core.debug("Importing Azure PowerShell module.");
|
||||
|
||||
Reference in New Issue
Block a user