Azure / Azure/azure-rest-api-specs

[BUG] `Microsoft.DevTestLab/schedules` API does not return `notificationSettings.webhookUrl` property in response

Open
#46,146 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

### API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/devtestlabs/resource-manager/Microsoft.DevTestLab/DevTestLabs/stable/2018-09-15/DTL.json

### API Spec version

2018-09-15

### Describe the bug

`Microsoft.DevTestLab/schedules` API for [schedules](https://learn.microsoft.com/en-us/rest/api/dtl/schedules/create-or-update?view=rest-dtl-2018-09-15&tabs=HTTP) and [global schedules](https://learn.microsoft.com/en-us/rest/api/dtl/global-schedules/create-or-update?view=rest-dtl-2018-09-15&tabs=HTTP) does not return [`notificationSettings.webhookUrl` property](https://learn.microsoft.com/en-us/rest/api/dtl/global-schedules/create-or-update?view=rest-dtl-2018-09-15&tabs=HTTP#notificationsettings) in response even if the property is set in request. This happens too when [creating auto-shutdown schedule](https://learn.microsoft.com/en-us/azure/virtual-machines/auto-shutdown-vm?tabs=portal#configure-auto-shutdown-for-a-virtual-machine) with webhook URL in virtual machine using portal, where webhook URL is empty after saving and refreshing.

### Expected behavior

After sending request to create auto-shutdown schedule, whether through [REST API](https://learn.microsoft.com/en-us/rest/api/dtl/global-schedules/create-or-update?view=rest-dtl-2018-09-15&tabs=HTTP) with `notificationSettings.webhookUrl` or portal with "webhook URL" specified (for example `https://www.bing.com/2/4`), it should be able to verify the setting of webhook URL through the response below.

API response
```json
...
"notificationSettings": {
"emailRecipient": "REDACTED",
"status": "Enabled",
"timeInMinutes": 15,
"webhookUrl": "https://www.bing.com/2/4"
},
...
```

Portal response
Image

### Actual behavior

The actual response is that `notificationSettings.webhookUrl` is missing from API response and portal "webhook URL" is empty after saving and refreshing.

API response
```json
...
"notificationSettings": {
"emailRecipient": "REDACTED",
"status": "Enabled",
"timeInMinutes": 15
},
...
```

Portal response
Image

### Reproduction Steps

To reproduce the issue with REST API for [schedules](https://learn.microsoft.com/en-us/rest/api/dtl/schedules/create-or-update?view=rest-dtl-2018-09-15&tabs=HTTP), use the following request and body with existing DevTest labs.

Request
```
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}?api-version=2018-09-15
```

Body
```json
{
"location": "japaneast",
"properties": {
"dailyRecurrence": {
"time": "0900"
},
"notificationSettings": {
"status": "Enabled",
"timeInMinutes": 30,
"webhookUrl": "https://www.bing.com/2/4"
},
"status": "Enabled",
"taskType": "LabVmsShutdownTask",
"timeZoneId": "India Standard Time"
},
"tags": {
"environment": "Production"
}
}
```

To reproduce the issue with REST API for [global schedules](https://learn.microsoft.com/en-us/rest/api/dtl/global-schedules/create-or-update?view=rest-dtl-2018-09-15&tabs=HTTP), use the following request and body with existing virtual machine.

Request
```
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}?api-version=2018-09-15
```

Body
```json
{
"location": "japaneast",
"properties": {
"dailyRecurrence": {
"time": "1100"
},
"notificationSettings": {
"emailRecipient": "REDACTED",
"status": "Enabled",
"timeInMinutes": 15,
"webhookUrl": "https://www.bing.com/2/4"
},
"status": "Disabled",
"targetResourceId": "/subscriptions/REDACTED/resourceGroups/REDACTED/providers/Microsoft.Compute/virtualMachines/REDACTED",
"taskType": "ComputeVmShutdownTask",
"timeZoneId": "Central Standard Time"
},
"tags": {
"Environment": "Production"
}
}
```

To reproduce the issue with portal, follow the steps in [documentation](https://learn.microsoft.com/en-us/azure/virtual-machines/auto-shutdown-vm?tabs=portal#configure-auto-shutdown-for-a-virtual-machine) and set "webhook URL". The behavior for DevTest labs in portal is not tested but considering that its REST API is problematic, the issue should happen for DevTest labs in portal too.

### Environment

REST API request is sent with [`terraform-provider-azurerm`](https://github.com/hashicorp/terraform-provider-azurerm) `main` branch.

Contributor guide

Open the contributing guide

Research direction

Start with specification/devtestlabs/resource-manager/Microsoft.DevTestLab/DevTestLabs/stable/2018-09-15/DTL.json and compare the schedules and global schedules definitions with the reproduction requests. Verify whether webhookUrl is represented in the schema and reproduce the REST response; done means the documented API response preserves notificationSettings.webhookUrl for both schedule types.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.