Skip to content

Commit 11bfd08

Browse files
committed
add comparison example to overview
1 parent dabec29 commit 11bfd08

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

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

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Bicep language for deploying Azure resources
33
description: Describes the Bicep language for deploying infrastructure to Azure. It provides an improved authoring experience over using JSON to develop templates.
44
ms.topic: conceptual
5-
ms.date: 01/03/2022
5+
ms.date: 01/19/2022
66
---
77

88
# What is Bicep?
@@ -17,6 +17,64 @@ Bicep provides the following advantages over other infrastructure-as-code option
1717

1818
- **Support for all resource types and API versions**: Bicep immediately supports all preview and GA versions for Azure services. As soon as a resource provider introduces new resources types and API versions, you can use them in your Bicep file. You don't have to wait for tools to be updated before using the new services.
1919
- **Simple syntax**: When compared to the equivalent JSON template, Bicep files are more concise and easier to read. Bicep requires no previous knowledge of programming languages. Bicep syntax is declarative and specifies which resources and resource properties you want to deploy.
20+
21+
The following examples show the difference between a Bicep file and the equivalent JSON template. Both examples deploy a storage account.
22+
23+
# [Bicep](#tab/bicep)
24+
25+
```bicep
26+
param location string = resourceGroup().location
27+
param storageAccountName string = 'toylaunch${uniqueString(resourceGroup().id)}'
28+
29+
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' = {
30+
name: storageAccountName
31+
location: location
32+
sku: {
33+
name: 'Standard_LRS'
34+
}
35+
kind: 'StorageV2'
36+
properties: {
37+
accessTier: 'Hot'
38+
}
39+
}
40+
```
41+
42+
# [JSON](#tab/json)
43+
44+
```json
45+
{
46+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
47+
"contentVersion": "1.0.0.0",
48+
"parameters": {
49+
"location": {
50+
"type": "string",
51+
"defaultValue": "[resourceGroup().location]"
52+
},
53+
"storageAccountName": {
54+
"type": "string",
55+
"defaultValue": "[format('toylaunch{0}', uniqueString(resourceGroup().id))]"
56+
}
57+
},
58+
"resources": [
59+
{
60+
"type": "Microsoft.Storage/storageAccounts",
61+
"apiVersion": "2021-06-01",
62+
"name": "[parameters('storageAccountName')]",
63+
"location": "[parameters('location')]",
64+
"sku": {
65+
"name": "Standard_LRS"
66+
},
67+
"kind": "StorageV2",
68+
"properties": {
69+
"accessTier": "Hot"
70+
}
71+
}
72+
]
73+
}
74+
```
75+
76+
---
77+
2078
- **Authoring experience**: When you use VS Code to create your Bicep files, you get a first-class authoring experience. The editor provides rich type-safety, intellisense, and syntax validation.
2179
- **Modularity**: You can break your Bicep code into manageable parts by using [modules](./modules.md). The module deploys a set of related resources. Modules enable you to reuse code and simplify development. Add the module to a Bicep file anytime you need to deploy those resources.
2280
- **Integration with Azure services**: Bicep is integrated with Azure services such as Azure Policy, template specs, and Blueprints.

0 commit comments

Comments
 (0)