Repository navigation
[App Service] az webapp config egress: Add egress configuration and connection management - #34249
Conversation
Add genuine app-and-slot configuration-management recording and scoped test-only API08 verification. Keep production API09 helpers unchanged; API09 release validation and re-recording remain outstanding. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2f1db4a1-7534-4e3e-ac09-81448337f9ad
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution cmriachi! We will review the pull request and get back to you soon. |
|
Hi cmriachi, |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2f1db4a1-7534-4e3e-ac09-81448337f9ad
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
az webapp config egress: Add egress configuration and connection management
There was a problem hiding this comment.
🟡 Changes recommended
Enabling an empty configuration sends a deletion-shaped request, and service-backed coverage bypasses the production API version.
2 open issues
What changed in this PR
Adds preview az webapp config egress commands to the App Service module for managing virtualized backend connections on apps and deployment slots.
Changes:
- Adds configuration show/set and named connection add/remove/show commands, with validation and help examples.
- Introduces private generated helpers for app and slot egress operations using API version
2026-09-01. - Adds mocked command tests and an API08 app-and-slot scenario.
All paths below are relative to src/azure-cli/azure/cli/command_modules/appservice/.
| File | Description |
|---|---|
tests/latest/test_webapp_egress.py |
Tests command behavior, validation, serialization, and errors. |
tests/latest/test_webapp_egress_api08.py |
Adds API08 scenario coverage and recording sanitization. |
custom.py |
Implements configuration and connection handlers. |
commands.py |
Registers preview egress commands. |
aaz/latest/web/site/slot/config/egress/_show.py |
Reads slot egress configuration. |
aaz/latest/web/site/slot/config/egress/_create.py |
Writes slot egress configuration. |
aaz/latest/web/site/slot/config/egress/__init__.py |
Exports slot egress helpers. |
aaz/latest/web/site/slot/config/egress/__cmd_group.py |
Defines the private slot egress group. |
aaz/latest/web/site/slot/config/__init__.py |
Initializes the slot configuration package. |
aaz/latest/web/site/slot/config/__cmd_group.py |
Defines the private slot configuration group. |
aaz/latest/web/site/slot/__init__.py |
Initializes the slot package. |
aaz/latest/web/site/slot/__cmd_group.py |
Defines the private slot group. |
aaz/latest/web/site/config/egress/_show.py |
Reads app egress configuration. |
aaz/latest/web/site/config/egress/_create.py |
Writes app egress configuration. |
aaz/latest/web/site/config/egress/__init__.py |
Exports app egress helpers. |
aaz/latest/web/site/config/egress/__cmd_group.py |
Defines the private app egress group. |
aaz/latest/web/site/config/__init__.py |
Initializes the app configuration package. |
aaz/latest/web/site/config/__cmd_group.py |
Defines the private app configuration group. |
aaz/latest/web/site/__init__.py |
Initializes the site package. |
aaz/latest/web/site/__cmd_group.py |
Defines the private site group. |
aaz/latest/web/__init__.py |
Initializes the web helper package. |
aaz/latest/web/__cmd_group.py |
Defines the private web group. |
_params.py |
Defines public egress command arguments. |
_help.py |
Documents commands and usage examples. |
_constants.py |
Defines supported protocols, authentication types, and sources. |
Review effort: Balanced
| stack.enter_context(patch.object( | ||
| operation, 'query_parameters', _api08_query_parameters(operation.query_parameters))) |
There was a problem hiding this comment.
our api changes have not yet been deployed everywhere for 2026-09-01, but our backend service accepts servicing requests with the latest/most up-to-date api version if the explicit api version is not found
hence why i had to make the testing use 2026-08-01
question: can we set the production az cli commands to also use 2026-08-01 under the hood even as the azure-rest-api-specs pr is not merged yet (due to not having been deployed everywhere yet)?
There was a problem hiding this comment.
As these are aaz generated commands we do not provide any escape latches to override the api version. If you want to target 2026-08-01. you would need to regenerate the commands starting from the aaz models.
There was a problem hiding this comment.
changed the recording tests to use 2026-09-01 against brazilus arm endpoint (since for now that is where we have deployed our api version, we are in the process of deploying it further)
|
another concern: i was told by a sister team of ours that you do not allow checking in azure cli commands unless the azure-rest-api-spec PR is merged in. We cannot merge the PR in yet because the code backing up the API is not yet deployed everywhere. Is there a solution for this timeline? |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
cmriachi please fix the merge conflicts. |
…or the recording tests
|
mansoor sarfraz (@msarfraz) Naga Nandyala (@naga-nandyala) we are targeting the nov 11 milestone to get these changes in, waiting on full arm deployment of our api version 2026-09-01 before merging of course, but in the meantime we would like reviews for correctness to be ready to merge this in directly when the time comes (close to nov 11) |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Please fix CI issues |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
lgtm |

🤖 PR Validation —⚠️ Review suggested
This PR adds warning or check suppressions. Fix the underlying warning where possible and justify each remaining suppression in a code comment or the PR description.
1 added suppression
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_egress.pyclient._request.side_effect = self._make_request # pylint: disable=protected-accessRelated command
az webapp config egress setaz webapp config egress showaz webapp config egress connection addaz webapp config egress connection showaz webapp config egress connection removeDescription
Add preview egress configuration and named connection management for web apps and deployment slots.
setreads the existing configuration, applies optional--enabled true/false, and writes it back while preserving all connection definitions. Boolean values map to the backend's existingEnabled/Disabledstrings. Omitting the flag preserves the existing state; a bare--enabledmeans true.setdoes not accept connection definitions and cannot replace or clear the connection collection.showreturns the complete egress configuration.connection add/show/removemanage individual connections, including case-insensitive upsert and lookup, while preserving unrelated connections and the enabled state. There is noconnection deletealias.web sitecommand surface is exposed.Companion command models: Azure/aaz#1134.
Validation gaps
Production helpers intentionally remain on API
2026-09-01. That API version was not registered in the test region during validation, so native API09 service compatibility is not validated. The genuine app-and-slot recording uses API2026-08-01through an explicitly labeled, test-local scoped override of only the four GET/PUT query properties. The cassette honestly records API08 URLs; neither production code nor recorded URLs implement a fallback. Native API09 service validation and recording remain outstanding before this is ready to ship.For the first connection,
connection addpreserves the enabled value returned by GET. If GET omits it, the PUT also omits it rather than assumingDisabled. Compatibility of that initial-state behavior with the target backend's state-validation contract remains to be confirmed; the API08 evidence does not establish API09 compatibility.The public
--identity-scopehelp does not claim that the platform infers the token scope. The companion AAZ PR tracks the remaining misleading generated-help wording.Testing Guide
Examples below assume that the app, referenced settings, and required identities already exist:
Configuration-management tests use synthetic, non-secret setting values and real assigned identities. They do not test outbound application traffic or provision SQL/Storage backends, grants, or firewall changes.
Latest post-upstream-sync checks:
azdev style appserviceazdev linter appservice --ci-exclusionsazdev latest-index verify --cli <checkout>az webapp config egress set --helpgit diff --checkand merged first-parent diff whitespace checkazdev cmdcov appservicewas also run earlier: exit 0, all five egress commands attributed, with 206/312 module commands covered (66.026%) and 106 non-egress baseline gaps. Those counts predate the final SET workflow and upstream sync; command coverage was not rerun after those changes, and is not a claim of full argument/example coverage.The full appservice test suite was not run. No live tests or recording changes were performed for PR publication.
The bot-managed validation block above is preserved verbatim from the existing PR and refers to older commit
f16acd0a9b1c6e8ff2a87bf11a4998ff12d313f9. Its 130/130 result is not fresh validation of current headc9ed500bafd16b3701c13d4fdc4d9096ce1e2e62.The focused offline verification used the following selectors in the same process, with a fresh credential-free config, socket connections blocked, and only the unrelated CLI update notifier suppressed. Reproduce from the checkout root in the existing development environment:
The 22 egress unit tests exercise parser-to-wire true/false/bare/omitted behavior, rejection of removed connection arguments before HTTP, GET-then-PUT ordering, app/slot routes, complete nested connection preservation, missing/empty configurations, error propagation, and connection add/show/remove validation and regressions. All four original API09 metadata/resource/query properties were additionally verified after the test-local API08 override had been restored.
The earlier explicitly authorized live re-recording ran only this selected scenario:
Result: one scenario passed, exit 0, in 195.076 seconds. It created its own temporary resource group, one Linux S1 plan, app, staging slot, and assigned identities; cleanup was confirmed. No pre-existing manual test app was modified.
The sanitized cassette contains 118 genuine HTTP interactions, including 94 egress interactions and 14 SET GET/PUT preservation pairs across app and slot paths. It covers all five commands, explicit managed identity scope and UAMI override, both setting sources, credential injection, case-insensitive names without duplicates, missing-name failures without mutation, remove-last, and parent/slot isolation. Standard HTTP matchers are retained and request-body matching is additionally required. No fabricated interactions, API-version URL rewriting, or skipped assertions were used. Testsdk processors sanitize credentials and identity metadata; the cassette remained byte-unchanged through offline playback.
History Notes
[App Service]
az webapp config egress: Add enabled-state updates and configuration queries for web apps and deployment slots[App Service]
az webapp config egress connection: Add named connection add/show/remove with setting references and managed identity optionsThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.