Home > Software engineering >  Sample ARM template for Azure Function deployment (linux) using multistage YAML (MSY)
Sample ARM template for Azure Function deployment (linux) using multistage YAML (MSY)

Time:01-20

I need sample ARM template which I can refer to deploy Function app in Azure portal. I am using multi stage YAML deployment (not classic deployment). The App service plan kind is Linux.

I need the configuration step which is responsible for deploying code to Function app.

I know we can use MS deploy in case of Window App service plan . I need for linux environment.

Basically, I need confirmation if we can do zip deployment using multi stage yaml deployment for linux environment.

Windows example:

{
          "name": "MSDeploy",
          "type": "extensions",
          "location": "[parameters('location')]",
          "apiVersion": "2019-08-01",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', variables('functionAppName'))]"
          ],
          "properties": {
            "packageUri": "[concat(parameters('containerUri'), parameters('functionAppPackageName'), parameters('containerSasToken'))]",
            "AppOffline": true
          }
        }

CodePudding user response:

I am not sure why you want ARM template to deploy the azure function, the DevOps pipeline itself can handle this operation.

steps:
- task: AzureFunctionApp@1
  displayName: 'Azure Function App Deploy'
  inputs:
    azureSubscription: 'xxx'
    appType: functionAppLinux
    appName: xxx
    deployToSlotOrASE: true
    resourceGroupName: xxx
    runtimeStack: 'xxx'

But if you need ARM template, you can refer to this official document:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-infrastructure-as-code#customizing-a-deployment

CodePudding user response:

Yes, it supports zip deployment using multi stage YAML deployment for Linux environment.

Multi-Stage Pipelines using YAML for Continuous Delivery – Azure DevOps

The above reference has all the requirements and configuration steps of deploying any code to the Azure Function App.

steps:  
- task:  AzureFunctionApp@1  
- displayName:  Azure  Function  App  Deploy
inputs:  
    azureSubscription:  $(azureSubscription)
    appName:  samplefunctionapp
    package: $(System.DefaultWorkingDirectory)/**/*.zip

This Microsoft documentation provides a good example of deploying the azure functions in linux environment through Multi Stage YAML. Also please check this reference.

  •  Tags:  
  • Related