Skip to content

Reusing deleted slot name in function app deployment overwrites production slot as it remembers the previously deleted slot's WEBSITE_CONTENTSHARE #2664

Description

I have two quite old function app deployments, perhaps 5+ years old. When I create a staging slot called "staging" the WEBSITE_CONTENTSHARE value from the production slot is copied to the staging slot and the production slot stops working:

  • Create staging slot called "staging" using Azure CLI
  • Staging slot is created with same WEBSITE_CONTENTSHARE as production slot
  • Staging slot is empty, no app published but shows the same functions as the production slot
  • Production slot stops working as the staging slot competes for resources such as using the same production slot ASB connection

The production slot is:

WEBSITE_CONTENTSHARE = test-3bd8d91e

then create the staging slot:

az functionapp deployment slot create \
--slot staging \
--resource-group therg \
--name Test

and the staging slot is the same as the production slot

WEBSITE_CONTENTSHARE = test-3bd8d91e

The issue occurs when creating the slot using the portal too.

If I don't call the slot "staging" the process works and the new slot gets a new WEBSITE_CONTENTSHARE and does not have "ghost" functions from the production slot. If I delete the working slot and create a slot called "staging" again the problem appears again.

WEBSITE_CONTENTSHARE is remembered for slot names:

  • create slot "preproduction"
  • slot gets unique WEBSITE_CONTENTSHARE
  • delete slot "preproduction"
  • create slot "preproduction"
  • slot gets same WEBSITE_CONTENTSHARE it had when it was first created

If the "preproduction" slot is swapped into production, then production will have the WEBSITE_CONTENTSHARE of "preproduction"? If "preproduction" is then deleted and recreated at some point in the future it will have the same WEBSITE_CONTENTSHARE it was assigned the first time it was created. This is the same value as production and explains the "ghost" functions and competition for resources with production.

The behaviour doesn't occur on newer function app deployments, where the slot gets a new WEBSITE_CONTENTSHARE, even if it's called "staging" which suggests this is their first "staging" slot.

I noticed that the production WEBSITE_CONTENTSHARE doesn't have a "-" in a working app and its staging slot does have a "-". In the bad function apps, both production and staging have a "-" in WEBSITE_CONTENTSHARE which suggests they came from a slot swap.

It would appear the only "safe" way to approach a deployment using a slot is to use the date in the slot name, in case that name has been used in the past and swapped into production and then deleted, in which case, reusing that name effectively "tunnels into" the production slot and destroys it until the "ghost" slot is deleted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions