Azure / Azure/static-web-apps

Static Web App cannot be deleted — orphaned linkedBackend is readable but returns 404 on DELETE/unlink

Open
#1,744 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I have a Standard-tier Static Web App that cannot be deleted because of an orphaned `linkedBackend` record. The link points to a Web App that no longer exists, and the record is readable but unaddressable by the write/delete path. This has been blocking subscription cancellation for months.

**Resource**

- Subscription: ``
- Resource: `/subscriptions//resourceGroups/formflow-rg/providers/Microsoft.Web/staticSites/formflow-app-prod`
- SKU: Standard, Region: eastus2
- Only resource in the subscription

**Symptom**

Both direct DELETE on the SWA and resource-group cascade DELETE fail with the opaque error:

```json
{"code":"ResourceOperationFailure",
"message":"The resource operation completed with terminal provisioning state 'Failed'.",
"details":[{"code":"Unspecified","message":""}]}
```

**Root cause visible from ARM**

The site has a build named `preview` holding a `linkedBackends` record `backend1` pointing at:

```
/subscriptions//resourceGroups/formflow-rg/providers/Microsoft.Web/sites/formflow-backend-104793
```

That target Web App no longer exists (confirmed via `az resource list` across all my subscriptions). The link is dangling.

The metadata is in an inconsistent state:

- `GET .../builds/preview/linkedBackends` returns `backend1` with `provisioningState: Succeeded`
- `DELETE .../builds/preview/linkedBackends/backend1` → **404 NotFound** on api-versions `2024-04-01`, `2023-12-01`, `2023-01-01`, `2022-09-01`, `2022-03-01`, `2021-03-01`
- `POST .../linkedBackends/backend1/unlink` and `.../builds/preview/linkedBackends/backend1/unlink` → **404 NotFound / BadRequest**

So the record exists from the read path but is unaddressable from the write path. Only the platform can clear it.

**Confirmation the linked backend is what's blocking everything**

Attempting to downgrade the SKU to Free returns a clear error pointing at the same record:

```
Sku is invalid. Free SKU is invalid. Linked Backends are not allowed in this SKU.
The following builds have linked backends configured: preview
```

The downgrade path enumerates `backend1` correctly; only the unlink/delete path cannot remove it. This is consistent with corruption in the `linkedBackends` storage on the RP side.

**Activity-log entries**

```
2026-04-28T13:56:11Z Microsoft.Web/staticSites/linkedBackends/unlink/action Failed/NotFound → {"error":{"code":"BadRequest","message":""}}
2026-04-28T13:56:11Z Microsoft.Web/staticSites/builds/linkedBackends/unlink/action Failed/NotFound → {"error":{"code":"BadRequest","message":""}}
2026-04-28T13:56:10Z Microsoft.Web/staticSites/builds/linkedBackends/delete Failed/NotFound → "Resource Not Found"
2026-04-28T14:01:24Z Microsoft.Web/staticSites/builds/delete Failed → Unspecified
```

**What I have tried**

- DELETE on the Static Web App directly — `Unspecified`
- DELETE on resource group `formflow-rg` — `Unspecified` on `staticSites/builds/delete`
- DELETE on `linkedBackends/backend1` across 6 API versions — all 404
- POST `unlink` action, both site- and build-scoped — 404 / BadRequest
- PATCH SKU `Standard` → `Free` — blocked by the dangling backend
- Subscription cancel via `Microsoft.Subscription/cancel` — blocked: `ResourcesExistingOnSubscription`
- Billing-API cancel via `Microsoft.Billing/.../billingSubscriptions/.../cancel` — not supported for Individual MCA
- DELETE `builds/preview` directly — accepted, but the cascading flow fails on the same record

**Questions**

1. Is there a supported way to force-remove a dangling `linkedBackend` whose target resource no longer exists, when both `DELETE` and the `unlink` action return 404 on the record itself?
2. If not, can someone from the Static Web Apps RP / Engineering team clear the `backend1` record on build `preview` of `formflow-app-prod` server-side so the SWA can be deleted and the subscription closed?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.