File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 : |
You can’t perform that action at this time.
0 commit comments