diff --git a/ext/azuredevops/setupAzd/index.ts b/ext/azuredevops/setupAzd/index.ts index 336ef44a051..38e66edcbde 100644 --- a/ext/azuredevops/setupAzd/index.ts +++ b/ext/azuredevops/setupAzd/index.ts @@ -59,7 +59,8 @@ Read more about Azure Developer CLI telemetry: https://github.com/Azure/azure-de console.log(`Installing azd from ${url}`); const buffer = await download(url); const extractedTo = path.join(task.cwd(), "azd-install"); - await decompress(buffer, extractedTo); + const extractedToAbsolutePath = path.resolve(extractedTo); + await decompress(buffer, extractedToAbsolutePath); let binName; if (os !== "win32") { @@ -67,12 +68,15 @@ Read more about Azure Developer CLI telemetry: https://github.com/Azure/azure-de } else { binName = "azd.exe"; } - const binPath = path.join(extractedTo, binName); + const binPath = path.join(extractedToAbsolutePath, binName); // This is not symlinkSync as setup-azd GitHub Action due to Self-Host Agent permission error - fs.copyFileSync(path.join(extractedTo, installArray[1]), binPath); - task.prependPath(extractedTo); - console.log(`azd installed to ${extractedTo}`); + fs.copyFileSync( + path.join(extractedToAbsolutePath, installArray[1]), + binPath + ); + task.prependPath(extractedToAbsolutePath); + console.log(`azd installed to ${extractedToAbsolutePath}`); task.execSync(binPath, "version"); } catch (err: any) {