|
| 1 | +--- |
| 2 | +title: environment.yaml schema |
| 3 | +description: Learn how to use environment.yaml to define parameters in your environment definition. |
| 4 | +author: RoseHJM |
| 5 | +ms.author: rosemalcolm |
| 6 | +ms.service: dev-box |
| 7 | +ms.topic: concept-article |
| 8 | +ms.date: 11/17/2023 |
| 9 | + |
| 10 | +#customer intent: As a developer, I want to know which parameters I can assign for parameters in environment.yaml. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +# Parameters and data types in environment.yaml |
| 15 | + |
| 16 | +ADE environment definitions are infrastructure as code (IaC), written in Bicep or Terraform, stored in repositories. Environment definitions can be modified and adapted for your specific requirements and then used to create a deployment environment on Azure. The environment.yaml schema defines and describes the types of Azure resources included in environment definitions. |
| 17 | + |
| 18 | + |
| 19 | +## What is environment.yaml? |
| 20 | + |
| 21 | +The environment.yaml file acts as a manifest, describing the resources used and the template location for the environment definition. |
| 22 | + |
| 23 | +### Sample environment.yaml |
| 24 | +The following script is a generic example of an environment.yaml required for your environment definition. |
| 25 | + |
| 26 | +```yml |
| 27 | +name: WebApp |
| 28 | +version: 1.0.0 |
| 29 | +summary: Azure Web App Environment |
| 30 | +description: Deploys a web app in Azure without a datastore |
| 31 | +runner: ARM |
| 32 | +templatePath: azuredeploy.json |
| 33 | +``` |
| 34 | +### Definitions |
| 35 | +The following table describes the properties that you can use in environment.yaml. |
| 36 | +
|
| 37 | +| **Property** | **Type** | **Description** | **Required** | **Examples** | |
| 38 | +| ------------ | -------- | -------------------------------------------------- | ------------ | ----------------------------------------------- | |
| 39 | +| name | string | The display name of the catalog item. | Yes | | |
| 40 | +| version | string | The version of the catalog item. | | 1.0.0 | |
| 41 | +| summary | string | A short summary string about the catalog item. | | | |
| 42 | +| description | string | A description of the catalog item. | | | |
| 43 | +| runner | string | The container image to use when executing actions. | | ARM template </br> Terraform | |
| 44 | +| templatePath | string | The relative path of the entry template file. | Yes | main.tf </br> main.bicep </br> azuredeploy.json | |
| 45 | +| parameters | array | Input parameters to use when creating the environment and executing actions. | | #/definitions/Parameter | |
| 46 | +
|
| 47 | +## Parameters in environment.yaml |
| 48 | +
|
| 49 | +Parameters enable you to reuse an environment definition in different scenarios. For example, you might want developers in different regions to deploy the same environment. You can define a location parameter to prompt the developer to enter the desired location as they create their environment. |
| 50 | +
|
| 51 | +### Sample environment.yaml with parameters |
| 52 | +
|
| 53 | +The following script is an example of a environment.yaml file that includes two parameters; `location` and `name`: |
| 54 | + |
| 55 | +```yml |
| 56 | +name: WebApp |
| 57 | +summary: Azure Web App Environment |
| 58 | +description: Deploys a web app in Azure without a datastore |
| 59 | +runner: ARM |
| 60 | +templatePath: azuredeploy.json |
| 61 | +parameters: |
| 62 | +- id: "location" |
| 63 | + name: "location" |
| 64 | + description: "Location to deploy the environment resources" |
| 65 | + default: "[resourceGroup().location]" |
| 66 | + type: "string" |
| 67 | + required: false |
| 68 | +- id: "name" |
| 69 | + name: "name" |
| 70 | + description: "Name of the Web App " |
| 71 | + default: "" |
| 72 | + type: "string" |
| 73 | + required: false |
| 74 | +``` |
| 75 | + |
| 76 | +### Parameter definitions |
| 77 | + |
| 78 | +The following table describes the data types that you can use in environment.yaml. The data type names used in the environment.yaml manifest file differ from the ones used in ARM templates. |
| 79 | + |
| 80 | +Each parameter can use any of the following properties: |
| 81 | + |
| 82 | +| **Properties** | **Type** | **Description** | **Further Settings** | |
| 83 | +| -------------- | -------------- |------------------------------------------------ |--------------------------------------- | |
| 84 | +| ID | string | Unique ID of the parameter. | | |
| 85 | +| name | string | Display name of the parameter. | | |
| 86 | +| description | string | Description of the parameter. | | |
| 87 | +| default | array </br> boolean </br> integer </br> number </br> object </br> string | The default value of the parameter. | | |
| 88 | +| type | array </br> boolean </br> integer </br> number </br> object </br> string | The data type of the parameter. This data type must match the parameter data type in the ARM template, BICEP file, or Terraform file with the corresponding parameter name. | **Default type:** string | |
| 89 | +| readOnly | boolean | Whether or not this parameter is read-only. | | |
| 90 | +| required | boolean | Whether or not this parameter is required. | | |
| 91 | +| allowed | array | An array of allowed values. | "items": { </br> "type": "string" </br> }, </br> "minItems": 1, </br> "uniqueItems": true, | |
| 92 | + |
| 93 | +## YAML schema |
| 94 | + |
| 95 | +There's a defined schema for Azure Deployment Environments environment.yaml files, which can make editing these files a little easier. You can add the schema definition to the beginning of your environment.yaml file: |
| 96 | + |
| 97 | +```yml |
| 98 | +# yaml-language-server: $schema=https://github.com/Azure/deployment-environments/releases/download/2022-11-11-preview/manifest.schema.json |
| 99 | +``` |
| 100 | + |
| 101 | +Here's an example environment definition that uses the schema: |
| 102 | + |
| 103 | +```yml |
| 104 | +# yaml-language-server: $schema=https://github.com/Azure/deployment-environments/releases/download/2022-11-11-preview/manifest.schema.json |
| 105 | +name: FunctionApp |
| 106 | +version: 1.0.0 |
| 107 | +summary: Azure Function App Environment |
| 108 | +description: Deploys an Azure Function App, Storage Account, and Application Insights |
| 109 | +runner: ARM |
| 110 | +templatePath: azuredeploy.json |
| 111 | +
|
| 112 | +parameters: |
| 113 | + - id: name |
| 114 | + name: Name |
| 115 | + description: 'Name of the Function App.' |
| 116 | + type: string |
| 117 | + required: true |
| 118 | +
|
| 119 | + - id: supportsHttpsTrafficOnly |
| 120 | + name: 'Supports Https Traffic Only' |
| 121 | + description: 'Allows https traffic only to Storage Account and Functions App if set to true.' |
| 122 | + type: boolean |
| 123 | +
|
| 124 | + - id: runtime |
| 125 | + name: Runtime |
| 126 | + description: 'The language worker runtime to load in the function app.' |
| 127 | + type: string |
| 128 | + allowed: |
| 129 | + - 'dotnet' |
| 130 | + - 'dotnet-isolated' |
| 131 | + - 'java' |
| 132 | + - 'node' |
| 133 | + - 'powershell' |
| 134 | + - 'python' |
| 135 | + default: 'dotnet-isolated' |
| 136 | +``` |
| 137 | + |
| 138 | +## Related content |
| 139 | + |
| 140 | +- [Add and configure an environment definition in Azure Deployment Environments](configure-environment-definition.md) |
| 141 | +- [Parameters in ARM templates](../azure-resource-manager/templates/parameters.md) |
| 142 | +- [Data types in ARM templates](../azure-resource-manager/templates/data-types.md) |
0 commit comments