skip to Main Content

I created my first .Net api and I would like to upload it in a Azure web page using Github actions and FTPS. However, I keep getting error when trying connect to the ftps server.
This is what I type in the main.yml to test the connection:

lftp -u "${{ secrets.AZURE_FTP_USERNAME }},${{ secrets.AZURE_FTP_PASSWORD }}" -e "open ${{ secrets.AZURE_FTP_SERVER }}; ls; bye"

And this is the output error:

##[debug]Evaluating condition for step: 'Debug FTPS Connection'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Debug FTPS Connection
##[debug]Loading inputs
##[debug]Evaluating: format('echo "Testing FTPS connection..."
##[debug]lftp -u "{0},{1}" -e "open {2}; ls; bye"
##[debug]', secrets.AZURE_FTP_USERNAME, secrets.AZURE_FTP_PASSWORD, secrets.AZURE_FTP_SERVER)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> 'echo "Testing FTPS connection..."
##[debug]lftp -u "{0},{1}" -e "open {2}; ls; bye"
##[debug]'
##[debug]..Evaluating Index:
##[debug]....Evaluating secrets:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'AZURE_FTP_USERNAME'
##[debug]..=> '***'
##[debug]..Evaluating Index:
##[debug]....Evaluating secrets:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'AZURE_FTP_PASSWORD'
##[debug]..=> '***'
##[debug]..Evaluating Index:
##[debug]....Evaluating secrets:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'AZURE_FTP_SERVER'
##[debug]..=> '***'
##[debug]=> 'echo "Testing FTPS connection..."
##[debug]lftp -u "***,***" -e "open ***; ls; bye"
##[debug]'
##[debug]Result: 'echo "Testing FTPS connection..."
##[debug]lftp -u "***,***" -e "open ***; ls; bye"
##[debug]'
##[debug]Loading env
Run echo "Testing FTPS connection..."
##[debug]/usr/bin/bash -e /home/runner/work/_temp/7666aa93-ac5e-40b9-b1e6-a27a4c5a269e.sh
Testing FTPS connection...
ls: Login failed: 530 User cannot log in.

I quadruple checked and the FTPS endpoint, username, and password are the same and follow what I understood was the correct template:
AZURE_FTP_USERNAME=<app_name>$<app_name> (I tried adding more backslashes)
AZURE_FTP_PASSWORD=<password>
AZURE_FTP_SERVER=ftps://<something>.ftp.azurewebsites.windows.net(There is also /site/wwwroot after but I read that I shouldn’t include it there)

I have tried in the main.yml, I tried using curl, I also tried locally and using azure cli to get the server and other there. But the result stay the same login error.
Also the full main.yml

name: Build and deploy ASP.Net Core app to Azure Web App - noeflix

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Set up .NET Core
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '8.x'

      - name: Build with dotnet
        run: dotnet build --configuration Release

      - name: dotnet publish
        run: dotnet publish -c Release -o ${{ github.workspace }}/backend

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v4
        with:
          name: .net-app
          path: ${{ github.workspace }}/backend

  deploy:
    runs-on: ubuntu-latest
    needs: build

    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v4
        with:
          name: .net-app

      - name: Set up environment variables
        run: echo "TMDB_API_KEY=${{ secrets.TMDB_API_KEY }}" >> $GITHUB_ENV
          
      - name: Install lftp
        run: sudo apt-get install -y lftp

      - name: Debug FTPS Connection
        run: |
          echo "Testing FTPS connection..."
          lftp -u "${{ secrets.AZURE_FTP_USERNAME }},${{ secrets.AZURE_FTP_PASSWORD }}" -e "open ${{ secrets.AZURE_FTP_SERVER }}; ls; bye"

      - name: Deploy to Azure Web App via FTPS
        run: |
          lftp -u "${{ secrets.AZURE_FTP_USERNAME }},${{ secrets.AZURE_FTP_PASSWORD }}" -e "mirror --reverse --delete --verbose ./ ${AZURE_FTP_SERVER}/site/wwwroot; bye"

2

Answers


  1. Check the news, Azure died a while back due to CrowdStrike. They have recovered most services as of now but some related to yours maybe still degraded or completely down. Their official status can be found here: https://azure.status.microsoft/en-us/status

    Login or Signup to reply.
  2. In my case I forgot to turn on Basic Auth in Configuration that is required for FTP access

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search