Add --install-extensions to install scripts + azure.foundry extension#7594
Add --install-extensions to install scripts + azure.foundry extension#7594rajeshkamal5050 wants to merge 1 commit intomainfrom
Conversation
… scripts - Create azure.foundry extension pack that bundles azure.ai.agents, azure.ai.models, and azure.ai.finetune as dependencies - Add azure.foundry entry to registry.json with no artifacts (pack only) - Add --install-extensions flag to install-azd.sh and install-azd.ps1 to install extensions immediately after azd setup - Uses full binary path to avoid PATH issues in new shell sessions Relates to #7054 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
jongio
left a comment
There was a problem hiding this comment.
Adds extension install to both installer scripts plus an azure.foundry meta-extension. The bash script's approach is clean - direct binary path, proper quoting, set-e safe error handling. Extension pack pattern is already proven by azd.internal.pack.
Two things worth looking at:
- install-azd.ps1:321,458 - exits 0 when extensions were requested but can't be installed
- install-azd.ps1:330 - Linux/Mac extension loop missing try/catch that the Windows path has
| } else { | ||
| Write-Warning "Could not locate azd after install. Extensions were not installed." | ||
| Write-Warning "Open a new terminal and run: azd extension install <extension-id>" | ||
| exit 0 |
There was a problem hiding this comment.
When -InstallExtensions is provided but azd can't be found, this exits 0. CI/CD pipelines won't detect that the requested extensions weren't installed. Same pattern at line 458 (Windows path).
Extension install failure already returns 1 (line 341). This creates an inconsistency: "extension install failed" = exit 1, but "couldn't even try" = exit 0. Consider exit 1 here since the user explicitly asked for extensions.
| $extId = $extId.Trim() | ||
| if ($extId) { | ||
| Write-Host "Installing extension: $extId" | ||
| & $azdBin extension install $extId |
There was a problem hiding this comment.
The Windows extension block wraps this in try/catch (line 468) but the Linux/Mac block doesn't. If $PSNativeCommandUseErrorActionPreference is enabled or the binary path becomes invalid between lookup and invocation, you'd get an unhandled error instead of the friendly warning. Minor consistency nit - the Windows code already has the right pattern.
|
@rajeshkamal5050 - how are we handling this with |
tg-msft
left a comment
There was a problem hiding this comment.
Testing Request Changes -- please ignore.
Good question, moved the discussion to the issue Shayne - #7054 (comment) |
| if ($InstallExtensions) { | ||
| Write-Host "" | ||
| Write-Host "Installing requested extensions..." | ||
|
|
||
| $azdCmd = Get-Command azd -ErrorAction SilentlyContinue | ||
| if ($azdCmd) { | ||
| $azdBin = $azdCmd.Source |
There was a problem hiding this comment.
Instead of calling azd after the bash script completes, map $InstallExtenions to the bash call through $bashParameters
There was a problem hiding this comment.
This can be done by joining $InstallExtensions with commas.. Something like
if ($InstallExtensions) {
$params += "--install-extensions ${$InstallExtensions -join ','}"
}| # Refresh PATH from registry since MSI updated it | ||
| $machinePath = [Environment]::GetEnvironmentVariable("Path", "Machine") | ||
| $userPath = [Environment]::GetEnvironmentVariable("Path", "User") | ||
| $env:Path = "$machinePath;$userPath" |
There was a problem hiding this comment.
This does mutate the current session's $env:PATH... in many instances this might not be a problem but it could violate expectations of someone who downloads the script to a file and runs it directly from the prompt.
| [switch] $NoTelemetry, | ||
| [string] $InstallShScriptUrl = "https://aka.ms/install-azd.sh" | ||
| [string] $InstallShScriptUrl = "https://aka.ms/install-azd.sh", | ||
| [string] $InstallExtensions = "" |
There was a problem hiding this comment.
| [string] $InstallExtensions = "" | |
| [string[]] $InstallExtensions = [] |
The invocation might look like:
install-azd.ps1 -InstallExtensions azure.ai.agents,azure.ai.modelsPowerShell automatically interprets items separated by commas (no spaces) as an array and [string[]] coerces to strings for later passing through to the script.
Adds
--install-extensionsflag toinstall-azd.shandinstall-azd.ps1so extensions can be installed in the same command as azd itself. Also addsazure.foundryas a dependency-only extension that bundles all Foundry extensions.Uses the full binary path (
$install_folder/$bin_name) to callazd extension install— no PATH dependency, works in the same shell session.Relates to #7054
Usage
Install azd + all Foundry extensions in one shot:
curl -fsSL https://aka.ms/install-azd.sh | bash -s -- --install-extensions azure.foundryInstall azd + a specific extension:
curl -fsSL https://aka.ms/install-azd.sh | bash -s -- --install-extensions azure.ai.agentsInstall azd + multiple individual extensions:
PowerShell (Windows):
Changes
cli/installer/install-azd.sh—--install-extensionsflagcli/installer/install-azd.ps1—-InstallExtensionsparameter (Windows + Linux/Mac paths)cli/azd/extensions/azure.foundry/extension.yaml— dependency-only extension, depends on agents/models/finetunecli/azd/extensions/registry.json—azure.foundryregistry entry