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.
Summary
Global
predeploy/postdeployhooks fire around everyazd deploy, butazddoes 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'saz acr buildwhen the target is the agent, only apply a slot repoint for the relevant service.Running
azd deploy backendvs.azd deploy frontendvs.azd deploy agent-serverall invoke the same globalpredeploy.tswith no first-class way to know the target.Current workaround
We maintain our own
AZD_DEPLOY_SERVICEenv-var convention that we set/read ourselves so the global hook can branch. This is:azure.yamlazdis actually deployingAsk
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 globalpre/postdeploy.Context: encountered while deploying a multi-component AI/chat service (App Service + Function App + Logic App + Foundry hosted agent) end-to-end with
azdprovision/deploy in Azure/azure-sdk-toolstools/sdk-ai-bots/deployment. We currently work around this with a TypeScript hook.