[SVLS-9100] fix(install): Function App slot workaround + install templates (#455)#457
Conversation
…cenarios (#455) Addresses intermittent MoveDirectory failures when installing the Datadog extension on Azure Function App deployment slots. The Functions runtime holds file locks on C:\home\SiteExtensions\ after code deployment; setting WEBSITE_PRIVATE_EXTENSIONS=0 as a sticky slot setting prevents this. Changes: - Rename ARM/ → install-templates/ (docs link update coordinated in companion PR) - Add install-templates/install-web-app.{json,bicep} — Web App templates - Add install-templates/install-web-app-slot.{json,bicep} — Web App slot templates - Add install-templates/install-function-app-slot.{json,bicep} — Function App slot templates with WEBSITE_PRIVATE_EXTENSIONS=0 sticky setting workaround - All templates versioned (metadata.version / // Version comment) for doc comparison - management-scripts/extension/install-latest-extension.ps1 v2.0.0: - Add -SlotName parameter for slot targeting - Auto-detect Function Apps and apply sticky WEBSITE_PRIVATE_EXTENSIONS=0 setting before install when -SlotName is provided - management-scripts/extension/update-all-site-extensions.ps1 v2.0.0: - Add -IncludeSlots flag to enumerate and update deployment slots Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
9f33c3b to
e94e935
Compare
…cleanup - install-function-app-slot: add required existingStickyAppSettingNames param so slotConfigNames uses union() instead of a hard-coded single-entry list; deployment now fails fast rather than silently de-stickying existing settings - install-latest-extension.ps1: remove redundant --settings call before --slot-settings (latter is sufficient and already additive) - update-all-site-extensions.ps1: remove dead $slotExtensionManage in slot loop; add "not found" log for slots to match webapp loop behaviour - All templates: normalize ddService/ddVersion defaults to '' (was 'my-service' / '0.0.0' in web-app templates, '' in function-app template) - README: replace buried Note with fetch-before-deploy instructions and parameterised deploy examples Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
I am slightly wary of having another docs-like copy to maintain, are y'all expecting to maintain these or would that be something the onboarding team would need to do?
There was a problem hiding this comment.
My plan is to use this as the test case for an auto-docs-sync AI tool, where if you update this side, it also opens a PR to update the documentation and notifies you accordingly. The work should fall on us, and I want to automate it as much as possible. This is a good test case for the similarity, since we already had a template duplicate here.
There was a problem hiding this comment.
how much do we feel the need to have both bicep/ARM, or would it be okay to just use bicep and give people the command to compile it to ARM?
There was a problem hiding this comment.
So I was thinking of this page: https://docs.datadoghq.com/serverless/azure_app_service/windows_code?tab=armtemplate where we have both ARM and Bicep examples. I was trying to be consistent, but I would personally be fine with just bicep. Thoughts on the value of consistency?
There was a problem hiding this comment.
Either way we'll have consistency problems, just do we want to keep the same style as the docs, or have to maintain consistency between the bicep/arm forms. Given this isn't being treated as docs (its live code), i do think just having bicep is fine but i'm not fierce on it
Stop clears file locks directly; the sticky setting then persists to ARM and takes effect on the subsequent start — no redundant async recycle. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… duplication Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@Args splats the automatic variable (empty); @cmdArgs splats the constructed argument list. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Mirrors the non-slot branch: when -ExtensionVersion is requested and the slot is already at that version, log and break instead of proceeding through stop/install/start. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… $baseApiUrl -like on an array returns all matches; indexing to [0] ensures a scalar string is used in URL construction and -replace. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Summary
Addresses #455 — intermittent
MoveDirectoryfailures when installing the Datadog extension on Azure Function App deployment slots.Root cause: The Functions runtime holds file locks on
C:\home\SiteExtensions\after code deployment. If a site extension ARM deployment runs while those handles are open, Kudu'sMoveDirectorystep fails. This does not affect Web Apps.Fix: Set
WEBSITE_PRIVATE_EXTENSIONS=0as a sticky slot setting. This prevents the Functions runtime from loading private site extensions on that slot (releasing the file locks). Because the setting is sticky, it stays on the staging slot after swaps and never affects production.Changes
install-templates/(renamed fromARM/)install-web-app.{json,bicep}— Web App install templatesinstall-web-app-slot.{json,bicep}— Web App deployment slot templatesinstall-function-app-slot.{json,bicep}— New: Function App slot templates withWEBSITE_PRIVATE_EXTENSIONS=0sticky setting +slotConfigNamesresource,dependsOnordering to ensure setting is applied before extension installmetadata.versionin JSON,// Version:in Bicep) to allow comparison against docs inline snippetsPowerShell scripts
install-latest-extension.ps1v2.0.0: adds-SlotNameparameter; when provided against a Function App, automatically appliesWEBSITE_PRIVATE_EXTENSIONS=0as a sticky slot setting.update-all-site-extensions.ps1v2.0.0: adds-IncludeSlotsflag to enumerate and update deployment slots across a resource groupREADME.mdinstall-templates/andmanagement-scripts/extension/Companion PR
Must be merged alongside: DataDog/documentation#36956
The docs PR updates the
ARM/→install-templates/link and adds the newazure_functions/dotnet_extension.mdpage. The rename here will break the existing docs link until both land.Test plan
python3 -m json.tool)az bicep build)install-latest-extension.ps1with-SlotNameon a Web App (no Function App branch taken)install-latest-extension.ps1with-SlotNameon a Function App (sticky setting applied)install-latest-extension.ps1without-SlotName(behavior unchanged)update-all-site-extensions.ps1without-IncludeSlots(behavior unchanged)🤖 Generated with Claude Code