`Microsoft.ApiManagement/service/portalsettings@2021-12-01-preview` - Bad Request - Inconsistent API?
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.9.1 (a2950a16df)
**Describe the bug**
This resource does not work like I would expect in the Bicep. I would expect when this runs that delegation settings are all off, which does not require a `url` or a `validationKey` in the Portal.
If you wanted to use IAC to disable delegation I'm not sure if its possible since you can't tell it to not be enabled.

**To Reproduce**
```bicep
resource apim 'Microsoft.ApiManagement/service@2021-12-01-preview' = {
name: name
location: location
sku: {
capacity: 1
name: 'Developer'
}
properties: {
publisherEmail: 'john.doe@somedomain.com'
publisherName: 'John Doe'
}
}
resource DelegationSettings 'Microsoft.ApiManagement/service/portalsettings@2021-12-01-preview' = {
parent: apim
name: 'delegation'
properties: {
subscriptions: {
enabled: false
}
userRegistration: {
enabled: false
}
// url: ''
// validationKey: ''
}
}
```
Produces
```json
{
"status": "Failed",
"error": {
"code": "ValidationError",
"message": "One or more fields contain incorrect values:",
"details": [
{
"target": "Url",
"message": "The following errors occured during validation: {0}"
},
{
"target": "ValidationKey",
"message": "The following errors occured during validation: {0}"
}
]
}
}
```
If I sent an empty string it produces the same validation message. Also `occured` is not spelled correctly.
Interestingly in the Portal UI if you load and hit save you do get the same validation message:

Contributor guide
Research direction
Start with the reported Bicep reproduction for Microsoft.ApiManagement/service/portalsettings@2021-12-01-preview and compare the delegation settings sent when subscriptions and userRegistration are disabled. Check whether the Azure API accepts omitted or empty url and validationKey values; done means confirming a deployable configuration or documenting that the behavior must be fixed outside Bicep.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100