Azure / Azure/azure-rest-api-specs-examples
Unable to specify a weekly recurring schedule for Global Schedules
- Dominant language
- No language data
- Stars
- 40
- Forks
- 23
- Avg merge
- 23h 36m
- Merged PRs (30d)
- 172
Description
### Link to sample
https://learn.microsoft.com/en-us/rest/api/dtl/global-schedules/create-or-update?view=rest-dtl-2018-09-15&tabs=HTTP
### Library name and version
Rest API (management.azure.com) 2018-09-15
### Language of the Sample
- [X] C#/.NET
- [ ] Java
- [ ] JavaScript/TypedScript
- [ ] Python
- [ ] Golang
- [X] Other - Please specify in Issue details field
### Sample Issue Type
- [X] Sample not working
- [ ] Sample missing
- [ ] Do not understand sample
### Issue details
Currently it doesn't seem possible to specify a Global Schedule with a weekly recurrence. Daily works fine, but providing the weekly recurrence details results in an HTTP400 response that mentions the daily recurrence is missing.
Sample that produces the error:
> PUT https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.DevTestLab/schedules/shutdown-computevm-mycoolvm?api-version=2018-09-15
body:
`{
"location": "canadacentral",
"properties": {
"status": "Enabled",
"timeZoneId": "Hawaiian Standard Time",
"taskType": "ComputeVmShutdownTask",
"targetResourceId": "/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachines/mycoolvm",
"weeklyRecurrence": {
"time": "0700",
"weekdays": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
]
}
}
}`
The response
`{
"error": {
"code": "MissingRequiredProperty",
"message": "Missing required property 'DailyRecurrence'."
}
}`
even if you specify the properties.dailyRecurrence value as such:
> PUT https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.DevTestLab/schedules/shutdown-computevm-mycoolvm?api-version=2018-09-15
body:
`{
"location": "canadacentral",
"properties": {
"status": "Enabled",
"timeZoneId": "Hawaiian Standard Time",
"taskType": "ComputeVmShutdownTask",
"targetResourceId": "/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachines/mycoolvm",
"dailyRecurrence": {
"time": "0700"
},
"weeklyRecurrence": {
"time": "0700",
"weekdays": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
]
}
}
}`
The following HTTP 400 is returned:
`{
"error": {
"code": "ConflictingProperties",
"message": "Input only one of the properties among [WeeklyRecurrence, DailyRecurrence, HourlyRecurrence]. Entering more than one will cause a conflict."
}
}`
I can confirm that it works if you wish to specify only a daily schedule but there is no way that I can get it to add a weekly schedule
### Expected behavior
I would expect an HTTP 201 or 200 with a sample response similar to the example in the documentation:
`{
"properties": {
"status": "Enabled",
"taskType": "ComputeVmShutdownTask",
"weeklyRecurrence": {
"weekdays": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
],
"time": "0700"
},
"timeZoneId": "Hawaiian Standard Time",
"notificationSettings": {
"status": "Disabled",
"timeInMinutes": 0
},
"createdDate": "2020-12-29T22:54:54.9335182+00:00",
"provisioningState": "Succeeded",
"uniqueIdentifier": "{id}"
},
"id": "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/schedules/labvmautostart",
"name": "LabVmAutoStart",
"type": "microsoft.devtestlab/labs/schedules",
"location": "{location}",
"tags": {
"tagName1": "tagValue1"
}
}`
### Actual behavior
An HTTP 400 is returned when only a weekly recurrence is specified:
`{
"error": {
"code": "MissingRequiredProperty",
"message": "Missing required property 'DailyRecurrence'."
}
}`
### Reproduction Steps
1. follow the link to the MS documentation here:
2. [https://learn.microsoft.com/en-us/rest/api/dtl/global-schedules/create-or-update?view=rest-dtl-2018-09-15&tabs=HTTP#code-try-0](url)
3. Sign in with your Azure Account that has a valid subscription.
4. Create a virtual machine
5. Fill in the request required form details and provide a request body that specifies a weekly recurrence schedule. Be sure to set taskType as a "ComputeVmShutdownTask":
`{
"location": "canadacentral",
"properties": {
"status": "Enabled",
"timeZoneId": "Hawaiian Standard Time",
"taskType": "ComputeVmShutdownTask",
"targetResourceId": "/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachines/mycoolvm",
"dailyRecurrence": {
"time": "0700"
},
"weeklyRecurrence": {
"time": "0700",
"weekdays": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
]
}
}
}`
### Environment
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked Global Schedules Create or Update documentation and reproduce the PUT request using the weeklyRecurrence body for a ComputeVmShutdownTask. Compare the documented weekly example with the API responses; done means the sample or API behavior is corrected so a weekly schedule can be created without conflicting or missing recurrence properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100