Plan and manage an Azure AI solution 1.2 Set up AI solutions in Foundry

A pipeline deploys a hosted agent with the Azure Developer CLI (azd) on every merge.

Study guide skill: Integrate Foundry projects with continuous integration and continuous deployment (CI/CD) pipelines

Question B6-008

A pipeline deploys a hosted agent with the Azure Developer CLI (azd) on every merge. The infrastructure rarely changes, and each new agent version must be validated before it receives production traffic. Which two actions should you take? (Choose two.)

Select 2 answers.

  • A Run azd up on every merge so that the infrastructure is provisioned again with each code change
  • B Pin the production endpoint before deployment, then promote the new version explicitly after validation ✓ Correct answer
  • C Delete the previous agent version after each deployment, because azd deploy overwrites it
  • D Tag every image :latest so that the endpoint always runs the newest build
  • E Run azd deploy for code-only changes instead of azd up ✓ Correct answer

Answer: B, E

azd up combines provisioning with deployment and suits first-time deployments or changes to both infrastructure and code, so code-only merges use azd deploy. Each azd deploy creates a new agent version and keeps the previous ones, and by default the endpoint follows the latest version. To validate a candidate before it gets production traffic, pin production before deploying and promote explicitly; the docs also recommend unique image tags instead of :latest.

Deep dive

How it works

The Azure Developer CLI gives you two commands, and they do different amounts of work:

  • azd up combines azd provision (which creates the Foundry project, model deployment, container registry, Application Insights and managed identity) with azd deploy.
  • azd deploy is for when you've already provisioned your Azure resources and only need to push a new agent version. It builds the container image remotely in Azure Container Registry, so you don't need local Docker.

With rarely changing infrastructure, a merge pipeline should run azd deploy.

Versions and traffic. Each azd deploy creates a new version of the agent, and the CLI preserves previous versions. By default the endpoint follows the latest version. A pinned endpoint keeps serving its selected version until you update its routing configuration. Microsoft's advice for this exact scenario: to validate a candidate before it receives production traffic, pin production before deployment and promote explicitly.

Use unique image tags instead of :latest so every deployment is reproducible.

The other options, and when you'd use them

  • azd up on every merge: It runs provisioning along with the deploy each time. azd deploy exists for the case where resources are already provisioned and you only push a new agent version.
  • Delete the previous version because azd deploy overwrites it: It doesn't overwrite anything. Each deploy creates a new version, and the CLI preserves the previous ones, which you'd want for rollback.
  • Tag every image :latest: The opposite of the guidance, which is unique tags. It also doesn't help validation, because by default the endpoint already follows the newest version.

Exam tip

Code-only change = azd deploy. Infra + code = azd up. Validate before traffic = pin production, then promote.

References

Last reviewed:

Ready to test yourself? The quiz asks this and every other AI-103 question, with instant feedback. Practice this in a quiz →

All Plan and manage questions · AI-103 study guide

Thanks for your feedback!