Skip to content

Azure Entra ID authentication do not works #6738

@jmservier

Description

@jmservier

Dear all,
az cli authentication fail for some reason as shown in image below:
Image

az cli is installed and in the path

C:\Users\XXXXX> az --version
azure-cli                         2.77.0

core                              2.77.0
telemetry                          1.1.0

Dependencies:
msal                            1.34.0b1
azure-mgmt-resource               23.3.0

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\XXXXX\.azure'
Extensions directory 'C:\Users\XXXXX\.azure\cliextensions'

Python (Windows) 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal


Unable to check if your CLI is up-to-date. Check your internet connection.

goose version: 1.18
OS: windows 11

Part of diagnostics log below , my computer is set to French

          "role": "assistant",
          "tool_calls": [
            {
              "id": "call_yKQLMxMeMXcQS8Dy1qPdBqzi",
              "type": "function",
              "function": {
                "name": "code_execution__execute_code",
                "arguments": "{\"code\":\"import { todo_write } from \\\"todo\\\";\\nimport { shell } from \\\"developer\\\";\\n\\nconst path = \\\"C:\\\\\\\\Users\\\\\\\\CY21_CB\\\\\\\\AppData\\\\\\\\Roaming\\\\\\\\Block\\\\\\\\goose\\\\\\\\config\\\\\\\\recipes\\\\\\\\webapp-factory-orchestrator.yaml\\\";\\n\\nconst pwshCheck = shell({ command: `powershell -NoProfile -Command \\\"Get-Command ConvertFrom-Yaml -ErrorAction SilentlyContinue | Select-Object -First 1 | Format-Table -HideTableHeaders\\\"` });\\nconst pwshParse = shell({ command: `powershell -NoProfile -Command \\\"$ErrorActionPreference='Stop'; $s=Get-Content -Raw -Path '${path}'; $null = $s | ConvertFrom-Yaml; 'YAML_OK'\\\"` });\\n\\nconst todoContent = [\\n  \\\"# Todo (iteration 1)\\\",\\n  \\\"- [x] Load the recipe YAML from the provided path\\\",\\n  \\\"- [x] Validate YAML syntax (parse) and capture any line/column errors\\\",\\n  \\\"- [x] Do a quick structural sanity check (required top-level keys, obvious typos)\\\",\\n  \\\"- [ ] Report findings + suggested fixes\\\"\\n].join(\\\"\\\\n\\\");\\n\\ntodo_write({ content: todoContent });\\n\\n({ pwshCheck, pwshParse });\"}"
              }
            }
          ]
        },
        {
          "role": "tool",
          "content": "Result: {\n    pwshCheck: \"\\n\",\n    pwshParse: \"Continue=Stop : Le terme �Continue=Stop� n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script \\r\\nou programme ex�cutable. V�rifiez l'orthographe du nom, ou si un chemin d'acc�s existe, v�rifiez que le chemin d'acc�s \\r\\nest correct et r�essayez.\\r\\nAu caract�re Ligne:1 : 1\\r\\n+ Continue='Stop'; =Get-Content -Raw -Path 'C:\\\\Users\\\\CY21_CB\\\\AppData\\\\Ro ...\\r\\n+ ~~~~~~~~~~~~~~~\\r\\n    + CategoryInfo          : ObjectNotFound: (Continue=Stop:String) [], CommandNotFoundException\\r\\n    + FullyQualifiedErrorId : CommandNotFoundException\\r\\n \\r\\n=Get-Content : Le terme �=Get-Content� n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script \\r\\nou programme ex�cutable. V�rifiez l'orthographe du nom, ou si un chemin d'acc�s existe, v�rifiez que le chemin d'acc�s \\r\\nest correct et r�essayez.\\r\\nAu caract�re Ligne:1 : 18\\r\\n+ Continue='Stop'; =Get-Content -Raw -Path 'C:\\\\Users\\\\CY21_CB\\\\AppData\\\\Ro ...\\r\\n+                  ~~~~~~~~~~~~\\r\\n    + CategoryInfo          : ObjectNotFound: (=Get-Content:String) [], CommandNotFoundException\\r\\n    + FullyQualifiedErrorId : CommandNotFoundException\\r\\n \\r\\n= : Le terme �=� n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou programme \\r\\nex�cutable. V�rifiez l'orthographe du nom, ou si un chemin d'acc�s existe, v�rifiez que le chemin d'acc�s est correct \\r\\net r�essayez.\\r\\nAu caract�re Ligne:1 : 139\\r\\n+ ... ck\\\\goose\\\\config\\\\recipes\\\\webapp-factory-orchestrator.yaml';  =  | Conv ...\\r\\n+                                                                 ~\\r\\nYAML_OK\\r\\n    + CategoryInfo          : ObjectNotFound: (=:String) [], CommandNotFoundException\\r\\n    + FullyQualifiedErrorId : CommandNotFoundException\\r\\n \\r\\n\\nContinue=Stop : Le terme �Continue=Stop� n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script \\r\\nou programme ex�cutable. V�rifiez l'orthographe du nom, ou si un chemin d'acc�s existe, v�rifiez que le chemin d'acc�s \\r\\nest correct et r�essayez.\\r\\nAu caract�re Ligne:1 : 1\\r\\n+ Continue='Stop'; =Get-Content -Raw -Path 'C:\\\\Users\\\\CY21_CB\\\\AppData\\\\Ro ...\\r\\n+ ~~~~~~~~~~~~~~~\\r\\n    + CategoryInfo          : ObjectNotFound: (Continue=Stop:String) [], CommandNotFoundException\\r\\n    + FullyQualifiedErrorId : CommandNotFoundException\\r\\n \\r\\n=Get-Content : Le terme �=Get-Content� n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script \\r\\nou programme ex�cutable. V�rifiez l'orthographe du nom, ou si un chemin d'acc�s existe, v�rifiez que le chemin d'acc�s \\r\\nest correct et r�essayez.\\r\\nAu caract�re Ligne:1 : 18\\r\\n+ Continue='Stop'; =Get-Content -Raw -Path 'C:\\\\Users\\\\CY21_CB\\\\AppData\\\\Ro ...\\r\\n+                  ~~~~~~~~~~~~\\r\\n    + CategoryInfo          : ObjectNotFound: (=Get-Content:String) [], CommandNotFoundException\\r\\n    + FullyQualifiedErrorId : CommandNotFoundException\\r\\n \\r\\n= : Le terme �=� n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou programme \\r\\nex�cutable. V�rifiez l'orthographe du nom, ou si un chemin d'acc�s existe, v�rifiez que le chemin d'acc�s est correct \\r\\net r�essayez.\\r\\nAu caract�re Ligne:1 : 139\\r\\n+ ... ck\\\\goose\\\\config\\\\recipes\\\\webapp-factory-orchestrator.yaml';  =  | Conv ...\\r\\n+                                                                 ~\\r\\nYAML_OK\\r\\n    + CategoryInfo          : ObjectNotFound: (=:String) [], CommandNotFoundException\\r\\n    + FullyQualifiedErrorId : CommandNotFoundException\\r\\n \\r\\n\"\n}",
  }

Below the AI interpretation:

Summary

Goose fails before detecting az because the PowerShell command it spawns is corrupted by premature variable expansion and broken quoting.
As a result, the PowerShell check/parsing step errors out, and any downstream logic (including az detection) never runs correctly.


What is going wrong

Goose invokes pwsh with an inline command intended to look like:

$ErrorActionPreference = 'Stop';
Get-Content -Raw -Path '<file>' | ConvertFrom-Yaml

However, the logs show this instead:

Continue='Stop' : The term 'Continue=Stop' is not recognized as a command
=Get-Content : The term '=Get-Content' is not recognized as a command
= : The term '=' is not recognized as a command

Key observation

Continue is the default value of $ErrorActionPreference in PowerShell.

This means that:

  • $ErrorActionPreference is being expanded too early (by a parent PowerShell process),
  • before the command is passed to pwsh,
  • turning $ErrorActionPreference='Stop' into Continue='Stop',
  • which PowerShell then tries to execute as a command → CommandNotFoundException.

This can only happen if the inline command is wrapped in double quotes and constructed/executed from a PowerShell parent process.


Why this breaks az detection

Because the PowerShell pre-check fails:

  • the YAML recipe is not parsed,
  • environment setup may not run,
  • PATH modifications may not be applied,
  • Goose never reaches the logic that checks for az.

So the az not found symptom is secondary — the real failure happens earlier.


Additional evidence

The presence of errors like:

=Get-Content
= |

indicates that quoting or escaping is broken, especially around:

  • $ variables
  • pipelines (|)
  • inline -Command "..." usage

This strongly suggests shell-within-shell command construction issues.


Recommended fixes (robust options)

✅ Best option: use -File instead of inline -Command

Generate a temporary .ps1 script and run:

pwsh -NoProfile -NonInteractive -File script.ps1

This avoids all quoting and variable-expansion issues.


✅ Acceptable alternative: script block invocation

If inline execution is required:

pwsh -Command "& { $ErrorActionPreference = 'Stop'; ... }"

This prevents premature expansion.


⚠️ Avoid

pwsh -Command "$ErrorActionPreference='Stop'; ..."

when executed from a PowerShell parent — this will expand variables too early.


Conclusion

This is not an az installation or PATH issue.

It is a PowerShell command construction bug where:

  • $ErrorActionPreference is expanded by the parent shell,
  • breaking the command before pwsh executes it,
  • causing Goose to fail early and misreport downstream tool availability.

Fixing the quoting / execution strategy should unblock both YAML parsing and az detection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions