Skip to content

Instantly share code, notes, and snippets.

@nielsvanderkaap
Last active September 4, 2021 11:24
Show Gist options
  • Save nielsvanderkaap/2ef5ef9dea0d6962fe34b3db95102ea0 to your computer and use it in GitHub Desktop.
Save nielsvanderkaap/2ef5ef9dea0d6962fe34b3db95102ea0 to your computer and use it in GitHub Desktop.
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