Hi Andrii K,
This issue typically occurs when:
- A deployment stack or scale set operation fails mid-way.
- The Azure control plane is left in an inconsistent state.
- The deployment metadata is locked, preventing deletion or rollback.
1.Use Azure CLI to Force Delete the Deployment StackIf the deployment is stuck and cannot be deleted via the portal, try using the CLI:
az deployment sub delete --name <deployment-name>
Or for resource group deployments:
az deployment group delete --resource-group <rg-name> --name <deployment-name>
If the deployment is part of a deployment stack, try:
az stack sub delete --name <stack-name>
Note: If the stack is locked, this may still fail. In that case, proceed to the next step.
2.Detach Resources from the Stack
If the stack is blocking deletion due to attached resources:
- Go to the Deployment Stack in the portal.
- Choose Update behavior → Detach resources.
- Then try deleting the stack again.
3.Then try deleting the stack again.
Sometimes re-deploying the same stack with a minimal or empty template can reset the state:
- Use a Bicep or ARM template with no resources.
- Deploy it to the same stack name.
- This may allow the system to overwrite the stuck state and clean up.
4.Retry the Deployment via GitHub Action or DevOps Pipeline
- In some cases, simply re-running the deployment pipeline (e.g., GitHub Actions or Azure DevOps) has resolved the issue by forcing the control plane to re-evaluate the deployment state.
I hope this information helps. Please do let us know if you have any further queries.
If the comment is helpful, please click "Upvote it".