gpt4 book ai didi

azure - 如何删除所有函数,然后从 AZURE DEVOPS PIPELINE 部署函数应用?

转载 作者:行者123 更新时间:2023-12-02 06:54:49 28 4
gpt4 key购买 nike

我正在通过 Azure DevOps 管道部署函数应用程序。我使用如下方法来部署管道:

  - task: AzureCLI@2
displayName: 'Deploy function'
inputs:
azureSubscription: ${{parameters.serviceConnection}}
scriptType: 'ps'
scriptLocation: 'inlineScript'
inlineScript: |
az webapp deployment source config-zip -g $(resourceGroup) -n $(functionAppName) --src $(Pipeline.Workspace)\adx-integration-build\drop\azure-function\Integration.zip --subscription $(Subscription) --verbose

这工作正常,但是当我在 azure 中部署代码时,旧函数(之前部署的函数)不会被删除。我想知道是否有任何方法可以在使用Azure管道部署期间从函数应用程序中删除所有不必要的函数。

注意:我们可以选择删除所有函数,然后从 Visual Studio 部署这些函数,但我想从 Azure 管道执行此操作。

最佳答案

请尝试执行以下任务:

    # Start Deploy
- task: AzureFunctionApp@1
displayName: "Deploy Functions"
inputs:
azureSubscription: "${{ parameters.Subscription }}"
appName: "${{ parameters.functionName}}"
package: "$(Agent.BuildDirectory)/${{ parameters.ArtifactName}}/Functions.zip"

有 3 种部署类型:

  • Kudu REST API
  • Zip 部署
  • 从包运行

包部署方法使目录内容只读,只执行包内容。

https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-function-app?view=azure-devops#run-from-package

When you run from a package, the wwwroot folder becomes read-only and you'll receive an error when writing files to this directory. Files are also read-only in the Azure portal.

You can't use local cache when running from a deployment package.

关于azure - 如何删除所有函数,然后从 AZURE DEVOPS PIPELINE 部署函数应用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73582910/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com