feat: support container deployment to App Service#8847
Conversation
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
Add container image deployment support to the appservice service target. When a service is configured with host: appservice and language: docker (or docker.path is set), azd now pushes the container image to ACR and updates the site's linuxFxVersion and acrUseManagedIdentityCreds, rather than failing with 'no package artifacts found'. The implementation reuses ContainerHelper (shared with the containerapp target) for image build/tag/push, and adds a new UpdateAppServiceContainerConfig method to AzureClient for the ARM update. The existing zip deploy path is unchanged for non-container services. Fixes #1608 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
26277e1 to
a2eb4bc
Compare
There was a problem hiding this comment.
Pull request overview
Adds first-class container image deployment support to the built-in App Service service target (host: appservice) by treating container artifacts as the deployable unit (instead of zip) and updating the site’s container runtime config via ARM.
Changes:
- Extend App Service service target to pass through container artifacts, publish images to ACR, and deploy by updating
linuxFxVersion/acrUseManagedIdentityCreds. - Add an
azapi.AzureClienthelper to PATCH App Service container configuration. - Expand unit tests for the new container path and regressions in the existing zip path.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/pkg/project/service_target_appservice.go | Adds container-aware Package/Publish/Deploy logic for App Service, including a container-config deploy path. |
| cli/azd/pkg/project/service_target_appservice_test.go | Adds/updates tests for container passthrough packaging and container deploy behavior, plus zip-path regression checks. |
| cli/azd/pkg/azapi/webapp.go | Introduces UpdateAppServiceContainerConfig to PATCH linuxFxVersion and enable ACR MSI creds. |
| cli/azd/pkg/azapi/webapp_test.go | Adds tests covering success/error cases for the new azapi update method. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 5
- Review effort level: Low
- Wire determineDeploymentTargets() into the container deploy path so
AZD_DEPLOY_{SERVICE}_SLOT_NAME and interactive slot selection work for
container deployments (not just zip deploy)
- Add UpdateAppServiceSlotContainerConfig for deploying containers to slots
- Validate empty image name before calling ARM (clear error instead of
sending linuxFxVersion=DOCKER| which ARM rejects)
- Strengthen RequiredExternalTools test to actually call the method and
assert on returned tools
- Validate request payload in UpdateAppServiceContainerConfig test (assert
linuxFxVersion and acrUseManagedIdentityCreds are in the body)
- Add user documentation in docs/reference/azure-yaml-schema.md explaining
the container deployment mode for App Service
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add Test_appServiceTarget_Deploy_ContainerSlotPath that sets AZD_DEPLOY_WEB_SLOT_NAME=staging and verifies the slot PATCH endpoint is called with the container image - Add Test_AzureClient_UpdateAppServiceSlotContainerConfig that asserts the request targets /slots/<name> and includes linuxFxVersion + acrUseManagedIdentityCreds in the body Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ows) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Package() and Publish() now use isContainerDeploy() which checks service configuration (language=docker or docker.path set) in addition to artifact presence. This correctly handles Docker remote build and dotnet-publish docker flows where ContainerHelper.Package() returns no artifacts by design (build + push happen together in the Publish phase). Added regression test for remote-build scenario (empty package artifacts with docker config should be a no-op, not an error). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Summary
Adds container image deployment support to the App Service service target, fixing #1608.
When a service is configured with
host: appserviceandlanguage: docker(ordocker.pathis set), azd now:ContainerHelper.Publish()(reusing the same helper as thecontainerapptarget)linuxFxVersiontoDOCKER|<image>and enablesacrUseManagedIdentityCredsThe existing zip deploy path is completely unchanged for non-container services.
Changes
cli/azd/pkg/azapi/webapp.go: NewUpdateAppServiceContainerConfigmethod that callsWebAppsClient.Update()to set container configcli/azd/pkg/project/service_target_appservice.go: ModifiedPackage/Publish/Deployto detect and handleArtifactKindContainerartifacts; addedContainerHelperandenvironment.ManagerdependenciesDesign Decisions
host: appservicealready resolves to the built-in target. A separate extension would require a confusing new host kind for the sameMicrosoft.Web/sitesresource.acrUseManagedIdentityCreds(best practice). Admin credentials not supported in this initial implementation.linuxFxVersion. Windows container support can be added later.Testing
UpdateAppServiceContainerConfigAPI method tests (success + error)Fixes #1608