Skip to content

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

Description

Bicep version
Bicep CLI version 0.46.1 (545b338)

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:

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.

Metadata

Metadata

Type

No type

Projects

Status
In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions