# Error: Deployment slot 'staging' is locked and cannot be swapped due to 'sticky' configuration settings

- **ID:** `cloud/azure-app-service-deployment-slot-sticky`
- **Domain:** cloud
- **Category:** config_error
- **Error Code:** `SlotSwapLocked`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

The deployment slot has slot-specific (sticky) app settings or connection strings that are not marked as slot-specific, causing the swap to fail because the settings would move with the slot.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Azure App Service: Linux | active | — | — |
| Runtime: .NET 8 | active | — | — |
| Azure CLI: 2.60.0 | active | — | — |

## Workarounds

1. **Mark all slot-specific settings as 'deployment slot settings' using Azure CLI: az webapp config appsettings set --resource-group myRG --name myApp --slot-settings KEY=VALUE** (95% success)
   ```
   Mark all slot-specific settings as 'deployment slot settings' using Azure CLI: az webapp config appsettings set --resource-group myRG --name myApp --slot-settings KEY=VALUE
   ```
2. **Temporarily remove all slot-specific settings from the source slot before swapping, then reapply them after swap.** (85% success)
   ```
   Temporarily remove all slot-specific settings from the source slot before swapping, then reapply them after swap.
   ```
3. **Use Azure DevOps 'Azure App Service Manage' task with 'Swap with preview' option to validate settings before full swap.** (90% success)
   ```
   Use Azure DevOps 'Azure App Service Manage' task with 'Swap with preview' option to validate settings before full swap.
   ```

## Dead Ends

- **** — Recreating the slot does not resolve the underlying sticky settings conflict; the new slot inherits the same configuration unless manually changed. (70% fail)
- **** — The portal enforces the same sticky setting rules; manual swap will fail with the same error if sticky settings are misconfigured. (90% fail)
- **** — Restarting does not affect slot swap logic or configuration settings. (95% fail)
