Reputation: 97
There is a Function App that runs on Consumption plan There are two slots (prod + uat) created for the app Function App and deployment slots have been created using Azure Portal, so all settings were set to default - most important one: same Storage Account for both slots App from both slots write logs to Azure AppInsights
I deploy the app using VS to uat slot - App restarts and works normally Then swap is done between these two slots App on prod slot starts to write warnings to the log - Another app likely has the lease on this container
Is this behavior/warning - "Another app likely has the lease on this container" is expected? It makes sense since apps on both slots use same Storage account and blob container to write their "leases" and since app from uat slot started first it kinda "booked" a blob container...
What is a best practice here? I also tried to use separate Storage accounts - also had to manually create file share inside Storage account + change CONTENTSHARE variable inside Configuration area for every function app (in each slot). It works, but not sure it is the right way to configure it either since on every swap the Storage accounts are changed and at least I need to manually reconnect to Azure Function instance (on uat slot) each time because of this Storage account change
Really appreciate your advices Thank you!
Upvotes: 0
Views: 1183
Reputation: 8187
The warning
"Another app likely has the lease on this container"
is anticipated behaviour when two Azure Function Apps use the same storage account and blob container to write their "leases".
In order to avoid this collision you can refer these points here:-
For each function app or slot implicated in the collision, use a different storage account.
Change the computed host ID for one of your function apps to a name that is no longer than 32 characters to eliminate the collision.
Set a clear host ID for at least one of the interacting apps. See Host ID override for further information.
Additionally, one or more of the overlapping apps can have an explicit host ID set.
You can set the host ID in your Function app settings like below:-
Make sure the host Id is less than 32 characters to avoid collision:-
AzureFunctionsWebHost__hostid : siliconfunctionappname098756789
You are right, The best method for preventing this problem is to use different storage accounts the CONTENTSHARE
variable must be manually changed in the Configuration area of each function app (in each slot) and a file share must be manually created inside the storage account.
WEBSITE_CONTENTSHARE
Upvotes: 0