From 58cf964f9f6190083632b45194a54574294f7d68 Mon Sep 17 00:00:00 2001 From: JT Date: Fri, 27 Feb 2026 15:39:37 +1100 Subject: [PATCH 1/2] diagnostics for az cli failure --- .../Bicep/BicepCli.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/source/Calamari.AzureResourceGroup/Bicep/BicepCli.cs b/source/Calamari.AzureResourceGroup/Bicep/BicepCli.cs index dc5ea17491..22e892af40 100644 --- a/source/Calamari.AzureResourceGroup/Bicep/BicepCli.cs +++ b/source/Calamari.AzureResourceGroup/Bicep/BicepCli.cs @@ -50,10 +50,23 @@ void SetAz() ? ExecuteRawCommandAndReturnOutput("where", "az.cmd") : ExecuteRawCommandAndReturnOutput("which", "az"); - var infoMessages = result.Output.Messages.Where(m => m.Level == Level.Verbose).Select(m => m.Text).ToArray(); + var allMessages = result.Output.Messages.Select(m => $"[{m.Level}] {m.Text}").ToArray(); + log.Verbose($"which/where az exit code: {result.Result.ExitCode}"); + log.Verbose($"which/where az output:\n{string.Join("\n", allMessages)}"); + log.Verbose($"PATH: {Environment.GetEnvironmentVariable("PATH")}"); + log.Verbose($"Working directory: {workingDirectory}"); + + var infoMessages = result.Output.Messages + .Where(m => m.Level == Level.Verbose) + .Select(m => m.Text) + .ToArray(); + var foundExecutable = infoMessages.FirstOrDefault(); if (string.IsNullOrEmpty(foundExecutable)) - throw new CommandException("Could not find az. Make sure az is on the PATH."); + throw new CommandException( + $"Could not find az. Make sure az is on the PATH.\n" + + $"PATH was: {Environment.GetEnvironmentVariable("PATH")}\n" + + $"which/where output: {string.Join("; ", allMessages)}"); azCliLocation = foundExecutable.Trim(); } From c9820b154c10928d77ab78f204a8e73eebc28b57 Mon Sep 17 00:00:00 2001 From: JT Date: Fri, 27 Feb 2026 15:39:52 +1100 Subject: [PATCH 2/2] Enable AZ test on *nix --- .../DeployAzureBicepTemplateCommandFixture.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/Calamari.AzureResourceGroup.Tests/DeployAzureBicepTemplateCommandFixture.cs b/source/Calamari.AzureResourceGroup.Tests/DeployAzureBicepTemplateCommandFixture.cs index 6ce8922365..b74c7b3467 100644 --- a/source/Calamari.AzureResourceGroup.Tests/DeployAzureBicepTemplateCommandFixture.cs +++ b/source/Calamari.AzureResourceGroup.Tests/DeployAzureBicepTemplateCommandFixture.cs @@ -18,7 +18,7 @@ namespace Calamari.AzureResourceGroup.Tests { [TestFixture] - [WindowsTest] // NOTE: We should look at having the Azure CLI installed on Linux boxes so that these steps can be tested there, particularly if we're moving cloud to a Ubuntu Default Worker. + // NOTE: We should look at having the Azure CLI installed on Linux boxes so that these steps can be tested there, particularly if we're moving cloud to a Ubuntu Default Worker. class DeployAzureBicepTemplateCommandFixture { string clientId; @@ -93,6 +93,7 @@ await armClient.GetResourceGroupResource(ResourceGroupResource.CreateResourceIde } [Test] + [WindowsTest] [RequiresWindowsServer2016OrAbove("This test requires the az cli, which relies on python 3.10, which doesn't run on windows 2012/2012R2")] public async Task DeployAzureBicepTemplate_PackageSource() { @@ -108,6 +109,7 @@ await CommandTestBuilder.CreateAsync() } [Test] + [WindowsTest] [RequiresWindowsServer2016OrAbove("This test requires the az cli, which relies on python 3.10, which doesn't run on windows 2012/2012R2")] public async Task DeployAzureBicepTemplate_GitSource() {