export async function cleanupAzPSAccounts()

in src/common/Utils.ts [21:30]


export async function cleanupAzPSAccounts(): Promise<void> {
    let psPath: string = await io.which(AzPSConstants.PowerShell_CmdName, true);
    core.debug(`PowerShell path: ${psPath}`);
    core.debug("Importing Azure PowerShell module.");
    AzPSUtils.setPSModulePathForGitHubRunner();
    await AzPSUtils.importLatestAzAccounts();
    core.info("Clearing azure powershell accounts from the local cache.");
    await exec.exec(`"${psPath}"`, ["-Command", "Clear-AzContext", "-Scope", "Process"]);
    await exec.exec(`"${psPath}"`, ["-Command", "Clear-AzContext", "-Scope", "CurrentUser", "-Force", "-ErrorAction", "SilentlyContinue"]);
}