I have a function app (durable function) and a staging slot:
staging slot contains these 2 functions:
production slot contains this one function:
After swapping, I see 2 functions in both staging slot and production slot:
My understabding is that after swapping, production slot will have the above 2 functions and staging slot will have what was in production slot earlier which is one function:
Here is my code:
// BICEP
var stagingSettings = [
{
name: 'AzureFunctionsJobHost__extensions__durableTask__hubName'
value: 'staging'
slotSetting: true
}
{
name: 'WEBSITE_CONTENTSHARE'
value: toLower('staging')
}
]
resource functionApp 'Microsoft.Web/sites/slots@2018-11-01' = {
name: name
kind: kind
location: location
properties: {
clientAffinityEnabled: true
enabled: true
httpsOnly: true
serverFarmId: resourceId('Microsoft.Web/serverfarms', servicePlanName)
siteConfig: {
use32BitWorkerProcess : false
appSettings: stagingSettings
}
}
identity: {
type: 'SystemAssigned'
}
}
// YML
- task: AzureFunctionApp@1
displayName: 'deploy ${{ parameters.name }} function app (staging)'
inputs:
appType: 'functionapp'
azureSubscription: ${{parameters.serviceConnection}}
appName: '${{ parameters.name }}'
Package: '${{ parameters.root }}/${{ parameters.name }}.zip'
deploymentMethod: 'runFromPackage'
deployToSlotOrASE: true
SlotName: "staging"
resourceGroupName: 'rg'
What am I missing?
We tried to reproduce your issue from our end:
Created 2 Functions (Orchestrator and Starter) of .NET 6 Stack in Production Slot:
Published 1 Function (Timer Trigger) to the Staging Slot of the same Azure Function App:
Operation 1: Doing the Swap from staging slot to production slot:
Result: After Swapping from staging slot to production slot:
After 2nd Swap, the result will be like the Original:
In your case,
The staging Slot contains 2 functions:
OrchestratorFunction
StarterFunction
Production Slot contains 1 Function: Assume it as
TimerTrigger
.Your understanding is correct, After Swapping, 2 Functions will be in the Production Slot and 1 function will be in the Staging Slot.
AFAIK,
Application in deployment slots has its own hostnames.
Deployment slots are useful when you want to test the different versions of the applications.
Instead of creating one more web app/app service/function app and deploying it to the production slot for testing, with this deployment slots feature – each slot gets its own DNS Name.
After testing, you can perform a swap operation on the working version to the production slot from the testing slot and you can reverse swap if version 1 has to be deployed to the production slot.
Note: To reflect the changes, it takes a minute or two sometimes due to latency of regions or some backend processing.