Skip to content

[Packaging] | Add a new ways (preview) to install azure-cli on macOS#32880

Open
naga-nandyala wants to merge 13 commits intoAzure:devfrom
naga-nandyala:cask_change
Open

[Packaging] | Add a new ways (preview) to install azure-cli on macOS#32880
naga-nandyala wants to merge 13 commits intoAzure:devfrom
naga-nandyala:cask_change

Conversation

@naga-nandyala
Copy link
Contributor

@naga-nandyala naga-nandyala commented Mar 2, 2026

Related command

Description

Introducing new ways to install azure-cli on macOS (arm64 & x86_64) via:

  1. homebrew-cask
  2. offline install.

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 2, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 2, 2026

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 2, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

github-actions bot commented Mar 2, 2026

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@microsoft-github-policy-service microsoft-github-policy-service bot added the Auto-Assign Auto assign by bot label Mar 2, 2026
@naga-nandyala naga-nandyala changed the title macOS Packaging change | homebew cask based installation {Packaging} | Introducing a new way to install azure-cli on macOS via homebrew-cask Mar 2, 2026
@naga-nandyala naga-nandyala changed the title {Packaging} | Introducing a new way to install azure-cli on macOS via homebrew-cask [Packaging] | Introducing a new way to install azure-cli on macOS via homebrew-cask Mar 2, 2026
@naga-nandyala naga-nandyala changed the title [Packaging] | Introducing a new way to install azure-cli on macOS via homebrew-cask [Packaging] | Add a new ways to install azure-cli on macOS Mar 2, 2026
@naga-nandyala naga-nandyala marked this pull request as ready for review March 3, 2026 00:21
Copilot AI review requested due to automatic review settings March 3, 2026 00:21
@naga-nandyala naga-nandyala changed the title [Packaging] | Add a new ways to install azure-cli on macOS [Packaging] | Add a new ways (preview release) to install azure-cli on macOS Mar 3, 2026
@naga-nandyala naga-nandyala changed the title [Packaging] | Add a new ways (preview release) to install azure-cli on macOS [Packaging] | Add a new ways (preview) to install azure-cli on macOS Mar 3, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new macOS distribution path for Azure CLI that packages the CLI as a Python-site-packages tarball (no bundled Python), supports both Homebrew Cask and offline installs, and wires up an Azure Pipelines flow to build → sign/notarize → test.

Changes:

  • Introduces macOS packaging assets: tarball builder, cask generator, launcher script, and offline README template.
  • Adds Azure Pipelines templates/jobs for macOS build, ESRP signing/notarization, cask generation/testing, and publishing.
  • Updates pipeline variables and repo .gitignore to support the new workflow.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
scripts/release/macos/templates/azure-cli.rb.in Homebrew cask template for installing the prebuilt tarball.
scripts/release/macos/templates/az_launcher.sh.in az launcher that selects Homebrew Python or AZ_PYTHON for offline installs.
scripts/release/macos/templates/README.txt.in Offline/Homebrew tarball README included in the distribution.
scripts/release/macos/cask_generate.py Renders the cask template by injecting version + SHA256s + repo.
scripts/release/macos/build_binary_tar_gz.py Builds the “no bundled Python” macOS tarball layout from source + pinned deps.
azure-pipelines.yml Hooks new macOS cask build/sign/test phases into the main pipeline.
.gitignore Adds .venv/ to ignored paths.
.azure-pipelines/templates/variables.yml Adds macOS image/pool variables for new pipeline templates.
.azure-pipelines/templates/macos/macos-build-jobs.yml Builds unsigned macOS tarballs for ARM64 + Intel via matrix.
.azure-pipelines/templates/macos/macos-sign-notarize-jobs.yml ESRP signing + notarization pipeline for macOS artifacts.
.azure-pipelines/templates/macos/macos-cask-generation-and-tests.yml Generates cask + tests temp tap install + offline tarball install.
.azure-pipelines/templates/macos/macos-publish-jobs.yml Publishes GitHub release and updates the Homebrew tap cask.
.azure-pipelines/macos-standalone-release.yml Standalone end-to-end macOS release pipeline wiring templates together.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

strategy :github_latest
end

depends_on formula: "python@3.13"
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cask hardcodes depends_on formula: "python@3.13", but the pipeline introduces a macos_cask_python_version variable/parameter. To avoid the template drifting from the pipeline configuration, consider templating the Python version here (and in the generator) so a single version setting drives both.

Suggested change
depends_on formula: "python@3.13"
depends_on formula: "python@{{ macos_cask_python_version }}"

Copilot uses AI. Check for mistakes.
Comment on lines +71 to +73
# Python version we're building for (must match Homebrew python@3.13)
PYTHON_MAJOR_MINOR = "3.13"
PYTHON_BIN = "python3"
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PYTHON_MAJOR_MINOR is hardcoded to 3.13, but the pipeline passes a Python version parameter (PythonVersion) when installing Homebrew Python. If/when the pipeline version changes, this script will still look for 3.13 and fail. Consider accepting the target Python version as a CLI argument/env var and wiring it through from the pipeline.

Copilot uses AI. Check for mistakes.
Comment on lines +621 to +640
((SIGNED_COUNT++))
[ -z "$FIRST_SIGNED" ] && FIRST_SIGNED="$file"

# 2. Strict verification (only for signed files)
if codesign --verify --deep --strict "$file" 2>/dev/null; then
((STRICT_PASS++))
else
((STRICT_FAIL++))
STRICT_FAILED_FILES+=("$filename")
fi

# 3. Developer ID check (only for signed files)
if codesign -dvv "$file" 2>&1 | grep -q "Developer ID"; then
((DEVID_PASS++))
else
((DEVID_FAIL++))
DEVID_FAILED_FILES+=("$filename")
fi
else
((UNSIGNED_COUNT++))
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The verification bash script runs with set -e, but uses post-increment arithmetic like ((SIGNED_COUNT++)). In bash, ((var++)) returns exit status 1 when the expression evaluates to 0 (e.g., on the first increment), which can cause the step to exit early. Use a form that always returns success under set -e (e.g., ((++SIGNED_COUNT)) / SIGNED_COUNT=$((SIGNED_COUNT+1))) for all the counters in this loop.

Suggested change
((SIGNED_COUNT++))
[ -z "$FIRST_SIGNED" ] && FIRST_SIGNED="$file"
# 2. Strict verification (only for signed files)
if codesign --verify --deep --strict "$file" 2>/dev/null; then
((STRICT_PASS++))
else
((STRICT_FAIL++))
STRICT_FAILED_FILES+=("$filename")
fi
# 3. Developer ID check (only for signed files)
if codesign -dvv "$file" 2>&1 | grep -q "Developer ID"; then
((DEVID_PASS++))
else
((DEVID_FAIL++))
DEVID_FAILED_FILES+=("$filename")
fi
else
((UNSIGNED_COUNT++))
((++SIGNED_COUNT))
[ -z "$FIRST_SIGNED" ] && FIRST_SIGNED="$file"
# 2. Strict verification (only for signed files)
if codesign --verify --deep --strict "$file" 2>/dev/null; then
((++STRICT_PASS))
else
((++STRICT_FAIL))
STRICT_FAILED_FILES+=("$filename")
fi
# 3. Developer ID check (only for signed files)
if codesign -dvv "$file" 2>&1 | grep -q "Developer ID"; then
((++DEVID_PASS))
else
((++DEVID_FAIL))
DEVID_FAILED_FILES+=("$filename")
fi
else
((++UNSIGNED_COUNT))

Copilot uses AI. Check for mistakes.
- name: GitHubRepo
displayName: 'GitHub Repository (owner/repo)'
type: string
default: 'Azure/homebrew-azure-cli'
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHubRepo is used for creating the GitHub release and for generating the cask download URL, but the default is set to the Homebrew tap repo (Azure/homebrew-azure-cli). That will publish the release assets to the wrong repository by default; the default should point to the Azure CLI repo (e.g., Azure/azure-cli) while HomebrewTapRepo remains Azure/homebrew-azure-cli.

Suggested change
default: 'Azure/homebrew-azure-cli'
default: 'Azure/azure-cli'

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a standalone pipeline used for testing.. it will not be part of live code..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants