Azure / Azure/bicep-types-az

Setting parameterValueType on Microsoft.Web/connections resource throws an error

Open
#1,990 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
108
Forks
44
Avg merge
18h 53m
Merged PRs (30d)
29

Description

**Bicep version**
Bicep CLI version 0.4.1124 (66c84c8ee5)

**Describe the bug**
According to https://docs.microsoft.com/en-us/azure/logic-apps/create-managed-service-identity?tabs=consumption#arm-template-for-managed-connections-and-managed-identities-consumption, I should be able to set parameterValueType to Alternative. So IMO following code should work:

```bicep
param api_connection_sql_name string = 'sql'
param api_connection_sql_name_suffix string = '1'
param azure_sql_database string = 'cost-management'
param azure_subscription string = 'xxxxx-xxxx-xxxx-xxxx-xxxx'
param azure_region string = 'westeurope'

resource ApiConnectionSQL 'Microsoft.Web/connections@2016-06-01' = {
name: '${api_connection_sql_name}-${api_connection_sql_name_suffix}'
location: resourceGroup().location
properties: {
displayName: '${azure_sql_database}-${api_connection_sql_name}-db'
api: {
name: api_connection_sql_name
displayName: 'SQL Server'
iconUri: 'https://connectoricons-prod.azureedge.net/laborbol/patches/1520/${api_connection_sql_name}-mi/1.0.1520.2572/${api_connection_sql_name}/icon.png'
brandColor: '#ba141a'
id: '/subscriptions/${azure_subscription}/providers/Microsoft.Web/locations/${azure_region}/managedApis/${api_connection_sql_name}'
type: 'Microsoft.Web/locations/managedApis'
}
**parameterValueType: 'Alternative'**
customParameterValues: {}
}
}
```

However, Intellisense (in VS Code) shows yellow squiggly and if I try to deploy template, I get following:

```
C:\repos\ApiConnectionSQL.bicep(20,5) : Warning BCP037: The property "parameterValueType" is not allowed on objects of type "ApiConnectionDefinitionProperties". Permissible properties include "changedTime", "createdTime", "nonSecretParameterValues", "parameterValues", "statuses", "testLinks". If this is an inaccuracy in the documentation, please report it to the Bicep Team. [https://aka.ms/bicep-type-issues]

{"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"{\r\n \"error\": {\r\n \"code\": \"InvalidApiConnectionAlternativeParameters\",\r\n \"message\": \"The API connection 'sql-4' has invalid inputs. Parameter value type cannot be set to
'Alternative' because managed identity is not supported in the API definition's connection parameters.\"\r\n }\r\n}"}]}}
```

Warning implies that parameterValueType is not allowed property (contradicting URL from above). Interesting enough error msg implies that parameterValueType should work BUT can't be set to Alternative.

Looking at https://docs.microsoft.com/en-us/azure/templates/microsoft.web/connections?tabs=bicep, parameterValueType is not listed.

Note that if I create this manually (through Logic App), I can use managed identity and all is good. Now I am trying to build this same logic to Bicep template.

So I am a bit confused, where is the problem and how do I fix it?

**To Reproduce**
See above

**Additional context**
Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the Bicep definition for Microsoft.Web/connections@2016-06-01 and compare its allowed properties with the linked Azure managed-connections documentation and the deployment error. Verify whether parameterValueType is supported for this API definition and whether Alternative is valid for the SQL connector. Done means the type and documentation accurately reflect deployable behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.