Skip to content

Commit 7f3ef36

Browse files
authored
Merge pull request #1709 from microsoft/aca-cli-preview
Add ACA CLI install scripts and docs for Early Access release
2 parents a899d0f + 0017eb5 commit 7f3ef36

4 files changed

Lines changed: 277 additions & 0 deletions

File tree

docs/early/aca-cli/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# ACA Sandboxes CLI (Early Access)
2+
3+
Command-line interface for Azure Container Apps Sandboxes (Early Access).
4+
5+
## Prerequisites
6+
7+
- **Azure CLI** (`az`) must be installed — [Install Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli)
8+
- Run `az login` at least once before using `aca`. The CLI uses Azure CLI authentication.
9+
10+
## Installation
11+
12+
### Linux / macOS
13+
14+
```sh
15+
curl -fsSL https://raw.githubusercontent.com/microsoft/azure-container-apps/main/docs/early/aca-cli/install.sh | sh
16+
```
17+
18+
To install a specific version:
19+
20+
```sh
21+
curl -fsSL https://raw.githubusercontent.com/microsoft/azure-container-apps/main/docs/early/aca-cli/install.sh | ACA_VERSION=aca-cli-v0.1.0-early-access sh
22+
```
23+
24+
### Windows (PowerShell)
25+
26+
```powershell
27+
irm https://raw.githubusercontent.com/microsoft/azure-container-apps/main/docs/early/aca-cli/install.ps1 | iex
28+
```
29+
30+
To install a specific version:
31+
32+
```powershell
33+
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/azure-container-apps/main/docs/early/aca-cli/install.ps1))) -Version aca-cli-v0.1.0-early-access
34+
```
35+
36+
## Uninstall
37+
38+
### Linux / macOS
39+
40+
```sh
41+
curl -fsSL https://raw.githubusercontent.com/microsoft/azure-container-apps/main/docs/early/aca-cli/install.sh | sh -s -- --uninstall
42+
```
43+
44+
### Windows (PowerShell)
45+
46+
```powershell
47+
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/azure-container-apps/main/docs/early/aca-cli/install.ps1))) -Uninstall
48+
```
49+
50+
## Supported Platforms
51+
52+
| Platform | Architecture |
53+
|----------|-------------|
54+
| Linux | x64, ARM64 |
55+
| macOS | ARM64 |
56+
| Windows | x64 |
57+
58+
## Commands
59+
60+
<!-- TODO: Add complete command tree -->
61+
62+
Run `aca --help` to see all available commands.

docs/early/aca-cli/install.ps1

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# ACA CLI Installer for Windows
2+
param(
3+
[string]$Version = "latest",
4+
[string]$InstallDir = "$env:USERPROFILE\.aca\bin",
5+
[switch]$Uninstall
6+
)
7+
8+
$ErrorActionPreference = "Stop"
9+
$Repo = "microsoft/azure-container-apps"
10+
$Branch = "main"
11+
$BinaryName = "aca"
12+
13+
function Uninstall-Aca {
14+
$AcaHome = Split-Path $InstallDir -Parent # ~/.aca
15+
$ExePath = Join-Path $InstallDir "$BinaryName.exe"
16+
if (-not (Test-Path $ExePath) -and -not (Test-Path $AcaHome)) {
17+
Write-Host "$BinaryName is not installed."
18+
return
19+
}
20+
21+
# Remove PATH entry
22+
$UserPath = [Environment]::GetEnvironmentVariable("PATH", "User")
23+
if ($UserPath -like "*$InstallDir*") {
24+
$NewPath = ($UserPath -split ';' | Where-Object { $_ -ne $InstallDir }) -join ';'
25+
[Environment]::SetEnvironmentVariable("PATH", $NewPath, "User")
26+
Write-Host "Removed $InstallDir from PATH."
27+
}
28+
29+
# Remove entire .aca directory (binary + config)
30+
if (Test-Path $AcaHome) {
31+
Remove-Item -Recurse -Force $AcaHome
32+
Write-Host "Removed $AcaHome (binary and configuration)."
33+
}
34+
35+
Write-Host "$BinaryName uninstalled successfully."
36+
}
37+
38+
function Install-Aca {
39+
$Platform = "win-x64"
40+
41+
if ($Version -eq "latest") {
42+
# Fetch latest version from version file (no API, no rate limits)
43+
$Version = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/$Repo/$Branch/docs/early/aca-cli/latest-version.txt" -UseBasicParsing).Content.Trim()
44+
if (-not $Version) {
45+
throw "Could not determine latest version. Specify manually: -Version aca-cli-v0.1.0-early-access"
46+
}
47+
Write-Host "Latest version: $Version"
48+
}
49+
$Url = "https://github.com/$Repo/releases/download/$Version/$Version-$Platform.zip"
50+
51+
Write-Host "Downloading $BinaryName from $Url..."
52+
53+
# Create install directory
54+
if (-not (Test-Path $InstallDir)) {
55+
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
56+
}
57+
58+
$TmpFile = Join-Path $env:TEMP "$BinaryName-$Platform.zip"
59+
$TmpDir = Join-Path $env:TEMP "$BinaryName-extract"
60+
61+
try {
62+
Invoke-WebRequest -Uri $Url -OutFile $TmpFile -UseBasicParsing
63+
64+
if (Test-Path $TmpDir) { Remove-Item -Recurse -Force $TmpDir }
65+
Expand-Archive -Path $TmpFile -DestinationPath $TmpDir -Force
66+
67+
Copy-Item -Path (Join-Path $TmpDir "$BinaryName.exe") -Destination (Join-Path $InstallDir "$BinaryName.exe") -Force
68+
} finally {
69+
Remove-Item -Force $TmpFile -ErrorAction SilentlyContinue
70+
Remove-Item -Recurse -Force $TmpDir -ErrorAction SilentlyContinue
71+
}
72+
73+
# Add to PATH if not already there
74+
$UserPath = [Environment]::GetEnvironmentVariable("PATH", "User")
75+
if ($UserPath -notlike "*$InstallDir*") {
76+
[Environment]::SetEnvironmentVariable("PATH", "$UserPath;$InstallDir", "User")
77+
$env:PATH = "$env:PATH;$InstallDir"
78+
Write-Host "Added $InstallDir to PATH."
79+
}
80+
81+
Write-Host ""
82+
Write-Host "$BinaryName installed successfully to $InstallDir\$BinaryName.exe"
83+
Write-Host ""
84+
Write-Host "Prerequisites:"
85+
Write-Host " Azure CLI (az) must be installed and logged in."
86+
Write-Host " Run 'az login' if you haven't already."
87+
Write-Host ""
88+
Write-Host "Restart your terminal, then run '$BinaryName --help' to get started."
89+
}
90+
91+
if ($Uninstall) {
92+
Uninstall-Aca
93+
} else {
94+
Install-Aca
95+
}

docs/early/aca-cli/install.sh

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#!/bin/sh
2+
set -e
3+
4+
REPO="microsoft/azure-container-apps"
5+
BRANCH="main"
6+
BINARY_NAME="aca"
7+
INSTALL_DIR="/usr/local/bin"
8+
9+
# Allow overriding version; default to latest
10+
VERSION="${ACA_VERSION:-latest}"
11+
12+
detect_platform() {
13+
OS="$(uname -s)"
14+
ARCH="$(uname -m)"
15+
16+
case "$OS" in
17+
Linux) OS_TAG="linux" ;;
18+
Darwin) OS_TAG="osx" ;;
19+
*) echo "Error: Unsupported OS: $OS"; exit 1 ;;
20+
esac
21+
22+
case "$ARCH" in
23+
x86_64|amd64)
24+
if [ "$OS_TAG" = "osx" ]; then
25+
echo "Error: macOS x64 (Intel) is not supported. Only macOS ARM64 (Apple Silicon) is available."; exit 1
26+
fi
27+
ARCH_TAG="x64" ;;
28+
aarch64|arm64) ARCH_TAG="arm64" ;;
29+
*) echo "Error: Unsupported architecture: $ARCH"; exit 1 ;;
30+
esac
31+
32+
PLATFORM="${OS_TAG}-${ARCH_TAG}"
33+
}
34+
35+
get_download_url() {
36+
if [ "$VERSION" = "latest" ]; then
37+
# Fetch latest version from version file (no API, no rate limits)
38+
VERSION="$(curl -fsSL "https://raw.githubusercontent.com/${REPO}/${BRANCH}/docs/early/aca-cli/latest-version.txt" | tr -d '[:space:]')"
39+
if [ -z "$VERSION" ]; then
40+
echo "Error: Could not determine latest version."
41+
echo "Specify a version manually: ACA_VERSION=aca-cli-v0.1.0-early-access $0"
42+
exit 1
43+
fi
44+
echo "Latest version: ${VERSION}"
45+
fi
46+
URL="https://github.com/${REPO}/releases/download/${VERSION}/${VERSION}-${PLATFORM}.tar.gz"
47+
}
48+
49+
uninstall() {
50+
TARGET="${INSTALL_DIR}/${BINARY_NAME}"
51+
ACA_HOME="${HOME}/.aca"
52+
53+
if [ ! -f "$TARGET" ] && [ ! -d "$ACA_HOME" ]; then
54+
echo "${BINARY_NAME} is not installed."
55+
exit 0
56+
fi
57+
58+
# Remove binary
59+
if [ -f "$TARGET" ]; then
60+
if [ -w "$INSTALL_DIR" ]; then
61+
rm -f "$TARGET"
62+
else
63+
echo "Removing ${TARGET} (requires sudo)..."
64+
sudo rm -f "$TARGET"
65+
fi
66+
echo "Removed ${TARGET}"
67+
fi
68+
69+
# Remove config directory
70+
if [ -d "$ACA_HOME" ]; then
71+
rm -rf "$ACA_HOME"
72+
echo "Removed ${ACA_HOME} (configuration)."
73+
fi
74+
75+
echo "${BINARY_NAME} uninstalled successfully from ${TARGET}"
76+
}
77+
78+
install() {
79+
detect_platform
80+
echo "Detected platform: ${PLATFORM}"
81+
82+
get_download_url
83+
echo "Downloading ${BINARY_NAME} from ${URL}..."
84+
85+
TMP_DIR="$(mktemp -d)"
86+
trap 'rm -rf "$TMP_DIR"' EXIT
87+
88+
curl -fsSL "$URL" -o "${TMP_DIR}/${BINARY_NAME}.tar.gz"
89+
tar -xzf "${TMP_DIR}/${BINARY_NAME}.tar.gz" -C "$TMP_DIR"
90+
91+
# Install to INSTALL_DIR (try sudo if needed)
92+
if [ ! -d "$INSTALL_DIR" ]; then
93+
echo "Creating ${INSTALL_DIR} (requires sudo)..."
94+
sudo mkdir -p "$INSTALL_DIR"
95+
fi
96+
97+
if [ -w "$INSTALL_DIR" ]; then
98+
cp "${TMP_DIR}/${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}"
99+
chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
100+
else
101+
echo "Installing to ${INSTALL_DIR} (requires sudo)..."
102+
sudo cp "${TMP_DIR}/${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}"
103+
sudo chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
104+
fi
105+
106+
echo ""
107+
echo "${BINARY_NAME} installed successfully to ${INSTALL_DIR}/${BINARY_NAME}"
108+
echo ""
109+
echo "Prerequisites:"
110+
echo " Azure CLI (az) must be installed and logged in."
111+
echo " Run 'az login' if you haven't already."
112+
echo ""
113+
echo "Run '${BINARY_NAME} --help' to get started."
114+
}
115+
116+
case "${1:-}" in
117+
--uninstall) uninstall ;;
118+
*) install ;;
119+
esac
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aca-cli-v0.1.0-early-access

0 commit comments

Comments
 (0)