azure-pipelines-tasks: [BUG]: AzureFunctionApp@2 fails to deploy if Private EndPoints exists even with correct network permissions on scm
Task name
AzureFunctionApp@2
Task version
2.221.105
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
ubuntu-latest
Task log
Starting: Deploy Management Subsystem to obxxx-as
==============================================================================
Task : Azure Functions Deploy
Description : Update a function app with .NET, Python, JavaScript, PowerShell, Java based web applications
Version : 2.221.105
Author : Microsoft Corporation
Help : https://aka.ms/azurefunctiontroubleshooting
==============================================================================
Got service connection details for Azure App Service:'obxx-as'
(node:1611) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
##[error]Function app has private endpoint(s). But you are not running this pipeline from a self-hosted agent that has access to the Functions App. Relevant documentation: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&tabs=browser#install
NOTE: Function app is VNet integrated.
##[error]Error: Networking validation for the Function app and Storage account has failed. Please review all error messages.
Successfully updated deployment History at https://obxxx-as.scm.azurewebsites.net/api/deployments/331686839307234
App Service Application URL: https://obxx-as.azurewebsites.net
Finishing: Deploy Management Subsystem to obxx-as
Relevant log output
##[error]Function app has private endpoint(s). But you are not running this pipeline from a self-hosted agent that has access to the Functions App. Relevant documentation: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&tabs=browser#install
NOTE: Function app is VNet integrated.
##[error]Error: Networking validation for the Function app and Storage account has failed. Please review all error messages.
Aditional info
TL;DR;
AzureFunctionApp@2 fails with "Function app has private endpoint(s). But you are not running this pipeline from a self-hosted agent that has access to the Functions App. Relevant documentation: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&tabs=browser#install " even when “AzureCloud” is allowed access to SCM site.
Note that Pipelines are able to talk to the Function app as folders and logs are created by Pipelines in the /site/deployments folder.
Using AzureRmWebAppDeployment@4 works correctly.
Details
Create an Azure Function with the following security restrictions (Bicep syntax)
properties: {
…
siteConfig: {
…
scmIpSecurityRestrictions: [
{
name: 'Azure DevOps'
action: 'Allow'
priority: 600
tag: 'ServiceTag'
ipAddress: 'AzureCloud'
}
]
scmIpSecurityRestrictionsDefaultAction: 'Deny'
ipSecurityRestrictionsDefaultAction: 'Deny'
scmIpSecurityRestrictionsUseMain: false
ipSecurityRestrictions: [ ]
}
publicNetworkAccess: 'Enabled'
}
Then add a Private EndPoint
When you try to deploy like this from an Azure Pipeline:
- task: AzureFunctionApp@2
displayName: "Deploy Management Subsystem to ${{ parameters.mgtSubsysAppName }}"
inputs:
azureSubscription: ${{ parameters.azureSubscription }}
appType: functionAppLinux
appName: ${{ parameters.mgtSubsysAppName }}
ResourceGroupName: ${{ parameters.resourceGroupName }}
package: "$(System.ArtifactsDirectory)/*.zip"
runtimeStack: 'NODE|18'
You get the following result:
Starting: Deploy Management Subsystem to obxx-as
==============================================================================
Task : Azure Functions Deploy
Description : Update a function app with .NET, Python, JavaScript, PowerShell, Java based web applications
Version : 2.221.105
Author : Microsoft Corporation
Help : https://aka.ms/azurefunctiontroubleshooting
==============================================================================
Got service connection details for Azure App Service:'obxxxx-as'
(node:1611) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
##[error]Function app has private endpoint(s). But you are not running this pipeline from a self-hosted agent that has access to the Functions App. Relevant documentation: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&tabs=browser#install
NOTE: Function app is VNet integrated.
##[error]Error: Networking validation for the Function app and Storage account has failed. Please review all error messages.
Successfully updated deployment History at https://obxxx-as.scm.azurewebsites.net/api/deployments/331686839307234
App Service Application URL: https://obxxx-as.azurewebsites.net
Finishing: Deploy Management Subsystem to obxxx-as
Importantly, Pipelines does manage to create a deployments folder on the Function App server and create a log file, with the content “Deployment failed.”
Using the following instead - which is not recommended - successfully deploys the app:
- task: AzureRmWebAppDeployment@4
displayName: "Deploy Management Subsystem to ${{ parameters.mgtSubsysAppName }}"
inputs:
appType: functionAppLinux
ConnectionType: AzureRM
ConnectedServiceName: ${{ parameters.azureSubscription }}
ResourceGroupName: ${{ parameters.resourceGroupName }}
WebAppName: ${{ parameters.mgtSubsysAppName }}
packageForLinux: "$(System.ArtifactsDirectory)/*.zip"
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 15 (1 by maintainers)
We are running into the same problem. Any updates on this?
Hello, it’s on the backlog for the task and we need to figure out what the right thing is to do. No ETA at present.
Another way to use the work around when using the GUI, is to use the ‘Azure App Service Deploy’ task and select the App Service type to be Function App on Linux / Function App on Windows. Note that the system clearly tells you that this is not recommended on at least two occasions; when making the App Service type selection and when running the task on the agent, it will give the following message: ##[warning]Recommendation: Use Azure Functions Task to deploy Function app.
Nonetheless the Function App is deployed successfully.