Repository navigation
doc(spec): add spec for Entra agent identity cleanup on azd down - #10970
Draft
Hui Miao (huimiu) wants to merge 6 commits into
Draft
Hui Miao (huimiu) wants to merge 6 commits into
Hui Miao (huimiu) wants to merge 6 commits into
Conversation
|
Azure Pipelines: 27 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Hui Miao (huimiu)
force-pushed
the
hui/fix-agent-identity-cleanup
branch
from
November 20, 2026 00:07
2ba317c to
2b4f3d8
Compare
Hui Miao (huimiu)
force-pushed
the
hui/fix-agent-identity-cleanup
branch
from
November 23, 2026 00:12
2b4f3d8 to
0afb03b
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent identity cleanup on
azd downGoal
Deploying a Microsoft Foundry agent creates an identity in Microsoft Entra. Today,
azd downdeletes prompt agents without checking whether this environment created them, and never deletes hosted or voice agents before deleting the Foundry project, leaving their Entra identities behind. This proposal deletes verified environment-owned agents through Foundry duringazd downbefore deleting the project, with the goal of removing their Entra identities without Microsoft Graph permissions.Proposed behavior
azd downbehaviorazd downwill delete its Foundry project--force), before deleting the project.azd down --preview, or runsazd down <layer>for a layer that keeps the Foundry projectSkipping or failing agent cleanup does not block deleting a Foundry project that is in scope. Those agents stop working once the project is deleted, though their Entra identities may remain.
Key rules and trade-offs
Ownership on deploy
When
azd uporazd deploycreates a hosted, prompt, or voice agent,azdrecords that the selected environment created it in that Foundry project. Later deploys can publish new versions without losing that ownership. Deploying to an existing agent still works, butazddoes not claim ownership. All three agent types require verified ownership beforeazd downcan delete them.Consent and teardown order
Agent cleanup runs only when
azd downwill delete the Foundry project, after the user confirms deletion or passes--force, and before project deletion starts. Unlike--force,--purgestill prompts for confirmation before deleting agents.Shared versions, voice bindings, and purge
Multiple environments can publish versions to the same agent, and deleting an agent removes all its versions and can end active sessions. Even so,
azddoes not skip cleanup when other environments use those versions, becauseazd downis about to delete the whole Foundry project and break those environments anyway.azdwarns about this impact before confirmation, and still prints the warning when--forceskips the prompt.Voice deployments can reuse existing telephony bindings, so
azddoes not delete bindings automatically. Before deleting a voice agent,azdwarns before confirmation that bindings may remain and links to telephony cleanup steps. Users can cancel, remove bindings, and rerunazd down. With--force,azdprints the warning and continues, so users must clean up unwanted bindings first.Microsoft Entra soft-deletes agent identities with a 30-day recovery window and does not state when deletion frees quota. Until Foundry confirms hard-delete support,
azd down --purgewill not promise permanent identity deletion or freed quota.Fallback when cleanup is skipped or fails
When ownership is unknown,
azdtells users how to clean up manually. Before runningazd down, users can runazd ai agent deleteafter checking that no other environment uses the agent. After project deletion, users can follow Microsoft Entra cleanup guidance, which may need extra Entra permissions.When Foundry fails to delete an owned agent,
azdwarns and continues teardown. If deleting the Foundry project also fails or stops early,azdkeeps the local agent record so rerunningazd downcan retry deleting the agent. If the project is deleted, the warning prints the identity client ID and principal ID so the user can find it in Entra.Service dependencies to confirm
--purgecan hard-delete them. Resolving #10964 depends on confirming this behavior.