Azure / functions-action

Enable GitHub developers to deploy to Azure Function Apps using GitHub Actions
MIT License
159 stars 75 forks source link

Help deploying Linux V2 Azure Function in Consumption plan #256

Open afrancoc2000 opened 1 day ago

afrancoc2000 commented 1 day ago

Hello, I'm trying to deploy an Azure Function in python v2 using RBAC over a consumption plan and I have been having a lot of trouble, can you please help me seee what I'm missing?

This is what I've been running:

  steps:
  - name: 'Checkout project'
    uses: actions/checkout@v4

  - name: 'Login via Azure CLI'
    uses: azure/login@v2
    with:
      creds: ${{ inputs.azure_credentials }}

  - name: Setup Python ${{ inputs.python_version }} Environment
    uses: actions/setup-python@v4
    with:
      python-version: ${{ inputs.python_version }}

  - name: 'Install dependencies'
    shell: bash
    run: |
      pushd './${{ inputs.azure_function_package_path }}'
      python -m pip install --upgrade pip
      pip install -r requirements.txt --target=".python_packages/lib/site-packages"
      popd

  - name: 'Deploy Azure Function'
    uses: Azure/functions-action@v1
    with:
      app-name: ${{ inputs.azure_function_name }}
      package: ${{ inputs.azure_function_package_path }}
      scm-do-build-during-deployment: true
      enable-oryx-build: true
      respect-funcignore: true

When I try with AzureWebJobsStorage__accountName the pipeline fails with a permission error even though the function has Storage blob data owner, and storageKeyOperator set

When I have AzureWebJobsStorage set with the storage connection string it's able to deploy but the Azure Function doesn't show up even though the code can be looked at.

Locally my function looks good and works.

The way I got it to deploy was running func azure functionapp publish my-func from VSCode, it deploys and works but then it deletes the WEBSITE_RUN_FROM_PACKAGE env var.

How can I do the same using the action?

I've tried deploying from a zip file setting roles setting and deleting ENABLE_ORYX_BUILD and SCM_DO_BUILD_DURING_DEPLOYMENT, the only way to deploy it is from my local environment using func, but I need to do it from a GitHub pipeline. What else can I try?

Thanks

afrancoc2000 commented 1 day ago

I got it to work using this https://github.com/Azure/Azure-Functions/issues/2450#issuecomment-2145597626 couldn't use the action though