Azure / Azure/bicep

@onlyIfNotExists() does not work on Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots

Open
#20,132 3 comments 0 reactions 1 assignee Claimed by @tsmallig33 View on GitHub
OnlyifNotExists
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 4h
Merged PRs (30d)
81

Description

**Bicep version**
Bicep CLI version 0.46.1 (545b338e2c)

**Describe the bug**
Snapshots are one time deployment resources. If re-deployed they give you: There already exists a snapshot with name . Event when @onlyIfNotExists() decorator is applied the error is still given so for some reason the decorator does not work for those type of resources.

**To Reproduce**
Steps to reproduce the behavior:

```bicep
param snapshot object
param netAppAccountName string
param netAppPoolName string
param netAppVolumeName string

resource netAppVolumeRes 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes@2026-05-15-preview' existing = {
name: '${netAppAccountName}/${netAppPoolName}/${netAppVolumeName}'
}

@onlyIfNotExists()
resource snapshots 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots@2026-05-15-preview' = {
name: snapshot.name
parent: netAppVolumeRes
location: resourceGroup().location
properties: {}
}

```

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.