Skip to content

Commit cf225f2

Browse files
committed
add jsonrpc format
1 parent 2b7edda commit cf225f2

2 files changed

Lines changed: 57 additions & 22 deletions

File tree

articles/azure-resource-manager/bicep/bicep-cli.md

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Bicep CLI commands
33
description: Learn about the commands that you can use in the Bicep CLI. These commands include building JSON Azure Resource Manager templates from Bicep.
44
ms.topic: reference
5-
ms.date: 09/09/2025
5+
ms.date: 10/22/2025
66
ms.custom: devx-track-azurecli, devx-track-bicep, devx-track-arm-template
77
---
88

@@ -285,30 +285,65 @@ For example:
285285
Content-Length: 72\r\n\r\n{"jsonrpc": "2.0", "id": 0, "method": "bicep/version", "params": {}}\r\n\r\n
286286
```
287287

288-
The following message shows an example for Bicep version.
288+
The following methods are available through the JSON-RPC interface:
289289

290-
* The input:
290+
- **bicep/version**
291291

292-
```json
293-
{
294-
"jsonrpc": "2.0",
295-
"id": 0,
296-
"method": "bicep/version",
297-
"params": {}
298-
}
299-
```
292+
Returns the version of the Bicep CLI.
293+
294+
* The request:
300295

301-
* The output:
302-
303-
```json
304-
{
305-
"jsonrpc": "2.0",
306-
"id": 0,
307-
"result": {
308-
"version": "0.24.211"
296+
```json
297+
{
298+
"jsonrpc": "2.0",
299+
"id": 0,
300+
"method": "bicep/version",
301+
"params": {}
309302
}
310-
}
311-
```
303+
```
304+
305+
* The response:
306+
307+
```json
308+
{
309+
"jsonrpc": "2.0",
310+
"id": 0,
311+
"result": {
312+
"version": "0.24.211"
313+
}
314+
}
315+
```
316+
317+
- **bicep/format**
318+
319+
Formats a Bicep file.
320+
321+
* The request:
322+
323+
```json
324+
{
325+
"jsonrpc": "2.0",
326+
"id": 1,
327+
"method": "bicep/format",
328+
"params": {
329+
"path": "/path/to/file.bicep"
330+
}
331+
}
332+
```
333+
334+
* The response:
335+
336+
```json
337+
{
338+
"jsonrpc": "2.0",
339+
"id": 1,
340+
"result": {
341+
"success": true,
342+
"diagnostics": [],
343+
"contents": "param foo string\n\nresource storage 'Microsoft.Storage/storageAccounts@2025-01-01' = {\n name: 'mystorageaccount'\n location: 'East US'\n}\n"
344+
}
345+
}
346+
```
312347

313348
For the available methods & request/response bodies, see [`ICliJsonRpcProtocol.cs`](https://github.com/Azure/bicep/blob/main/src/Bicep.Cli/Rpc/ICliJsonRpcProtocol.cs).
314349
For an example establishing a JSONRPC connection and interacting with Bicep files programmatically using Node, see [`jsonrpc.test.ts`](https://github.com/Azure/bicep/blob/main/src/Bicep.Cli.E2eTests/src/local/jsonrpc.test.ts).

articles/azure-resource-manager/bicep/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ items:
621621
href: /azure/templates/
622622
- name: Bicep CLI
623623
href: bicep-cli.md
624-
displayName: build,decompile,install,list-versions,list versions,upgrade,version,module,registry
624+
displayName: build,decompile,decompile-params, format,generate-params,install,jsonrpc,lint,list-versions,list versions,publish,restore,upgrade,version,module,registry
625625
- name: Azure CLI
626626
href: /cli/azure/resource
627627
- name: Azure PowerShell

0 commit comments

Comments
 (0)