From b177e2aff43f65fc4dfd0c1223865e032eb2cbc1 Mon Sep 17 00:00:00 2001 From: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> Date: Wed, 9 Sep 2026 09:50:52 -0400 Subject: [PATCH] Remove unused direct Azure CLI wrapper Signed-off-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/architecture/rad-cli.md | 2 +- pkg/azure/azcli/azcli.go | 47 ------------------------------------ 2 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 pkg/azure/azcli/azcli.go diff --git a/docs/architecture/rad-cli.md b/docs/architecture/rad-cli.md index 0236247157..412dfd89e8 100644 --- a/docs/architecture/rad-cli.md +++ b/docs/architecture/rad-cli.md @@ -94,7 +94,7 @@ own packages. Windows automation callers launch `rad.exe`. A Node.js caller should use `detached: false`, `windowsHide: true`, and piped stdout and stderr. The caller's `windowsHide` option suppresses the initial `rad.exe` console because Radius cannot change its own process creation flags after startup. -When `rad.exe` has no attached console, [pkg/process](../../pkg/process/) automatically applies `SysProcAttr.HideWindow` and `CREATE_NO_WINDOW` to Radius-owned child processes such as Bicep, kubectl, and the direct Azure CLI wrapper. It does not set `DETACHED_PROCESS` or `CREATE_BREAKAWAY_FROM_JOB`, so `rad.exe` and its descendants remain in the automation caller's Windows Job Object for process-tree cancellation. Standard input, output, error, exit codes, and context cancellation retain their existing behavior. +When `rad.exe` has no attached console, [pkg/process](../../pkg/process/) automatically applies `SysProcAttr.HideWindow` and `CREATE_NO_WINDOW` to Radius-owned child processes such as Bicep and kubectl. It does not set `DETACHED_PROCESS` or `CREATE_BREAKAWAY_FROM_JOB`, so `rad.exe` and its descendants remain in the automation caller's Windows Job Object for process-tree cancellation. Standard input, output, error, exit codes, and context cancellation retain their existing behavior. When `rad.exe` has an attached console, child terminal access and interactive CLI behavior are unchanged. Azure Identity credentials create their own Azure CLI process and do not use `pkg/process`; automation that must guarantee windowless descendants should use a non-CLI authentication method such as `ServicePrincipal`, `ManagedIdentity`, or `UCPCredential`. diff --git a/pkg/azure/azcli/azcli.go b/pkg/azure/azcli/azcli.go deleted file mode 100644 index 2adc04f08d..0000000000 --- a/pkg/azure/azcli/azcli.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2023 The Radius Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package azcli - -import ( - "fmt" - "os" - "runtime" - - "github.com/radius-project/radius/pkg/process" -) - -// RunCLICommand runs the Azure CLI command based on the OS type and returns an error if the command fails. -// It forwards the stdout and stderr to this process's output. -func RunCLICommand(args ...string) error { - var executableName string - var executableArgs []string - if runtime.GOOS == "windows" { - // Use shell on windows since az is a script not an executable - executableName = fmt.Sprintf("%s\\system32\\cmd.exe", os.Getenv("windir")) - executableArgs = append(executableArgs, "/c", "az") - } else { - executableName = "az" - } - - executableArgs = append(executableArgs, args...) - - c := process.Command(executableName, executableArgs...) - c.Stderr = os.Stderr - c.Stdout = os.Stdout - err := c.Run() - return err -}