Skip to content

[BUG]: AzureFunctionApp Task may result in the WEBSITE_RUN_FROM_PACKAGE AppSetting missing on SCM\Kudu and Validation failures #19909

Open
@FinVamp1

Description

@FinVamp1

New issue checklist

Task name

AzureFunctionApp

Task version

2.239.1

Issue Description

  1. Deploy a Function App using AzureFunctionApp v2
  2. The Deployment succeeds but Validation Fails.

Validating deployment package for functions app before Zip Deploy
##[warning]"ZipDeploy Validation WARNING: It is recommended to set app setting WEBSITE_RUN_FROM_PACKAGE = 1 unless you are targeting one of the following scenarios: 1. Using portal editing. 2. Running post deployment scripts. 3. Need write permission in wwwroot. 4. Using custom handler with special requirements. NOTE: If you decide to update app setting WEBSITE_RUN_FROM_PACKAGE = 1, you will have to re-deploy your code. "
Package deployment using ZIP Deploy initiated.

  1. This is because the App Setting is set but Kudu\SCM isn't aware of it yet.
    it looks like the Web App Task knew that Kudu could be out of sync and had some code to wait.

public async updateAndMonitorAppSettings(addProperties: any, deleteProperties?: any): Promise<boolean> {

tl.debug('retrieving values from Kudu service to check if new values are updated');

    while(noOftimesToIterate > 0) {

        var kuduServiceAppSettings = await kuduService.getAppSettings();

        var propertiesChanged: boolean = true;

        for(var property in addProperties) {

            if(kuduServiceAppSettings[property] != addProperties[property]) {

                tl.debug('New properties are not updated in Kudu service :(');

                propertiesChanged = false;

                break;

            }

        }

This work item is to add this code to the Functions task.

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows\Ubuntu

Relevant log output

Validating deployment package for functions app before Zip Deploy
##[warning]"ZipDeploy Validation WARNING: It is recommended to set app setting WEBSITE_RUN_FROM_PACKAGE = 1 unless you are targeting one of the following scenarios: 1. Using portal editing. 2. Running post deployment scripts. 3. Need write permission in wwwroot. 4. Using custom handler with special requirements. NOTE: If you decide to update app setting WEBSITE_RUN_FROM_PACKAGE = 1, you will have to re-deploy your code. "
Package deployment using ZIP Deploy initiated.

Full task logs with system.debug enabled

N/A

Repro steps

- task: AzureFunctionApp@2
            displayName: 'Azure Functions App Deploy: <myAppName>'
            inputs:
              connectedServiceNameARM: '<mySub>'
              appType: '<apptype>'
              appName: '<myappname>'
              deployToSlotOrASE: true
              resourceGroupName: 'MyRG'
              slotName: 'staging'
              package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
              appSettings: '-FinTestAppSetting "Picard"'
              deploymentMethod: 'runFromPackage'

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions