mirror of
https://github.com/azure/login.git
synced 2026-06-06 00:17:07 +00:00
fix #403
This commit is contained in:
parent
2d38cb8921
commit
1e4938326b
3 changed files with 10 additions and 2 deletions
|
|
@ -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.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue