Problem
There is no CLI command to delete a hosted agent from the Foundry service. Users must manually call the REST API or use other tools to remove agents they no longer need.
The DeleteAgent API exists in Vienna (AgentController.cs) with a force query parameter to handle agents with active sessions, but no azd CLI command exposes it.
Proposed Solution
Add azd ai agent delete [name] command that:
- Resolves agent name from azure.yaml / azd environment (same as
show, invoke)
- Calls
DELETE /agents/{agentName}?api-version=v1&force={true|false}
- Default behavior: safe delete (fails with 409 if active sessions exist)
--force flag: terminates active sessions and force-deletes
Acceptance Criteria
Problem
There is no CLI command to delete a hosted agent from the Foundry service. Users must manually call the REST API or use other tools to remove agents they no longer need.
The
DeleteAgentAPI exists in Vienna (AgentController.cs) with aforcequery parameter to handle agents with active sessions, but noazdCLI command exposes it.Proposed Solution
Add
azd ai agent delete [name]command that:show,invoke)DELETE /agents/{agentName}?api-version=v1&force={true|false}--forceflag: terminates active sessions and force-deletesAcceptance Criteria
azd ai agent deleteworks with auto-resolved agent nameazd ai agent delete my-agentworks with explicit nameazd ai agent delete --forceforce-deletes even with active sessions--output jsonreturns structured response