You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write-Error"Authentication failed (HTTP 401) for '$OrgUrl'. Run 'az login' and confirm the active tenant with 'az account show'."
3078
+
return
3079
+
}
3080
+
403 {
3081
+
Write-Error"Access denied (HTTP 403) to organization '$OrgShortName'. The signed-in identity does not have permission to list projects. Ensure it is at least a Project Collection Valid User."
3082
+
return
3083
+
}
3084
+
404 {
3085
+
Write-Error@"
3086
+
Organization '$OrgShortName' was not found (HTTP 404).
3087
+
3088
+
Resolved URL: $OrgUrl
3089
+
3090
+
Check that:
3091
+
- The organization name is spelled correctly (you passed: '$Organization')
3092
+
- The signed-in account has access (verify with: az account show)
3093
+
- If using a legacy *.visualstudio.com URL, pass the full URL form
3094
+
"@
3095
+
return
3096
+
}
3097
+
default {
3098
+
Write-Error"Failed to query organization '$OrgShortName' at $projectsApi`: $($_.Exception.Message)"
3099
+
return
3100
+
}
3101
+
}
3102
+
}
3103
+
3104
+
if ($discoveredNames.Count-eq0) {
3105
+
Write-Warning"Organization '$OrgShortName' returned no projects. It may be empty, or your account may lack visibility."
3106
+
}
3107
+
3108
+
# Resolve -Project filter against discovered list (case-insensitive, with suggestions)
3062
3109
if ($Project) {
3063
-
$projectNames=$Project
3064
-
} else {
3065
-
Write-Host"No projects specified — discovering all projects..."-ForegroundColor Yellow
3066
-
$allProjects=Invoke-AzCli-Command "devops project list --org $OrgUrl -o json"
0 commit comments