login: Deployment Failing

Hello,

I am running into this error when following one of Microsoft Learn’s exercises:

Run azure/login@v1
Running Azure CLI Login.
/usr/bin/az cloud set -n azurecloud
Done setting cloud: "azurecloud"
Federated token details:
 issuer - https://token.actions.githubusercontent.com
 subject claim - repo:sirajahmadzai/mslearn-advocates.azure-functions-and-signalr:environment:Production
Attempting Azure CLI login by using OIDC...
Error: AADSTS700213: No matching federated identity record found for presented assertion subject 'repo:sirajahmadzai/mslearn-advocates.azure-functions-and-signalr:environment:Production'. Please check your federated identity credential Subject, Audience and Issuer against the presented assertion. https://docs.microsoft.com/en-us/azure/active-directory/develop/workload-identity-federation Trace ID: 9[15](https://github.com/sirajahmadzai/mslearn-advocates.azure-functions-and-signalr/actions/runs/9589306601/job/26443564754#step:5:16)d52ba-4181-49ad-b614-c8321c3a4400 Correlation ID: e42f5e57-bac2-4c33-86e3-c330510e0d18 Timestamp: 2024-06-20 00:[16](https://github.com/sirajahmadzai/mslearn-advocates.azure-functions-and-signalr/actions/runs/9589306601/job/26443564754#step:5:17):43Z

Error: Interactive authentication is needed. Please run:
az login

Error: Login failed with Error: The process '/usr/bin/az' failed with exit code 1. Double check if the 'auth-type' is correct. Refer to https://github.com/Azure/login#readme for more information.

I am following this exercise:

https://learn.microsoft.com/en-us/training/modules/automatic-update-of-a-webapp-using-azure-functions-and-signalr/5-exercise-enable-automatic-updates-in-a-web-app-using-signalr

I am able to successfully build but deployment fails.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 24

Most upvoted comments

Could you share the workflow file and Service Principal page? The error means the SP you used in the GitHub Action do not have the federated credential. But the page of the federated credential you shared in your comment seems correct. Could you double check if you’re using it for Azure Login Action?

Hi @YanaXu ,

Thanks for your reply and your help

The workflow file:

# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Node.js project to Azure Function App - provisionmanufacture

on:
  push:
    branches:
      - main
  workflow_dispatch:

env:
  AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
  NODE_VERSION: '20.x' # set this to the node version to use (supports 8.x, 10.x, 12.x)

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout GitHub Action'
        uses: actions/checkout@v4

      - name: Setup Node ${{ env.NODE_VERSION }} Environment
        uses: actions/setup-node@v3
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: 'Resolve Project Dependencies Using Npm'
        shell: bash
        run: |
          pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
          npm install
          npm run build --if-present
          npm run test --if-present
          popd

      - name: Zip artifact for deployment
        run: zip release.zip ./* -r

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v3
        with:
          name: node-app
          path: release.zip

  deploy:
    runs-on: ubuntu-latest
    needs: build
    environment:
      name: 'Production'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
    permissions:
      id-token: write #This is required for requesting the JWT

    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v3
        with:
          name: node-app

      - name: Unzip artifact for deployment
        run: unzip release.zip
      
      - name: Login to Azure
        uses: azure/login@v2
        with:
          client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_0E7D9513B6144F44A1298EC33518C78A }}
          tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_E7A9F92BD90648C195CF8C2F6F50CA42 }}
          subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_5C8AA0BFC20B4527BA6F36B219868C56 }}

      - name: 'Run Azure Functions Action'
        uses: Azure/functions-action@v1
        id: fa
        with:
          app-name: 'provisionmanufacture'
          slot-name: 'Production'
          package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}

I’ve checked and have the credentials as shown here: image

My Service Principal Page: image

All of this is autogenerated by Azure Function click. I’ve followed your instructions and added Federated Credentials and upgrade from azure/login/v1 to v2 and I still have to manually deploy my function from VS Code It’s been more than a week now, if it still doesn’t work would you mind escalating the ticket from question to an actual misconfiguration issues from Azure Function or bug in Azure Login?

Thanks and have a great day!

I’ll investigate.