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
user_principal_id="$(az ad signed-in-user show --query id -o tsv 2>/dev/null || true)"
686
+
# Resolve the principal id to use for team-config uploads. In CI the workflow
687
+
# logs in as a service principal (OIDC), so `az ad signed-in-user show` returns
688
+
# nothing. Fall back to an explicit USER_PRINCIPAL_ID env var, then to the SP
689
+
# object id looked up via AZURE_CLIENT_ID.
690
+
if [ -n"${USER_PRINCIPAL_ID:-}" ];then
691
+
user_principal_id="$USER_PRINCIPAL_ID"
692
+
info "Using principal id from USER_PRINCIPAL_ID env var."
693
+
else
694
+
user_principal_id="$(az ad signed-in-user show --query id -o tsv 2>/dev/null || true)"
695
+
if [ -z"$user_principal_id" ] && [ -n"${AZURE_CLIENT_ID:-}" ];then
696
+
info "No interactive user — falling back to service principal object id (AZURE_CLIENT_ID=$AZURE_CLIENT_ID)."
697
+
user_principal_id="$(az ad sp show --id "$AZURE_CLIENT_ID" --query id -o tsv 2>/dev/null || true)"
698
+
fi
699
+
fi
682
700
if [ -z"$user_principal_id" ];then
683
-
fatal "Could not retrieve signed-in user principal id."
701
+
fatal "Could not retrieve signed-in user principal id. In CI, set USER_PRINCIPAL_ID or ensure AZURE_CLIENT_ID is exported and the SP is visible to Microsoft Graph."
0 commit comments