You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You'll deploy with the [Azure Function App Deploy](/azure/devops/pipelines/tasks/deploy/azure-function-app) task. This task requires an [Azure service connection](/azure/devops/pipelines/library/service-endpoints) as an input. An Azure service connection stores the credentials to connect from Azure Pipelines to Azure.
188
188
189
-
To deploy to Azure Functions, add the following snippet at the end of your `azure-pipelines.yml` file. The default `appType` is Windows. You can specify Linux by setting the `appType` to `functionAppLinux`.
189
+
To deploy to Azure Functions, add the following snippet at the end of your `azure-pipelines.yml` file. The default `appType` is Windows. You can specify Linux by setting the `appType` to `functionAppLinux`. Deploying to a Flex Consumption app is not supported with @v1 of the AzureFunctionApp task.
190
190
191
191
```yaml
192
192
trigger:
@@ -435,8 +435,35 @@ You'll deploy with the [Azure Function App Deploy v2](/azure/devops/pipelines/ta
435
435
436
436
The v2 version of the task includes support for newer applications stacks for .NET, Python, and Node. The task includes networking predeployment checks. When there are predeployment issues, deployment stops.
437
437
438
-
To deploy to Azure Functions, add the following snippet at the end of your `azure-pipelines.yml` file. The default `appType` is Windows. You can specify Linux by setting the `appType` to `functionAppLinux`.
438
+
To deploy to Azure Functions, add the following snippet at the end of your `azure-pipelines.yml` file. The default `appType` is Windows. You can specify Linux by setting the `appType` to `functionAppLinux`. Deploying to a Flex Consumption app requires you to set both `appType: functionAppLinux` and `isFlexConsumption: true`.
439
439
440
+
### [Windows App](#tab/windows)
441
+
```yaml
442
+
trigger:
443
+
- main
444
+
445
+
variables:
446
+
# Azure service connection established during pipeline creation
447
+
azureSubscription: <Name of your Azure subscription>
448
+
appName: <Name of the function app>
449
+
# Agent VM image name
450
+
vmImageName: 'windows-latest'
451
+
452
+
- task: AzureFunctionApp@2 # Add this at the end of your file
453
+
inputs:
454
+
azureSubscription: <Azure service connection>
455
+
appType: functionApp # this specifies a Windows-based function app
The snippet assumes that the build steps in your YAML file produce the zip archive in the `$(System.ArtifactsDirectory)` folder on your agent.
466
494
495
+
If you opted to deploy to a [deployment slot](functions-deployment-slots.md), you can add the following step to perform a slot swap. Deployment slots are not yet available for the Flex Consumption SKU.
496
+
```yaml
497
+
- task: AzureAppServiceManage@0
498
+
inputs:
499
+
azureSubscription: <Azure service connection>
500
+
WebAppName: <name of the Function app>
501
+
ResourceGroupName: <name of resource group>
502
+
SourceSlot: <slot name>
503
+
SwapWithProduction: true
504
+
```
505
+
467
506
## Deploy a container
468
507
469
508
You can automatically deploy your code to Azure Functions as a custom container after every successful build. To learn more about containers, see [Working with containers and Azure Functions](./functions-how-to-custom-container.md) .
@@ -498,33 +537,6 @@ variables:
498
537
499
538
The snippet pushes the Docker image to your Azure Container Registry. The **Azure Function App on Container Deploy** task pulls the appropriate Docker image corresponding to the `BuildId` from the repository specified, and then deploys the image.
500
539
501
-
## Deploy to a slot
502
-
503
-
You can configure your function app to have multiple slots. Slots allow you to safely deploy your app and test it before making it available to your customers.
504
-
505
-
The following YAML snippet shows how to deploy to a staging slot, and then swap to a production slot:
506
-
507
-
```yaml
508
-
- task: AzureFunctionApp@2
509
-
inputs:
510
-
azureSubscription: <Azure service connection>
511
-
appType: functionAppLinux
512
-
appName: <Name of the Function app>
513
-
package: $(System.ArtifactsDirectory)/**/*.zip
514
-
deploymentMethod: 'auto'
515
-
deployToSlotOrASE: true
516
-
resourceGroupName: <Name of the resource group>
517
-
slotName: staging
518
-
519
-
- task: AzureAppServiceManage@0
520
-
inputs:
521
-
azureSubscription: <Azure service connection>
522
-
WebAppName: <name of the Function app>
523
-
ResourceGroupName: <name of resource group>
524
-
SourceSlot: staging
525
-
SwapWithProduction: true
526
-
```
527
-
528
540
## Create a pipeline with Azure CLI
529
541
530
542
To create a build pipeline in Azure, use the `az functionapp devops-pipeline create` [command](/cli/azure/functionapp/devops-pipeline#az-functionapp-devops-pipeline-create). The build pipeline is created to build and release any code changes that are made in your repo. The command generates a new YAML file that defines the build and release pipeline and then commits it to your repo. The prerequisites for this command depend on the location of your code.
0 commit comments