Azure / Azure/azure-functions-host
Identity got switched off after slot swap failed
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
By "Idendity" I mean this feature:

My app got run through our release pipeline, including a slot swap. The slot swap was not successful and eventually timed out after about 10 minutes. This problem is that the Identity of the production slot got switched off. This means, the app could not connect to Key Vault anymore, so no secrets could be retrieved and the app was therefore essentially unusable. What I would expect is that the Identity is unchanged after a failed slot swap and stays on so that the production slot keeps running.
#### Investigative information
- Timestamp: 2019-02-15T17:03:08.0394379Z from build log: _[POST]https://management.azure.com/subscriptions/5ee94e32-e95c-4110-b707-c95a5f78737d/resourceGroups/myresourcegroup/providers/Microsoft.Web/sites/myfunctionapp/slots/staging/slotsswap?api-version=2016-08-01_
- Function App version (1.0 or 2.0): v2
- Function App name: Identity Id = afac1f55-e5bd-4ef0-a324-05c66e6fb973, Subscription Id = 5ee94e32-e95c-4110-b707-c95a5f78737d
- Function name(s) (as appropriate): N/A
- Invocation ID: N/A
- Region: West US 2
#### Repro steps
Provide the steps required to reproduce the problem:
I could repro the problem with my specific app:
1. Verify that Identity is switched on.
2. Start swapping staging with production slot
3. This swap did not succeed and timed out in my case. *
4. Check Identity.
*The reason of the swap timeout is unknown to me. I could repro it when running my CI/CD pipeline, as well as doing the swap manually via the portal. Usually a slot swap takes less than 2 minutes. I have swapped the slots of this app and similar apps many times before without any problems.
#### Expected behavior
Identity is still on after a failed slot swap.
#### Actual behavior
Identity got switched off after the failed slot swap
#### Known workarounds
Switch on Identity manually after the failed swap attempt. The id is the same as before.
#### Related information
Excerpt from the build log
> 2019-02-15T17:03:08.0392309Z Swapping App Service 'myfunctionapp' slots - 'staging' and 'production'
> 2019-02-15T17:03:08.0394379Z ##[debug][POST]https://management.azure.com/subscriptions/5ee94e32-e95c-4110-b707-c95a5f78737d/resourceGroups/myresourcegroup/providers/Microsoft.Web/sites/myfunctionapp/slots/staging/slotsswap?api-version=2016-08-01
> 2019-02-15T17:03:10.7233301Z ##[debug][GET]https://management.azure.com/subscriptions/5ee94e32-e95c-4110-b707-c95a5f78737d/resourceGroups/myresourcegroup/providers/Microsoft.Web/sites/myfunctionapp/slots/staging/operationresults/5c6ffe3c-b071-422e-bd08-7b458abf1be9?api-version=2016-08-01
> 2019-02-15T17:03:10.8724639Z ##[debug]Response status code : 202
> 2019-02-15T17:03:25.8892024Z ##[debug][GET]https://management.azure.com/subscriptions/5ee94e32-e95c-4110-b707-c95a5f78737d/resourceGroups/myresourcegroup/providers/Microsoft.Web/sites/myfunctionapp/slots/staging/operationresults/5c6ffe3c-b071-422e-bd08-7b458abf1be9?api-version=2016-08-01
> 2019-02-15T17:03:26.0408675Z ##[debug]Response status code : 202
> ...
> ... (a lot more of these)
> ...
> 2019-02-15T17:11:34.6328307Z ##[debug][GET]https://management.azure.com/subscriptions/5ee94e32-e95c-4110-b707-c95a5f78737d/resourceGroups/myresourcegroup/providers/Microsoft.Web/sites/myfunctionapp/slots/staging/operationresults/5c6ffe3c-b071-422e-bd08-7b458abf1be9?api-version=2016-08-01
> 2019-02-15T17:11:34.7766126Z ##[debug]Response status code : 202
> 2019-02-15T17:11:49.7840090Z ##[debug][GET]https://management.azure.com/subscriptions/5ee94e32-e95c-4110-b707-c95a5f78737d/resourceGroups/myresourcegroup/providers/Microsoft.Web/sites/myfunctionapp/slots/staging/operationresults/5c6ffe3c-b071-422e-bd08-7b458abf1be9?api-version=2016-08-01
> 2019-02-15T17:11:50.0057658Z ##[debug]Response status code : 400
> 2019-02-15T17:11:50.0064437Z ##[debug]Completed action
Contributor guide
Research direction
Begin with the App Service slot-swap request and operation-result entries in the provided build log; no repository file or test is identified. Done means a failed or timed-out swap leaves the production Identity enabled and preserves Key Vault access, with regression coverage for that outcome.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100