Azure / Azure/bicep

Alert Rules + Autocomplete produces invalid syntax

Open
#7,866 0 comments 0 reactions 0 assignees View on GitHub
bug devdiv
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Bicep version**
run `bicep --version` via the Bicep CLI, `az bicep version` via the AZ CLI or via VS code by navigating to the extensions tab and searching for Bicep

**Describe the bug**
When setting up a `alertRules` through VSCode you are prompted with these three options, all which produce an invalid syntax with `odata.context`.

![image](https://user-images.githubusercontent.com/700740/183450653-ed40d552-2d7a-47ee-836d-432d23654c45.png)

![image](https://user-images.githubusercontent.com/700740/183450729-d70b6cd1-603f-4afc-8a31-e51c71b8fbb8.png)

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

Start with the following code:
```bicep

resource test 'Microsoft.Insights/alertrules@2016-03-01' ={
name: 'test'
location: 'eastus'
properties: {
condition: // put text cursor here and try to auto complete
isEnabled: true
name: 'test'
}
}

```

It should produce:

```bicep
resource test 'Microsoft.Insights/alertrules@2016-03-01' ={
name: 'test'
location: 'eastus'
properties: {
condition: {
odata.type: 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' // ERR - Property has a dot
failedLocationCount:
}
isEnabled: true
name: 'test'
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in VS Code with the provided Microsoft.Insights/alertrules resource and inspect the autocomplete suggestions for the condition property. Trace the resource schema or language-service entry point that generates those snippets; done means each suggestion produces valid Bicep syntax without a dotted property name such as odata.type.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.