diff --git a/src/cleanup.ts b/src/cleanup.ts index e3ea46001..45520d2e8 100644 --- a/src/cleanup.ts +++ b/src/cleanup.ts @@ -1,10 +1,12 @@ import * as core from '@actions/core'; import * as exec from '@actions/exec'; +import * as io from '@actions/io'; async function cleanup() { try { + let azPath = await io.which("az", true); core.info("Clearing accounts from the local cache.") - await exec.exec("az", ["account", "clear"]); + await exec.exec(`"${azPath}"`, ["account", "clear"]); } catch (error) { core.setFailed(`Login cleanup failed with ${error}.`); diff --git a/src/setup.ts b/src/setup.ts index 067549469..da8070ea1 100644 --- a/src/setup.ts +++ b/src/setup.ts @@ -11,7 +11,7 @@ async function setup() { core.debug(`Azure CLI path: ${azPath}`); core.info("Clearing accounts from the local cache.") - await exec.exec("az", ["account", "clear"]); + await exec.exec(`"${azPath}"`, ["account", "clear"]); } catch (error) { core.setFailed(`Login setup failed with ${error}. Make sure 'az' is installed on the runner.`);