Skip to content

[Feature] Expose the target service name to global predeploy/postdeploy hooks #9251

Description

@qiaozha

Summary

Global predeploy / postdeploy hooks fire around every azd deploy, but azd does not tell the hook which service triggered the deploy. There's no standard, azd-provided signal naming the current target.

Why it matters

We rely on global hooks for cross-cutting concerns that must run regardless of which service was deployed (e.g. agent RBAC + a new Foundry version, Logic App workflow PUT). But some of that logic must branch per service — e.g. only run the agent's az acr build when the target is the agent, only apply a slot repoint for the relevant service.

Running azd deploy backend vs. azd deploy frontend vs. azd deploy agent-server all invoke the same global predeploy.ts with no first-class way to know the target.

Current workaround

We maintain our own AZD_DEPLOY_SERVICE env-var convention that we set/read ourselves so the global hook can branch. This is:

  • untyped / ad-hoc — a string convention, easy to typo, invisible in azure.yaml
  • brittle — can drift out of sync with what azd is actually deploying
  • non-discoverable — nothing documents that the global hook secretly branches on a service name

Ask

Provide a standard signal to global hooks naming the service currently being deployed — e.g. a well-known env var (AZD_SERVICE_NAME) set for the duration of the hook, and/or a --service <name> value surfaced consistently to global pre/postdeploy.


Context: encountered while deploying a multi-component AI/chat service (App Service + Function App + Logic App + Foundry hosted agent) end-to-end with azd provision/deploy in Azure/azure-sdk-tools tools/sdk-ai-bots/deployment. We currently work around this with a TypeScript hook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions