Skip to content

Commit ffa8e8f

Browse files
committed
fix: unset GHA identity env vars before az login --identity
1 parent ede7576 commit ffa8e8f

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/e2e-release-validation.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,25 @@ jobs:
123123
124124
- name: Azure Login (Managed Identity)
125125
run: |
126-
# Validate client ID is set
126+
# GitHub Actions injects IDENTITY_ENDPOINT / IDENTITY_HEADER which
127+
# cause az CLI to bypass IMDS and hit the Actions OIDC endpoint.
128+
# Unsetting them forces az CLI to use the VM's IMDS for managed identity.
129+
unset IDENTITY_ENDPOINT IDENTITY_HEADER
130+
unset MSI_ENDPOINT MSI_SECRET
131+
unset ACTIONS_ID_TOKEN_REQUEST_URL ACTIONS_ID_TOKEN_REQUEST_TOKEN
132+
127133
if [ -z "$AZURE_CLIENT_ID" ]; then
128-
echo "::error::AZURE_CLIENT_ID secret is empty"
134+
echo "::error::AZURE_CLIENT_ID secret is empty or not set"
129135
exit 1
130136
fi
131-
echo "Client ID length: ${#AZURE_CLIENT_ID}"
132-
az login --identity --client-id "$AZURE_CLIENT_ID" 2>&1 || {
133-
echo "Retrying with trimmed client ID..."
134-
TRIMMED=$(echo "$AZURE_CLIENT_ID" | tr -d '[:space:]')
135-
az login --identity --client-id "$TRIMMED" 2>&1
136-
}
137+
138+
echo "Authenticating via user-assigned managed identity..."
139+
az login --identity \
140+
--client-id "$AZURE_CLIENT_ID" \
141+
--output none
137142
az account set --subscription "$E2E_AZURE_SUBSCRIPTION_ID"
143+
echo "Logged in. Active subscription:"
144+
az account show --query '{name:name, id:id}' -o table
138145
139146
- name: Load secrets from Key Vault
140147
run: |

0 commit comments

Comments
 (0)