Skip to content

[functionapp] az functionapp deployment source config-zip - does not deploy .zip as expected #10024

Description

Source: Azure/azure-cli#32128 (by JamesPScottPharm3r)
Affected extension: functionapp (src/functionapp/)


<<UNTRUSTED:issue-32128>>

Issue #32128 (by JamesPScottPharm3r)

Title

az functionapp deployment source config-zip - does not deploy .zip as expected

Body

Describe the bug

We've been using az functionapp deployment source config-zip to deploy our Azure functions to linux successfully for a year.

On the weekend when the Azure Function was deployed it was no longer finding any of our routes.

When I investigated further it was because the .zip file parameter (--src) was no longer using the contents of the specified .zip file. Instead it seemed to be writing the .zip filename string as txt in the .zip file and then that was the uploaded code. (So ya, no routes).

e.g. az functionapp deployment source config-zip --src ./someapp.zip

Instead of using the contents of the someapp.zip file it uploads a file named someapp.zip with ./someapp.zip echoed in its contents.

This was in production, so not a very ideal behavior to have all our function routes disappear.

The only way I could fix it was to hardcode a previous az cli version and run that through the github actions pipeline.

Related command

az functionapp deployment source config-zip --src ./nolongerworks.zip

Errors

No errors, it acts like everything is fine, but your Azure Function is dead in the water with no routes, paths etc.

Issue script & Debug output

--debug

Expected behavior

It should deploy as expected.

Environment Summary

2.77.0 - latest version that would be deployed in github actions.

Additional context

Should likely be fixed quickly before it impacts other customers too.

Comments

Comment by Yong Zhang (@yonzhan)

Thank you for opening this issue, we will look into it.

Comment by @github-actions[bot]

Here are some similar issues that might help you. Please check if they can solve your problem.

  • #32044

Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)

Solution 1:

I've temporarily worked around this in ADO classic releases by putting a task in the stage that just runs this: pip install azure-cli==2.76.0 and it works for me.

Reference:

Solution 2:

As a workaround, this is what we're doing in our release pipelines. We're using the Azure CLI task then we use the azure cli docker image within the Inline Script within the task:

''' shell
docker run --rm
-v "$AZURE_CONFIG_DIR":/root/.azure
-v "$(System.DefaultWorkingDirectory)/_MyApp/drop":/workspace
-w /workspace
mcr.microsoft.com/azure-cli:2.76.0
az functionapp deployment source config-zip
--name my-function
--resource-group my-resource-group
--src MyApp.zip
--subscription my-subscription
--debug
'''

Reference:

Solution 3:

If you need the downgrade script for in a dockerfile:

'''

Install latest azure cli

RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash

Downgrade it

RUN apt-get install -y --allow-downgrades azure-cli=2.76.0-1~bookworm
'''

The lsb (bookworm) can be different depending on your base image.

Reference:

Powered by issue-sentinel

Comment by @microsoft-github-policy-service[bot]

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc Anatoli Beliaev (@AnatoliB), Francisco Gamino (@Francisco-Gamino), Shreya (@shreyabatra4).

Comment by @microsoft-github-policy-service[bot]

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc Anatoli Beliaev (@AnatoliB), Francisco Gamino (@Francisco-Gamino), Shreya (@shreyabatra4).

Comment by Joshua (@martinjoshua)

This issue also appears to be happening with the --package-file parameter of the az batch application package create command.

Comment by arto-pihlaja

We're experiencing the same. The linked issue also fits the symptoms.
Today as a workaround I switched to AzureFunctionApp@2 .
So, before we had
- task: AzureCLI@2 displayName: Deploy function inputs: azureSubscription: '$(serviceConnection)' scriptType: bash scriptLocation: inlineScript inlineScript: | az functionapp deployment source config-zip -g ${{ parameters.resourceGroupName }} -n ${{ parameters.appName }} --src $(Pipeline.Workspace)/CI/drop/*.zip
now we have
- task: AzureFunctionApp@2 displayName: 'Deploy Azure Function App' inputs: azureSubscription: '$(serviceConnection)' appType: 'functionAppLinux' appName: '${{ parameters.appName }}' package: '$(Pipeline.Workspace)/CI/drop/*.zip' deploymentMethod: 'zipDeploy'
I haven't yet tested everything, but at least the workaround deploys the functions.
<<END:issue-32128>>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions