azd templates are blueprint repositories that include proof-of-concept application code, editor/IDE configurations, and infrastructure code written in Bicep or Terraform. These templates are intended to be modified and adapted for your specific application requirements and then used to get your application on Azure using the Azure Developer CLI (azd). The azure.yaml schema defines and describes the apps and types of Azure resources that are included in these templates.
Sample
Below is a generic example of an azure.yaml required for your azd template.
name: yourApp
metadata:
template: yourApp@0.0.1-beta
services:
web:
project: ./src/web # path to your web project
dist: build # relative path to service deployment artifacts
language: js # one of the supported languages
host: appservice # one of the supported Azure services
A range of supported versions of azd for this project. If the version of azd is outside this range, the project will fail to load. Optional (allows all versions if absent). Example: >= 0.6.0-beta.3
metadata properties
Element Name
Required
Description
Example
template
N
(string) Identifier of the template from which the application was created.
todo-nodejs-mongo@0.0.1-beta
infra properties
Element Name
Required
Description
Example
provider
N
(string) The infrastructure provider for the application's Azure resources. (Default: bicep).
(string) Name of the Azure resource that implements the service. If not specified, azd will look for a resource by azd-env-name and azd-service-name tags. If not found, it will look for a resource name constructed from the current environment name, concatenated with the service name (<environment-name><resource-name>).
prodapi
project
Y
(string) Path to the service source code directory.
host
Y
(string) Type of Azure resource used for service implementation. If omitted, App Service will be assumed.
appservice, containerapp, function, staticwebapp, aks (only for projects deployable via kubectl apply -f), springapp (when enabled - learn more about alpha features)
language
Y
(string) Service implementation language.
dotnet, csharp, fsharp, py, python, js, ts, java
module
Y
(string) Path of the infrastructure module used to deploy the service relative to the root infra folder. If omitted, the CLI will assume the module name is the same as the service name.
dist
Y
(string) Relative path to the service deployment artifacts. The CLI will use files under this path to create the deployment artifact (.zip file). If omitted, all files under the service project directory will be included.
build
docker
N
Only applicable when host is containerapp. Can't contain extra properties.
See the custom Docker sample below. path(string): Path to the Dockerfile. Default: ./Dockerfile; context(string): The docker build context. When specified, overrides default context. Default: .; platform(string): The platform target. Default: amd64; remoteBuild(boolean): Enables remote ACR builds. Default: false
k8s
N
The Azure Kubernetes Service (AKS) configuration options.
See the AKS sample below. deploymentPath(string): Optional. The relative path from the service path to the k8s deployment manifests. When set, it will override the default deployment path location for k8s deployment manifests. Default: manifests; namespace(string): Optional. The k8s namespace of the deployed resources. When specified, a new k8s namespace will be created if it does not already exist. Default: Project name; deployment(object): See deployment properties; service(object): See service properties; ingress(object): See ingress properties.
hooks
N
Service level hooks. Hooks should match service event names prefixed with pre or post depending on when the script should execute. When specifying paths they should be relative to the service path.
Specify an explicit api-version when deploying services hosted by Azure Container Apps (ACA). This feature helps you avoid using an incompatible API version and makes deployment more loosely coupled to avoid losing custom configuration data during JSON marshaling to a hard-coded Azure SDK library version.
apiVersion: 2024-02-02-preview
Docker options sample
In the following example, we declare Docker options for a container app.
(string) Optional. The name of the k8s deployment resource to use during deployment. Used during deployment to ensure if the k8s deployment rollout has been completed. If not set, will search for a deployment resource in the same namespace that contains the service name. Default: Service name
api
AKS service properties
Element Name
Required
Description
Example
name
N
(string) Optional. The name of the k8s service resource to use as the default service endpoint. Used when determining endpoints for the default service resource. If not set, will search for a deployment resource in the same namespace that contains the service name. (Default: Service name)
api
AKS ingress properties
Element Name
Required
Description
Example
name
N
(string) Optional. The name of the k8s ingress resource to use as the default service endpoint. Used when determining endpoints for the default ingress resource. If not set, will search for a deployment resource in the same namespace that contains the service name. Default: Service name
api
relativePath
N
(string) Optional. The relative path to the service from the root of your ingress controller. When set, will be appended to the root of your ingress resource path.
AKS sample with service level hooks
metadata:
template: todo-nodejs-mongo-aks@0.0.1-beta
services:
web:
project: ./src/web
dist: build
language: js
host: aks
hooks:
postdeploy:
shell: sh
run: azd env set REACT_APP_WEB_BASE_URL ${SERVICE_WEB_ENDPOINT_URL}
api:
project: ./src/api
language: js
host: aks
k8s:
ingress:
relativePath: api
hooks:
postdeploy:
shell: sh
run: azd env set REACT_APP_API_BASE_URL ${SERVICE_API_ENDPOINT_URL}
pipeline properties
Element Name
Required
Description
Example
provider
N
(string) The pipeline provider to be used for continuous integration. (Default: github).
For information on how to file a bug, request help, or propose a new feature for the Azure Developer CLI, please visit the troubleshooting and support page.