i just created an azure pipeline to scale down the sql database. but i have no idea how can i schedule it. i found the -schedule command but that is for the whole pipeline. do we have any syntax for scheduling the tasks? for example, first task should be done every nights to scale down the db and second task should be done every mornings to scale it up. please see the below code for the first task.
trigger: none
pool:
vmImage: 'ubuntu-latest'
steps:
task: AzureCLI@2
displayName: Downgrade SQL Servers
inputs: azureSubscription: '.....'
server: "pardis-test"
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
echo "Scaling down $server"
az sql db update --id ....... --edition Basic --service-objective Basic --max-size 2
finally, i devided the pipeline into 2 pipelines. one for scaling down databases during nights and the other one is to scaling up the databases at mornings and i put one schedule for each.
schedules:
- cron: "0 13 * * Monday-Friday"
displayName: DailyScaledown
branches: include: - main
always: true