how do I change the azure function CRON expression at the deployment time?
we want to change the CRON expression value of the azure function from one environment to another environment how do I do that?
eg: on DEV --> "0 5 * * * *" on TEST --> "0 * * * * *" on UAT --> "0 5 * * * *"
What changes I need to make to my CICD pipeline (Yaml file) to make this possible. here is the same
- stage:
displayName: TST
jobs:
- deployment: TST
displayName: deploy funtion app to Test
environment: 'deploy-tst'
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: [artifact-name]
- task: AzureFunctionApp@1
inputs:
azureSubscription: '[azure-subscription-name]'
appType: 'functionApp'
appName: '[function-app-name]'
package: '$(Pipeline.Workspace)/**/*.zip'
deploymentMethod: 'runFromPackage'
You can use %EmailScheduleTriggerTime%
(or any other setting name) in your time trigger function and move the setting to a configuration file. In your case, during the release you'll set the correct value for the property in you azure app service setting.
eg
{
"IsEncrypted": false,
"Values": {
"EmailScheduleTriggerTime": "0 30 9-12 * * *", //Run every 30 minutes from 9:00 to 12:00
},
"ConnectionStrings": {
"DefaultConnection": ""
}
}
[FunctionName("TimerfunctionApp")]
public static void Run([TimerTrigger("%EmailScheduleTriggerTime%")] TimerInfo TInfo, TraceWriter log)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.