Skip to content

Commit 72860f6

Browse files
committed
Add an example for idempotent
1 parent b25e903 commit 72860f6

File tree

2 files changed

+74
-4
lines changed

2 files changed

+74
-4
lines changed

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

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ 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
55
ms.custom: devx-track-bicep
6-
ms.date: 03/20/2024
6+
ms.date: 07/05/2024
77
---
88

99
# What is Bicep?
@@ -82,7 +82,52 @@ Bicep provides the following advantages:
8282

8383
You can also create Bicep files in Visual Studio with the [Bicep extension for Visual Studio](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.visualstudiobicep).
8484

85-
- **Repeatable results**: Repeatedly deploy your infrastructure throughout the development lifecycle and have confidence your resources are deployed in a consistent manner. Bicep files are idempotent, which means you can deploy the same file many times and get the same resource types in the same state. You can develop one file that represents the desired state, rather than developing lots of separate files to represent updates.
85+
- **Repeatable results**: Repeatedly deploy your infrastructure throughout the development lifecycle and have confidence your resources are deployed in a consistent manner. Bicep files are idempotent, which means you can deploy the same file many times and get the same resource types in the same state. You can develop one file that represents the desired state, rather than developing lots of separate files to represent updates. For example, the following file creates a storage account. If you deploy this template and the storage account with the specified properties already exists , no changes is made.
86+
87+
# [Bicep](#tab/bicep)
88+
89+
```bicep
90+
param location string = resourceGroup().location
91+
92+
resource mystore 'Microsoft.Storage/storageAccounts@2023-04-01' = {
93+
name: 'mystorageaccount'
94+
location: location
95+
sku: {
96+
name: 'Standard_LRS'
97+
}
98+
kind: 'StorageV2'
99+
}
100+
```
101+
102+
# [JSON](#tab/json)
103+
104+
```json
105+
{
106+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
107+
"contentVersion": "1.0.0.0",
108+
"parameters": {
109+
"location": {
110+
"type": "string",
111+
"defaultValue": "[resourceGroup().location]"
112+
}
113+
},
114+
"resources": {
115+
"mystore": {
116+
"type": "Microsoft.Storage/storageAccounts",
117+
"apiVersion": "2023-04-01",
118+
"name": "mystorageaccount",
119+
"location": "[parameters('location')]",
120+
"sku": {
121+
"name": "Standard_LRS"
122+
},
123+
"kind": "StorageV2"
124+
}
125+
}
126+
}
127+
```
128+
129+
---
130+
86131
- **Orchestration**: You don't have to worry about the complexities of ordering operations. Resource Manager orchestrates the deployment of interdependent resources so they're created in the correct order. When possible, Resource Manager deploys resources in parallel so your deployments finish faster than serial deployments. You deploy the file through one command, rather than through multiple imperative commands.
87132

88133
:::image type="content" source="./media/overview/bicep-processing.png" alt-text="Bicep deployment comparison" border="false":::

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Templates overview
33
description: Describes the benefits using Azure Resource Manager templates (ARM templates) for deployment of resources.
44
ms.topic: overview
55
ms.custom: devx-track-arm-template
6-
ms.date: 06/23/2023
6+
ms.date: 07/05/2024
77
---
88

99
# What are ARM templates?
@@ -27,7 +27,32 @@ If you're trying to decide between using ARM templates and one of the other infr
2727

2828
* **Declarative syntax**: ARM templates allow you to create and deploy an entire Azure infrastructure declaratively. For example, you can deploy not only virtual machines, but also the network infrastructure, storage systems, and any other resources you may need.
2929

30-
* **Repeatable results**: Repeatedly deploy your infrastructure throughout the development lifecycle and have confidence your resources are deployed in a consistent manner. Templates are idempotent, which means you can deploy the same template many times and get the same resource types in the same state. You can develop one template that represents the desired state, rather than developing lots of separate templates to represent updates.
30+
* **Repeatable results**: Repeatedly deploy your infrastructure throughout the development lifecycle and have confidence your resources are deployed in a consistent manner. Templates are idempotent, which means you can deploy the same template many times and get the same resource types in the same state. You can develop one template that represents the desired state, rather than developing lots of separate templates to represent updates. For example, the following file creates a storage account. If you deploy this template and the storage account with the specified properties already exists , no changes is made.
31+
32+
```json
33+
{
34+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
35+
"contentVersion": "1.0.0.0",
36+
"parameters": {
37+
"location": {
38+
"type": "string",
39+
"defaultValue": "[resourceGroup().location]"
40+
}
41+
},
42+
"resources": {
43+
"mystore": {
44+
"type": "Microsoft.Storage/storageAccounts",
45+
"apiVersion": "2023-04-01",
46+
"name": "mystorageaccount",
47+
"location": "[parameters('location')]",
48+
"sku": {
49+
"name": "Standard_LRS"
50+
},
51+
"kind": "StorageV2"
52+
}
53+
}
54+
}
55+
```
3156

3257
* **Orchestration**: You don't have to worry about the complexities of ordering operations. Resource Manager orchestrates the deployment of interdependent resources so they're created in the correct order. When possible, Resource Manager deploys resources in parallel so your deployments finish faster than serial deployments. You deploy the template through one command, rather than through multiple imperative commands.
3358

0 commit comments

Comments
 (0)