JanDeDobbeleer/oh-my-posh · info
azure config dir not found
Error message
azure config dir not found
What it means
The azure segment reads Azure CLI state from `azureProfile.json` / `cloudsConfig.json` (or the PowerShell variant). findConfig searches AZURE_CONFIG_DIR, ~/.azure, and ~/.Azure for the file; if none of those directories contains it, this error is returned and the segment stays hidden.
Source
Thrown at src/segments/az.go:172
a.TenantDisplayName = config.Tenant.Name
a.Origin = "PWSH"
return true
}
func (a *Az) findConfig(fileName string) (string, error) {
configDirs := []string{
a.env.Getenv("AZURE_CONFIG_DIR"),
filepath.Join(a.env.Home(), ".azure"),
filepath.Join(a.env.Home(), ".Azure"),
}
for _, dir := range configDirs {
if len(dir) != 0 && a.env.HasFilesInDir(dir, fileName) {
return filepath.Join(dir, fileName), nil
}
}
return "", errors.New("azure config dir not found")
}
View on GitHub (pinned to 0976794618)
Solutions
- Install the Azure CLI and run `az login` so ~/.azure/azureProfile.json is created.
- If AZURE_CONFIG_DIR is set, confirm it points at the directory actually containing azureProfile.json (check `echo $env:AZURE_CONFIG_DIR` / `echo $AZURE_CONFIG_DIR`).
- Remove the azure segment from your theme if you do not use Azure on this machine - the error only means the segment disables itself.
Example fix
# before $ echo $AZURE_CONFIG_DIR ~/dotfiles/azure # dir exists but has no azureProfile.json # after $ az login $ ls ~/.azure/azureProfile.json ~/.azure/azureProfile.json
Defensive patterns
Strategy: validation
Validate before calling
test -f "${AZURE_CONFIG_DIR:-$HOME/.azure}/azureProfile.json" && echo "az profile found" || echo "run 'az login'" Prevention
- Run `az login` once per machine before enabling the azure segment
- If AZURE_CONFIG_DIR is set, confirm it contains azureProfile.json
- Remove the azure segment from themes on machines without the Azure CLI
When it happens
Trigger: getCLISubscription calls findConfig while no Azure CLI profile exists: Azure CLI never installed or never run (`az login`), AZURE_CONFIG_DIR set to a directory without the profile file, or a non-default home directory.
Common situations: Fresh machine/container where `az login` was never executed; AZURE_CONFIG_DIR customized (e.g. in a dotfiles setup) but missing the profile; segment enabled in the theme although Azure CLI is not used; macOS/Linux users with a mounted but empty home.
Related errors
- invalid yaml
- no current context
- invalid export format
- --data-only and --data-derive contradict each other: one for
- font path must be a valid URL
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/45ce7656318f2a86.
Report an issue: GitHub.