Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Description

Adds Azure CLI to Helix test runs following the existing pattern for Azure Functions CLI. The CLI is downloaded from the aka.ms redirect, extracted to az-cli, and added to PATH for test execution.

Changes

tests/helix/send-to-helix-inner.proj:

  • Added _AzureCliUrl property pointing to https://aka.ms/installazurecliwindowszipx64
  • Added NeedsAzCli conditional ItemGroup with:
    • HelixCorrelationPayload for downloading/extracting to az-cli destination
    • HelixPreCommand entries prepending az-cli/bin to PATH (Windows: %HELIX_CORRELATION_PAYLOAD%\az-cli\bin, non-Windows: $HELIX_CORRELATION_PAYLOAD/az-cli/bin)
    • Verification commands to list directory contents (dir on Windows, ls -la on Linux) and test tool accessibility (az --version)

tests/helix/send-to-helix-basictests.targets:

  • Set NeedsAzCli=true to enable for basic test runs

Notes

  • Windows-only URL currently configured (aka.ms link is Windows-specific)
  • Pattern mirrors existing NeedsAzureFunctionsCli implementation
  • Non-Windows placeholder included for future expansion

Fixes these failures on azdo:

System.InvalidOperationException: Step 'provision-env' failed: Exception of type 'Aspire.Hosting.Azure.AzureCliNotOnPathException' was thrown.
|  ---> Aspire.Hosting.Azure.AzureCliNotOnPathException: Exception of type 'Aspire.Hosting.Azure.AzureCliNotOnPathException' was thrown.
|    at Aspire.Hosting.Azure.Provisioning.Internal.BicepCliCompiler.CompileBicepToArmAsync(String bicepFilePath, CancellationToken cancellationToken) in /_/src/Aspire.Hosting.Azure/Provisioning/Internal/BicepCompiler.cs:line 41
|    at Aspire.Hosting.Azure.Provisioning.BicepProvisioner.GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken) in /_/src/Aspire.Hosting.Azure/Provisioning/Provisioners/BicepProvisioner.cs:line 159
|    at Aspire.Hosting.Azure.AzureBicepResource.ProvisionAzureBicepResourceAsync(PipelineStepContext context, AzureBicepResource resource) in /_/src/Aspire.Hosting.Azure/AzureBicepResource.cs:line 338
|    at Aspire.Hosting.Azure.AzureBicepResource.ProvisionAzureBicepResourceAsync(PipelineStepContext context, AzureBicepResource resource) in /_/src/Aspire.Hosting.Azure/AzureBicepResource.cs:line 361
|    at Aspire.Hosting.Azure.AzureBicepResource.ProvisionAzureBicepResourceAsync(PipelineStepContext context, AzureBicepResource resource) in /_/src/Aspire.Hosting.Azure/AzureBicepResource.cs:line 361
|    at Aspire.Hosting.Azure.AzureBicepResource.<>c__DisplayClass0_0.<<-ctor>b__2>d.MoveNext() in /_/src/Aspire.Hosting.Azure/AzureBicepResource.cs:line 53
| --- End of stack trace from previous location ---
|    at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteStepAsync(PipelineStep step, PipelineStepContext stepContext) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 760
|    --- End of inner exception stack trace ---
|    at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteStepAsync(PipelineStep step, PipelineStepContext stepContext) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 765
|    at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.<>c__DisplayClass18_0.<<ExecuteStepsAsTaskDag>g__ExecuteStepWithDependencies|0>d.MoveNext() in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 576

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
    • No
Original prompt

Add https://aka.ms/installazurecliwindowszipx64 as a dependency to be installed for AzDO Helix runs:

  • In tests/helix/send-to-helix-inner.proj, add the az CLI zip URL as a HelixCorrelationPayload, modeled on the existing Azure Functions CLI logic (see ItemGroup for $(NeedsAzureFunctionsCli)).
  • Introduce and document a new property, e.g., NeedsAzCli, akin to NeedsAzureFunctionsCli, which controls whether the CLI is added.
  • In the HelixCorrelationPayload ItemGroup, download and unzip az CLI to az-cli, and add the az-cli/bin directory to PATH for both Windows and non-Windows in HelixPreCommand (see provided example).
  • Set NeedsAzCli to true in basic-tests.targets so it's included for that run.
  • Ensure this is only enabled when appropriate (mirroring the pattern for Azure Functions CLI).
  • Example PATH setting for Windows: set PATH=%HELIX_CORRELATION_PAYLOAD%\az-cli\bin;%PATH%
  • Example for non-Windows: export PATH=$HELIX_CORRELATION_PAYLOAD/az-cli/bin:$PATH

Do not interfere with other existing HelixCorrelationPayloads. Add needed comments for maintainers.

This pull request was created as a result of the following prompt from Copilot chat.

Add https://aka.ms/installazurecliwindowszipx64 as a dependency to be installed for AzDO Helix runs:

  • In tests/helix/send-to-helix-inner.proj, add the az CLI zip URL as a HelixCorrelationPayload, modeled on the existing Azure Functions CLI logic (see ItemGroup for $(NeedsAzureFunctionsCli)).
  • Introduce and document a new property, e.g., NeedsAzCli, akin to NeedsAzureFunctionsCli, which controls whether the CLI is added.
  • In the HelixCorrelationPayload ItemGroup, download and unzip az CLI to az-cli, and add the az-cli/bin directory to PATH for both Windows and non-Windows in HelixPreCommand (see provided example).
  • Set NeedsAzCli to true in basic-tests.targets so it's included for that run.
  • Ensure this is only enabled when appropriate (mirroring the pattern for Azure Functions CLI).
  • Example PATH setting for Windows: set PATH=%HELIX_CORRELATION_PAYLOAD%\az-cli\bin;%PATH%
  • Example for non-Windows: export PATH=$HELIX_CORRELATION_PAYLOAD/az-cli/bin:$PATH

Do not interfere with other existing HelixCorrelationPayloads. Add needed comments for maintainers.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add az CLI as a dependency for AzDO Helix runs Add Azure CLI as Helix test dependency for basic tests Dec 9, 2025
Copilot AI requested a review from radical December 9, 2025 07:18

<!-- Azure CLI URL for Helix runs - Windows x64 zip version -->
<_AzureCliUrl Condition="'$(OS)' == 'Windows_NT'">https://aka.ms/installazurecliwindowszipx64</_AzureCliUrl>
<!-- Note: Azure CLI for non-Windows is not currently configured as the aka.ms link is Windows-specific -->
Copy link
Member

Choose a reason for hiding this comment

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

@copilot Drop this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 60d411a

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13420

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13420"

@radical
Copy link
Member

radical commented Dec 9, 2025

/azp run aspire-tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@radical
Copy link
Member

radical commented Dec 9, 2025

/azp run aspire-tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@radical
Copy link
Member

radical commented Dec 9, 2025

@copilot Add command to the helix targets to:

  • print the contents of the az-cli directory
  • Also, run az --version to test that the tool is accessible

Copy link
Contributor Author

Copilot AI commented Dec 9, 2025

@copilot Add command to the helix targets to:

  • print the contents of the az-cli directory
    ...

Done in 079a433. Added:

  • dir (Windows) / ls -la (Linux) to print az-cli directory contents
  • az --version to verify the tool is accessible

@radical
Copy link
Member

radical commented Dec 9, 2025

/azp run aspire-tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

```
System.InvalidOperationException: Step 'provision-env' failed: Exception of type 'Aspire.Hosting.Azure.AzureCliNotOnPathException' was thrown.
|  ---> Aspire.Hosting.Azure.AzureCliNotOnPathException: Exception of type 'Aspire.Hosting.Azure.AzureCliNotOnPathException' was thrown.
|    at Aspire.Hosting.Azure.Provisioning.Internal.BicepCliCompiler.CompileBicepToArmAsync(String bicepFilePath, CancellationToken cancellationToken) in /_/src/Aspire.Hosting.Azure/Provisioning/Internal/BicepCompiler.cs:line 41
|    at Aspire.Hosting.Azure.Provisioning.BicepProvisioner.GetOrCreateResourceAsync(AzureBicepResource resource, ProvisioningContext context, CancellationToken cancellationToken) in /_/src/Aspire.Hosting.Azure/Provisioning/Provisioners/BicepProvisioner.cs:line 159
|    at Aspire.Hosting.Azure.AzureBicepResource.ProvisionAzureBicepResourceAsync(PipelineStepContext context, AzureBicepResource resource) in /_/src/Aspire.Hosting.Azure/AzureBicepResource.cs:line 338
|    at Aspire.Hosting.Azure.AzureBicepResource.ProvisionAzureBicepResourceAsync(PipelineStepContext context, AzureBicepResource resource) in /_/src/Aspire.Hosting.Azure/AzureBicepResource.cs:line 361
|    at Aspire.Hosting.Azure.AzureBicepResource.ProvisionAzureBicepResourceAsync(PipelineStepContext context, AzureBicepResource resource) in /_/src/Aspire.Hosting.Azure/AzureBicepResource.cs:line 361
|    at Aspire.Hosting.Azure.AzureBicepResource.<>c__DisplayClass0_0.<<-ctor>b__2>d.MoveNext() in /_/src/Aspire.Hosting.Azure/AzureBicepResource.cs:line 53
| --- End of stack trace from previous location ---
|    at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteStepAsync(PipelineStep step, PipelineStepContext stepContext) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 760
|    --- End of inner exception stack trace ---
|    at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteStepAsync(PipelineStep step, PipelineStepContext stepContext) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 765
|    at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.<>c__DisplayClass18_0.<<ExecuteStepsAsTaskDag>g__ExecuteStepWithDependencies|0>d.MoveNext() in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 576
```
@radical radical force-pushed the copilot/add-az-cli-dependency branch from 3c75681 to 81efe83 Compare December 10, 2025 05:15
@radical radical marked this pull request as ready for review December 10, 2025 05:16
@radical radical requested a review from eerhardt as a code owner December 10, 2025 05:16
Copilot AI review requested due to automatic review settings December 10, 2025 05:16
@radical radical changed the title Add Azure CLI as Helix test dependency for basic tests [CI] Add Azure CLI as Helix test dependency for basic tests Dec 10, 2025
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

This PR adds Azure CLI as a dependency for Helix basic test runs, following the established pattern for Azure Functions CLI. The implementation downloads the Azure CLI zip from an aka.ms redirect URL, extracts it to az-cli, and adds its bin directory to the PATH for test execution. Currently configured for Windows only with placeholders for future non-Windows support.

Key Changes

  • Introduced NeedsAzCli property to conditionally enable Azure CLI installation
  • Added download and extraction target that handles the aka.ms redirect URL lacking a file extension
  • Configured PATH updates and verification commands for Helix environments

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/helix/send-to-helix-inner.proj Adds _AzureCliWindowsUrl property, creates DownloadAzureCliForHelix target to download/extract Azure CLI, configures HelixCorrelationPayload and HelixPreCommand items for PATH setup and verification
tests/helix/send-to-helix-basictests.targets Enables Azure CLI for basic tests by setting NeedsAzCli=true

@radical radical enabled auto-merge (squash) December 10, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants