I've been able to successfully schedule jobs in Azure Scheduler using Microsoft Azure Scheduler Management Library for all intervals except monthly on a specific day of the week. For example, I need to schedule a recurring job that runs every 1 month on the first Thursday of the month. The Azure Scheduler portal allows for this but I can't figure out how to code this using the Azure library.
Below is the latest code I've tried. Azure Scheduler ends up creating a monthly recurring job (viewed in the Azure portal) but it doesn't show any selections for day-of-week (they're all unchecked) so the code did not work.
I searched exhaustively online for documentation or examples for using the scheduler library for this scenario but came up empty. I am seeking a working code example for this monthly recurrence.
var monthlyOccurrence = new List<JobScheduleMonthlyOccurrence>();
monthlyOccurrence.Add(new JobScheduleMonthlyOccurrence() { Day = JobScheduleDay.Thursday, Occurrence = 1 });
JobCreateOrUpdateResponse jobResp = schedClient.Jobs.CreateOrUpdate("testRecurrenceIssue", new JobCreateOrUpdateParameters
{
Action = new JobAction
{
Request = new JobHttpRequest { Uri = new Uri("http://www.myservice.com"), Method = "GET" },
},
Recurrence = new JobRecurrence
{
Frequency = JobRecurrenceFrequency.Month,
Interval = 1,
EndTime = new DateTime(2014, 12, 31),
Schedule = new JobRecurrenceSchedule
{
Days = null,
Hours = null,
Minutes = null,
MonthDays = null,
MonthlyOccurrences = monthlyOccurrence,
Months = null
}
}
});
Note that I've been able to schedule a monthly recurrence for specific days of the month, such as "run monthly on days 1, 14, 21, and 28" but can't figure out how to code the specific day of week scenario I mentioned above. Thanks for your help!