Azure / Azure/azure-rest-api-specs

`Microsoft.Web/sites/config/logs` doesn't follow API roundtrip consistency for its `sasUrl` field

Open
#22,504 2 comments 4 reactions 0 assignees View on GitHub
Service Attention Web Apps
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
3d 2h
Merged PRs (30d)
424

Description

Sending a PUT request to `https://management.azure.com/subscriptions/xxxx/resourceGroups/acctestRG-storage-220816112105435513/providers/Microsoft.Web/sites/acctestWA-magodo/config/logs?api-version=2021-02-01`

```json
{
"properties": {
"applicationLogs": {
"fileSystem": {
"level": "Warning"
},
"azureBlobStorage": {
"level": "Information",
"sasUrl": "https://unlikely25exst2acctv9ipa.blob.core.windows.net/content?sv=2018-11-09&sr=c&st=2021-03-16T21%3A21%3A36Z&se=2221-03-16T21%3A21%3A36Z&sp=racwdl&spr=https&sig=Tu46c%2FnMpR%2B7S4ToqQOdsH%2F66vaaKmgynPh3TNuSp8I%3D&sr=b",
"retentionInDays": 2
}
},
"httpLogs": {
"azureBlobStorage": {
"sasUrl": "https://unlikely25exst2acctv9ipa.blob.core.windows.net/content?sv=2018-11-09&sr=c&st=2021-03-16T21%3A21%3A36Z&se=2221-03-16T21%3A21%3A36Z&sp=racwdl&spr=https&sig=Tu46c%2FnMpR%2B7S4ToqQOdsH%2F66vaaKmgynPh3TNuSp8I%3D&sr=b",
"retentionInDays": 3,
"enabled": true
}
},
"failedRequestsTracing": {
"enabled": false
},
"detailedErrorMessages": {
"enabled": false
}
}
}
```

On success, GET it:

```json
{
"id": "/subscriptions/xxxx/resourceGroups/acctestRG-storage-220816112105435513/providers/Microsoft.Web/sites/acctestWA-magodo/config/logs",
"name": "logs",
"type": "Microsoft.Web/sites/config",
"location": "West US 2",
"tags": {},
"properties": {
"applicationLogs": {
"fileSystem": {
"level": "Warning"
},
"azureTableStorage": {
"level": "Off",
"sasUrl": null
},
"azureBlobStorage": {
"level": "Information",
"sasUrl": "https://unlikely25exst2acctv9ipa.blob.core.windows.net/content?sv=2018-11-09&sr=c&st=2021-03-16T21:21:36Z&se=2221-03-16T21:21:36Z&sp=racwdl&spr=https&sig=Tu46c%2FnMpR%2B7S4ToqQOdsH%2F66vaaKmgynPh3TNuSp8I%3D&sr=b",
"retentionInDays": 2
}
},
"httpLogs": {
"fileSystem": {
"retentionInMb": 35,
"retentionInDays": 3,
"enabled": false
},
"azureBlobStorage": {
"sasUrl": "https://unlikely25exst2acctv9ipa.blob.core.windows.net/content?sv=2018-11-09&sr=c&st=2021-03-16T21:21:36Z&se=2221-03-16T21:21:36Z&sp=racwdl&spr=https&sig=Tu46c%2FnMpR%2B7S4ToqQOdsH%2F66vaaKmgynPh3TNuSp8I%3D&sr=b",
"retentionInDays": 3,
"enabled": true
}
},
"failedRequestsTracing": {
"enabled": false
},
"detailedErrorMessages": {
"enabled": false
}
}
}
```

Diff both gives us:

```diff
1a2,6
> "id": "/subscriptions/xxxx/resourceGroups/acctestRG-storage-220816112105435513/providers/Microsoft.Web/sites/acctestWA-magodo/config/logs",
> "name": "logs",
> "type": "Microsoft.Web/sites/config",
> "location": "West US 2",
> "tags": {},
6a12,15
> "azureTableStorage": {
> "level": "Off",
> "sasUrl": null
> },
9c18
< "sasUrl": "https://unlikely25exst2acctv9ipa.blob.core.windows.net/content?sv=2018-11-09&sr=c&st=2021-03-16T21%3A21%3A36Z&se=2221-03-16T21%3A21%3A36Z&sp=racwdl&spr=https&sig=Tu46c%2FnMpR%2B7S4ToqQOdsH%2F66vaaKmgynPh3TNuSp8I%3D&sr=b",
---
> "sasUrl": "https://unlikely25exst2acctv9ipa.blob.core.windows.net/content?sv=2018-11-09&sr=c&st=2021-03-16T21:21:36Z&se=2221-03-16T21:21:36Z&sp=racwdl&spr=https&sig=Tu46c%2FnMpR%2B7S4ToqQOdsH%2F66vaaKmgynPh3TNuSp8I%3D&sr=b",
13a23,27
> "fileSystem": {
> "retentionInMb": 35,
> "retentionInDays": 3,
> "enabled": false
> },
15c29
< "sasUrl": "https://unlikely25exst2acctv9ipa.blob.core.windows.net/content?sv=2018-11-09&sr=c&st=2021-03-16T21%3A21%3A36Z&se=2221-03-16T21%3A21%3A36Z&sp=racwdl&spr=https&sig=Tu46c%2FnMpR%2B7S4ToqQOdsH%2F66vaaKmgynPh3TNuSp8I%3D&sr=b",
---
> "sasUrl": "https://unlikely25exst2acctv9ipa.blob.core.windows.net/content?sv=2018-11-09&sr=c&st=2021-03-16T21:21:36Z&se=2221-03-16T21:21:36Z&sp=racwdl&spr=https&sig=Tu46c%2FnMpR%2B7S4ToqQOdsH%2F66vaaKmgynPh3TNuSp8I%3D&sr=b",
```

The issue is that the `sasUrl` fields are not keeping what the users have sent, i.e. the `se` and `st` are urldecoded somehow. This doesn't follow the Azure API guideline that request and response should be roundtrip consistent.

Relates to https://github.com/hashicorp/terraform-provider-azurerm/issues/19680

Contributor guide

Open the contributing guide

Research direction

Start with the Microsoft.Web/sites/config/logs PUT and GET examples in the report and compare the sasUrl values, then review the related Terraform issue for context. Done means the service or specification behavior preserves the submitted sasUrl encoding so the request and response are roundtrip consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.