Azure / Azure/bicep-types-az

API connection needs to support connectionRuntimeUrl as output/property

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

Description

**Bicep version**

```bash
$ az bicep version
Bicep CLI version 0.4.63 (7ebed03284)
```

**Describe the bug**

I'm creating an API Connection resource in Azure so that I can then use its Runtime URL in a Logic App connection. However, I'm unable to get the runtime URL despite it being available on the API Connection resource's output from `az cli`

**To Reproduce**
Steps to reproduce the behavior:

```bicep
resource tableStorageConnection 'Microsoft.Web/connections@2016-06-01' = {
name: 'tablestorage'
location: resourceGroup().location
properties: {
displayName: 'tablestorage'
api: {
id: '/subscriptions/${subscription().subscriptionId}/providers/Microsoft.Web/locations/${resourceGroup().location}/managedApis/azuretables'
}
}
tags: tags
}
```

now try to get the `connectionRuntimeUrl` property off the created Azure resource as shown by `az resource show --ids `:
```json
"properties": {
"api": {
"brandColor": "#804998",
"category": "Standard",
"description": "Azure Table storage is a service that stores structured NoSQL data in the cloud, providing a key/attribute store with a schemaless design. Sign into your Storage account to create, update, and query tables and more.",
"displayName": "Azure Table Storage",
"iconUri": "https://connectoricons-prod.azureedge.net/releases/v1.0.1479/1.0.1479.2452/azuretables/icon.png",
"id": "/subscriptions/xxxxx/providers/Microsoft.Web/locations/westus2/managedApis/azuretables",
"name": "azuretables",
"type": "Microsoft.Web/locations/managedApis"
},
"authenticatedUser": {},
"changedTime": "2021-07-06T21:25:02.8856356Z",
"connectionRuntimeUrl": "https://xxxxx.common.logic-westus2.azure-apihub.net/apim/azuretables/xxxxx",
"createdTime": "2021-07-06T21:25:02.8856356Z",
"customParameterValues": {},
"displayName": "tablestorage",
"nonSecretParameterValues": {
"storageaccount": "default"
},
```

I tried by using

`tableStorageConnection.properties.connectionRuntimeUrl` and `tableStorageConnection.properties['connectionRuntimeUrl']`

and am met with the following _warning_ in the CLI during deployment

```shell
/main.bicep(54,54) : Warning BCP053: The type "schemas:30_properties" does not contain property "connectionRuntimeUrl". Available properties include "api", "changedTime", "createdTime", "customParameterValues", "displayName", "nonSecretParameterValues", "parameterValues", "statuses", "testLinks".
```

but the deployment then **fails** in Azure with the same message:
![image](https://user-images.githubusercontent.com/20270743/124676426-66aab180-de73-11eb-830c-103747bd9af7.png)

(Secondary complaint: if it's going to fail the deployment, then bicep should error, not warn)

Bicep's compiled JSON looks like this:
```json
// where I'm trying to use the value
{
"name": "azuretables_runtimeUrl",
"value": "[reference(resourceId('Microsoft.Web/connections', 'tablestorage')).connectionRuntimeUrl]"
},
...
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "tablestorage",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "tablestorage",
"api": {
"id": "[format('/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/azuretables', subscription().subscriptionId, resourceGroup().location)]"
}
},
"tags": "[parameters('tags')]"
}

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the type definition for Microsoft.Web/connections@2016-06-01 and reproduce the issue with the Bicep resource shown in the report. Check how connectionRuntimeUrl is represented and how the resulting reference diagnostic is emitted. Done means the property is handled consistently with the Azure resource output and the reported invalid deployment case is diagnosed appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, typescript
Domain
api, cloud, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.