Skip to content

Commit 5a723a4

Browse files
committed
add an example
1 parent 7c3c676 commit 5a723a4

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ By default, when a Bicep deployment runs, Azure Resource Manager (ARM) creates t
106106

107107
With Bicep version v0.38.3 or later, the `@onlyIfNotExists()` decorator instructs ARM to create the resource only if it doesn’t already exist. If the resource is found, ARM skips creation and leaves it unchanged.
108108

109+
```bicep
110+
@onlyIfNotExists()
111+
resource example 'Microsoft.Storage/storageAccounts@2025-01-01' = {
112+
name: 'mystorageacct'
113+
location: resourceGroup().location
114+
kind: 'StorageV2'
115+
sku: {
116+
name: 'Standard_LRS'
117+
}
118+
}
119+
```
120+
109121
## Resource name
110122

111123
Each resource has a name. When setting the resource name, pay attention to the [rules and restrictions for resource names](../management/resource-name-rules.md).

0 commit comments

Comments
 (0)