You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `console` command provides an interactive Read-Eval-Print Loop (REPL) environment for Bicep expressions. It allows you to experiment with Bicep functions and expressions in an interactive console session.
5
+
6
+
## Features
7
+
-**Interactive Expression Evaluation**: Enter Bicep expressions and see their evaluated results immediately
8
+
-**Variable Declarations**: Define variables using `var name = expression` syntax and reuse them in subsequent expressions
9
+
-**Multi-line Input**: Support for complex multi-line expressions with automatic structural completion detection
10
+
-**Syntax Highlighting**: Real-time syntax highlighting for input and output
11
+
12
+
## Usage
13
+
```sh
14
+
bicep console
15
+
```
16
+
17
+
## Examples
18
+
19
+
### Simple Expressions
20
+
```bicep
21
+
> 1 + 2
22
+
3
23
+
24
+
> 'Hello, ' + 'World!'
25
+
'Hello, World!'
26
+
27
+
> length(['a', 'b', 'c'])
28
+
3
29
+
```
30
+
31
+
### Variable Declarations
32
+
```bicep
33
+
> var myName = 'John'
34
+
> var greeting = 'Hello, ${myName}!'
35
+
> greeting
36
+
'Hello, John!'
37
+
```
38
+
39
+
### Multi-line Expressions
40
+
The console automatically detects when expressions are structurally complete:
41
+
42
+
```bicep
43
+
> var config = {
44
+
name: 'myApp'
45
+
version: '1.0.0'
46
+
settings: {
47
+
debug: true
48
+
timeout: 30
49
+
}
50
+
}
51
+
> config.settings.debug
52
+
true
53
+
```
54
+
55
+
### Complex Expressions
56
+
```bicep
57
+
> var users = [
58
+
{ name: 'Alice', age: 30 }
59
+
{ name: 'Bob', age: 25 }
60
+
]
61
+
> map(users, user => user.name)
62
+
['Alice', 'Bob']
63
+
64
+
> filter(users, user => user.age > 26)
65
+
[
66
+
{
67
+
age: 30
68
+
name: 'Alice'
69
+
}
70
+
]
71
+
```
72
+
73
+
## Limitations
74
+
- No support for expressions requiring Azure context, e.g. `resourceGroup()`
75
+
- No file system access or external dependencies
76
+
- Limited to expression evaluation and variable declarations
77
+
- No persistent state between console sessions
78
+
- No completions support
79
+
80
+
## Raising bugs or feature requests
81
+
Please raise bug reports or feature requests under [Bicep REPL issue](https://github.com/Azure/bicep/issues/11963).
0 commit comments