Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.4] - 2026-02-12
### Added
- Added support for windows arm64

## [0.9.3] - 2026-02-12
### Added
- Added support for linux x64 and arm64, plain text fallback for headless linux

## [0.9.2] - 2025-05-06
### Added
- Added support for reading auth mode from the environment variable `AZUREAUTH_MODE`.
Expand Down Expand Up @@ -207,7 +215,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial project release.

[Unreleased]: https://github.com/AzureAD/microsoft-authentication-cli/compare/0.9.2...HEAD
[Unreleased]: https://github.com/AzureAD/microsoft-authentication-cli/compare/0.9.4...HEAD
[0.9.4]: https://github.com/AzureAD/microsoft-authentication-cli/compare/0.9.3...0.9.4
[0.9.3]: https://github.com/AzureAD/microsoft-authentication-cli/compare/0.9.2...0.9.3
[0.9.2]: https://github.com/AzureAD/microsoft-authentication-cli/compare/0.9.1...0.9.2
[0.9.1]: https://github.com/AzureAD/microsoft-authentication-cli/compare/0.9.0...0.9.1
[0.9.0]: https://github.com/AzureAD/microsoft-authentication-cli/compare/0.8.6...0.9.0
Expand Down
59 changes: 40 additions & 19 deletions install/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Param([switch] $NoUpdatePath)

# Halt script execution at the first failed command.
$script:ErrorActionPreference='Stop'
$script:ErrorActionPreference = 'Stop'

# We don't currently have good cross-platform options for determining the latest release version, so we require
# knowledge of the specific target version, which the user should set as an environment variable.
Expand Down Expand Up @@ -35,7 +35,8 @@ function Install-Pre-0-4-0 {

$azureauthDirectory = if ([string]::IsNullOrEmpty($Env:AZUREAUTH_INSTALL_DIRECTORY)) {
([System.IO.Path]::Combine($Env:LOCALAPPDATA, "Programs", "AzureAuth"))
} else {
}
else {
$Env:AZUREAUTH_INSTALL_DIRECTORY
}
$extractedDirectory = ([System.IO.Path]::Combine($azureauthDirectory, $releaseName))
Expand All @@ -53,8 +54,7 @@ function Install-Pre-0-4-0 {
# We suppress taskkill output here because this is a best effort attempt and we don't want the user to see its output.
# Here, Get-Process is used to first determine whether there is an existing azureauth process. If there is, kill the existing process first.
$ProcessCheck = Get-Process -Name azureauth -ErrorAction SilentlyContinue -ErrorVariable ProcessError
if ($null -ne $ProcessCheck)
{
if ($null -ne $ProcessCheck) {
Write-Verbose "Stopping any currently running azureauth instances"
taskkill /f /im azureauth.exe 2>&1 | Out-Null

Expand Down Expand Up @@ -101,7 +101,8 @@ function Install-Pre-0-4-0 {
Write-Verbose "Updating `$env:PATH to include ${latestDirectory}"
$newPath = if ($null -eq $currentPath) {
"${latestDirectory}"
} else {
}
else {
"${currentPath};${latestDirectory}"
}
Set-ItemProperty -Path $registryPath -Name PATH -Value $newPath
Expand All @@ -115,12 +116,30 @@ function Install-Post-0-4-0 {
Write-Verbose "Installing using post-0.4.0 method"

$repo = if ([string]::IsNullOrEmpty($Env:AZUREAUTH_REPO)) { 'AzureAD/microsoft-authentication-cli' } else { $Env:AZUREAUTH_REPO }
$releaseName = if ([version]::Parse($version) -lt [version]::Parse("0.9.0")) { "azureauth-${version}-win10-x64" } else { "azureauth-${version}-win-x64" }

# Detect processor architecture (ARM64 or x64)
# PROCESSOR_ARCHITEW6432 contains the actual architecture when running under emulation
# PROCESSOR_ARCHITECTURE contains the architecture of the current process
$arch = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") {
"arm64"
}
else {
"x64"
}
Write-Verbose "Detected architecture: $arch (PROCESSOR_ARCHITECTURE=$env:PROCESSOR_ARCHITECTURE, PROCESSOR_ARCHITEW6432=$env:PROCESSOR_ARCHITEW6432)"

$releaseName = if ([version]::Parse($version) -lt [version]::Parse("0.9.0")) {
"azureauth-${version}-win10-x64" # ARM64 not available for versions < 0.9.0
}
else {
"azureauth-${version}-win-${arch}"
}
$releaseFile = "${releaseName}.zip"
$releaseUrl = "https://github.com/${repo}/releases/download/${version}/$releaseFile"
$azureauthDirectory = if ([string]::IsNullOrEmpty($Env:AZUREAUTH_INSTALL_DIRECTORY)) {
([System.IO.Path]::Combine($Env:LOCALAPPDATA, "Programs", "AzureAuth"))
} else {
}
else {
$Env:AZUREAUTH_INSTALL_DIRECTORY
}

Expand Down Expand Up @@ -164,31 +183,32 @@ function Install-Post-0-4-0 {
if ($NoUpdatePath) {
Write-Verbose "Not updating `$env:PATH"
}
else{
else {
# We only fetch the user's $PATH from the registry and not the system $PATH because we only want to
# influence the current user's environment. We also fetch the path that `azureauth` is currently installed to
# in the event that it was previously installed to a custom location.
$registryPath = 'Registry::HKEY_CURRENT_USER\Environment'
$currentPath = (Get-ItemProperty -Path $registryPath -Name PATH -ErrorAction SilentlyContinue).Path
$currentAzureauth = (get-command azureauth -ErrorAction SilentlyContinue).Source
$currentAzureauthParent = if($null -ne $currentAzureauth) {
(get-item $currentAzureauth).Directory.Parent.FullName }
$currentAzureauthParent = if ($null -ne $currentAzureauth) {
(get-item $currentAzureauth).Directory.Parent.FullName
}
$newPath = "";

# We check to see whether the current $PATH contains either the azureauth installation root or the parent
# directory of a currently installed `azureauth`.
if (($null -ne $currentPath) `
-And ($currentPath.Contains($azureauthDirectory) `
-And ($currentPath.Contains($azureauthDirectory) `
-Or (($null -ne $currentAzureauthParent) `
-And ($currentPath.Contains($currentAzureauthParent))))) {
-And ($currentPath.Contains($currentAzureauthParent))))) {
$paths = $currentPath.Split(";")
$pathArr = @()
# We reconstruct the $PATH as an array without any azureauth directories.
ForEach($path in $paths){
if(!(($path.Equals("")) `
-Or ($path.Contains($azureauthDirectory)) `
-Or (($null -ne $currentAzureauthParent) `
-And $currentAzureauthParent.Contains($path)))){
ForEach ($path in $paths) {
if (!(($path.Equals("")) `
-Or ($path.Contains($azureauthDirectory)) `
-Or (($null -ne $currentAzureauthParent) `
-And $currentAzureauthParent.Contains($path)))) {
$pathArr += "${path}"
}
else {
Expand All @@ -202,7 +222,8 @@ function Install-Post-0-4-0 {
Write-Verbose "Appending '${targetDirectory}' to `$env:PATH"
if ($null -eq $currentPath) {
$newPath = "${targetDirectory}"
} else {
}
else {
$newPath = "${currentPath};${targetDirectory}"
}
}
Expand All @@ -213,7 +234,7 @@ function Install-Post-0-4-0 {
}

switch ($version) {
{ $_ -in "v0.1.0","v0.2.0","v0.3.0","0.3.1" } {
{ $_ -in "v0.1.0", "v0.2.0", "v0.3.0", "0.3.1" } {
Install-Pre-0-4-0
}
default {
Expand Down
102 changes: 102 additions & 0 deletions install/linux-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/sh

set -e

# We use an env var for this rather than --verbose because getopt is not reliably cross-platform.
: ${AZUREAUTH_VERBOSE_INSTALL=""}
verbose() {
if [ -n "${AZUREAUTH_VERBOSE_INSTALL}" ]; then
>&2 printf "\x1b[33m${1}\x1b[0m\n"
fi
}
error() { >&2 printf "\x1b[31m${1}\x1b[0m\n"; }

version="${AZUREAUTH_VERSION}"
if [ -z "${version}" ]; then
error 'No $AZUREAUTH_VERSION specified, unable to download a release'
exit 1
fi

# Detect architecture (x64 or arm64) based on current system
detect_arch() {
arch="$(uname -m)"

case "${arch}" in
x86_64|amd64)
echo "x64"
;;
aarch64|arm64)
echo "arm64"
;;
*)
error "Unsupported architecture '${arch}', unable to download a release"
exit 1
;;
esac
}

# Parse the OS info from uname into a proper release artifact name.
release_name() {
name="azureauth-${version}"
os_name="$(uname -s)"

case "${os_name}" in
Linux)
arch="$(detect_arch)"
name="${name}-linux-${arch}"
;;
*)
error "Unsupported OS '${os_name}', unable to download a release"
exit 1
;;
esac

echo "${name}"
}

install_post_0_4_0() {
: ${AZUREAUTH_REPO='AzureAD/microsoft-authentication-cli'}
repo="${AZUREAUTH_REPO}"
release_file="$(release_name).deb"
release_url="https://github.com/${repo}/releases/download/${version}/${release_file}"

# Download location for the .deb file (not the installation location)
# The actual installation location is determined by the .deb package (/usr/bin/azureauth)
: ${AZUREAUTH_DOWNLOAD_DIRECTORY="/tmp"}
download_directory="${AZUREAUTH_DOWNLOAD_DIRECTORY}"
deb_file="${download_directory}/${release_file}"

verbose "Installing using Debian package method"
verbose "Detected architecture: $(detect_arch)"

verbose "Creating download directory ${download_directory}"
mkdir -p "${download_directory}"

verbose "Downloading ${release_url} to ${deb_file}"
if ! curl -sfL "${release_url}" > "${deb_file}"; then
error "Failed to download azureauth ${version}"
exit 1
fi

verbose "Installing ${deb_file} using dpkg"
if ! sudo dpkg -i "${deb_file}"; then
error "Failed to install azureauth ${version}"
error "You may need to run 'sudo apt-get install -f' to fix dependencies"
exit 1
fi

verbose "Removing ${deb_file}"
rm "${deb_file}"

echo "Installed azureauth ${version}!"
}

case "${version}" in
v0.1.0|v0.2.0|v0.3.0|0.3.1)
error "Version ${version} does not have Linux .deb packages available"
exit 1
;;
*)
install_post_0_4_0
;;
esac
Loading