You can add an Azure Powershell Script Task and add the script below to Enable/Disable the scheduler jobs:
Set the Job to "Disabled":
Set-AzureRmSchedulerHttpJob -ResourceGroupName ABC -JobCollectionName ABC -JobName ABC -JobState Disabled
Set the Job to "Enabled":
Set-AzureRmSchedulerHttpJob -ResourceGroupName ABC -JobCollectionName ABC -JobName ABC -JobState Enabled
If you want to enable/disable the JobCollection, you can use Enable-AzureRmSchedulerJobCollection
and Disable-AzureRmSchedulerJobCollection
Command:
Enable-AzureRmSchedulerJobCollection -ResourceGroupName ABC -JobCollectionName ABC
Use the script below:
$JobC = Get-AzureRmSchedulerJobCollection -ResourceGroupName jobcollection -JobCollectionName jobcollection
If ($JobC.State -eq "Enabled")
{
Write-Host "JobCollection is enabled, disabling it..."
Disable-AzureRmSchedulerJobCollection -ResourceGroupName jobcollection -JobCollectionName jobcollection
Write-Host "JobCollection is disabled now."
}
Else
{
Write-Host "JobCollection has already been disabled."
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…