Update the azure.yaml file
Your template includes the source code for your app and defines Bicep files to create the corresponding infrastructure. However, your template still needs to describe the relationship between the app source code and the Azure resources. You can use the azure.yaml
file to describe one or more app services in your code base and how they should be deployed to the provisioned Azure resources.
At the root of your project, locate and open the
azure.yaml
file. The file contains various code comments that provide helpful guidance and examples of how to define services. Service definitions map a folder in your source code to a resource in Azure using a standardize YAML structure.Copy and paste the following definition at the bottom of the
azure.yaml
file:services: web: language: csharp project: ./src/web host: appservice
Each line of code in this example schema describes a different aspect of the services in your app:
- services - Every
azure.yaml
file defines one top levelservices
node that lists one or more services in your template. - web - A name of your choosing that maps to a service in your app code, such as
api
orworker
. However, this name must match the value of theazd-service-name
tag you assigned to the resource in your Bicep or Terraform code. For example, this service has a value ofweb
because the App Service definition in theapp.bicep
file specifiedtags: { 'azd-service-name': 'web' }
. This tag naming association is howazd
understands which Azure resource the specified code directory should be deployed to. - language - A property that specifies the language of the code you want to deploy.
azd
currently supports language values ofcsharp
,python
,javascript
andjava
. - project - A property that sets the path to where the code for the service is stored.
- host - A property that defines what type of Azure service the app deploys to.
Note
Again, make sure the name of your service (in this case:
web
) inazure.yaml
matches theazd-service-name
tag on the corresponding host resource defined in the Bicep file.- services - Every
With the azure.yaml
completed, all of the key structural components of your template are in place. In the next unit, you'll learn how to provision and deploy your template resources to Azure.