Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
parameters:
- name: component
type: object
- name: environment
type: object
steps:
- task: replacetokens@3
name: ReplaceVariables
displayName: Replace variables in parameter file
inputs:
targetFiles: '$(Pipeline.Workspace)/BuildPipeline/FunctionApp_${{parameters.component.name}}/${{parameters.component.templateName}}.parameters.json'
encoding: 'auto'
writeBOM: true
actionOnMissing: 'warn'
keepToken: false
tokenPrefix: '#{'
tokenSuffix: '}#'
useLegacyPattern: false
emptyValue:
enableTransforms: false
enableTelemetry: false
- task: AzureResourceManagerTemplateDeployment@3
name: DeployARMTemplate
displayName: Deploy Function App for Azure Function
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: ${{parameters.environment.azureServiceConnection}}
subscriptionId: $(Infra.Subscription)
action: 'Create Or Update Resource Group'
resourceGroupName: '${{parameters.component.resourceGroupName}}'
location: 'West Europe'
templateLocation: 'Linked artifact'
csmFile: '$(Pipeline.Workspace)/BuildPipeline/FunctionApp_${{parameters.component.name}}/${{parameters.component.templateName}}.json'
csmParametersFile: '$(Pipeline.Workspace)/BuildPipeline/FunctionApp_${{parameters.component.name}}/${{parameters.component.templateName}}.parameters.json'
deploymentMode: 'Incremental'
deploymentOutputs: armOutputs
- pwsh: $(Pipeline.Workspace)/BuildPipeline/Pipeline/parse_arm_deployment_output.ps1 -ArmOutputString '$(armOutputs)' -MakeOutput -ErrorAction Stop
name: ArmVariables
displayName: Process output variables
- task: AzureFunctionApp@1
inputs:
azureSubscription: ${{parameters.environment.azureServiceConnection}}
appType: 'functionApp'
appName: '$(ArmVariables.functionApp)'
package: '$(Pipeline.Workspace)/BuildPipeline/AzureFunction_${{parameters.component.name}}'
deploymentMethod: 'auto'
${{if ne(parameters.component.slot, '')}}:
deployToSlotOrASE: true
slot: ${{parameters.component.slot}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment