onlyIfNotExists() fails on first creation of a Blob private endpoint with PreconditionFailedResourceAlreadyExists
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- azure
- Domain
- cloud, infrastructure
Research direction
Start by tracing how Bicep compiles @onlyIfNotExists() to ARM JSON and how deployments handle the generated NIC for Microsoft.Network/privateEndpoints@2023-11-01. Compare the failing and successful templates described in the report, then investigate the endpoint and NIC requests with the ARM Deployments and Microsoft.Network Private Link teams. Done means establishing whether create-only is supported for this API version and identifying which request triggers the precondition failure.
Written by the indexing model from the issue text.
Description
Bicep version
Bicep CLI 0.48.1 (cec7951cf6).
Describe the bug
Applying @onlyIfNotExists() to a new Microsoft.Network/privateEndpoints@2023-11-01 resource causes the deployment to fail on its Azure-generated network interface (NIC). An ordinary first create succeeds under the same conditions.
Expected: Since the endpoint name is unused, Azure creates the endpoint and its NIC.
Actual: The endpoint reports Failed. Its NIC reports Succeeded, and the Blob connection reports Approved. The endpoint operation returns PreconditionFailedResourceAlreadyExists:
If-none-match header (*) was specified in the request but resource
<generated NIC resource ID>already exists.
To Reproduce
- In a disposable resource group, create a
StorageV2account (Standard_LRS) and a VNet with a subnet for private endpoints. We tested inwestus2. - Deploy a
Microsoft.Network/privateEndpoints@2023-11-01resource targeting the account'sblobsubresource. Use an unused endpoint name and let Azure allocate the NIC. This succeeds. - Deploy the same template to the same account and subnet, using another unused endpoint name, with
@onlyIfNotExists()immediately above the private endpoint declaration. This fails with the error above.
Additional context
Both cases were deployed from compiled ARM JSON with languageVersion: 2.0. Apart from the generated template hash, the only template difference was the endpoint's @options.onlyIfNotExists setting. Neither template declares a NIC.
Follow-up to Bicep discussion #20633. Could ARM Deployments and the Microsoft.Network Private Link team trace the endpoint and NIC requests and confirm whether create-only is supported for this API version? The deployment history identifies the NIC in the failed precondition but does not show which internal request supplied the header or whether a retry occurred. I can provide the failed lab deployment's ARM correlation ID privately.
- Dominant language
- Bicep
- Stars
- 3.7k
- Forks
- 833
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 81
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/bicep
-
AI Triaged bug Needs: Triage :mag: story: bicep parameters
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Azure/bicep#20654 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement Needs: Upvote VisualStudio
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Azure/bicep#17997 · 1 reaction ·
Maintainers usually reply within 1 day
-
AI Triaged bug Needs: Triage :mag:
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Azure/bicep#20584 · 2 comments ·
Maintainers usually reply within 1 day
-
Preserve member types through open-object union() and spreads instead of rebuilding them in secret analysisPossibly taken @andyleejordan claimed this 21 days ago. OpenAI Triaged enhancement linter-false-positive Needs: Triage :mag: story: linter type system
Azure/bicep#20558 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
AI Triaged investigate Needs: Triage :mag: revisit
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Azure/bicep#20556 · 2 comments ·
Maintainers usually reply within 1 day
Similar issues
-
area: budget priority: low type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
scttfrdmn/cargoship#1535 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Chocobozzz/PeerTube#7901 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Azure/sap-automation#1417 ·
Maintainers usually reply within 2 days
-
area-integrations
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day