Skip to content

Commit 63a669c

Browse files
author
RoseHJM
committed
Merge branch 'main' of https://github.com/MicrosoftDocs/azure-docs-pr into ade-runner
2 parents 5e4977d + f245afa commit 63a669c

File tree

7 files changed

+373
-20
lines changed

7 files changed

+373
-20
lines changed

articles/certification/edge-secured-core-devices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Edge Secured-core certified devices
33
description: List of devices that have passed the Edge Secured-core certifications
4-
author: dimatokar
4+
author: dimatx
55
ms.author: dimatokar
66
ms.topic: conceptual
77
ms.date: 01/26/2024
Lines changed: 357 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,357 @@
1+
---
2+
title: ADE CLI reference
3+
titleSuffix: Azure Deployment Environments
4+
description: Learn about the commands available for building custom images using Azure Deployment Environment (ADE) base images.
5+
ms.service: deployment-environments
6+
author: RoseHJM
7+
ms.author: rosemalcolm
8+
ms.date: 04/13/2024
9+
ms.topic: reference
10+
11+
# Customer intent: As a developer, I want to learn about the commands available for building custom images using Azure Deployment Environment (ADE) base images.
12+
---
13+
14+
# Azure Deployment Environment CLI reference
15+
16+
This article describes the commands available for building custom images using Azure Deployment Environment (ADE) base images.
17+
18+
By using the ADE CLI, you can interact with information about your environment and specified environment definition, upload, and access previously uploaded files related to the environment, record more logging regarding their executing operation, and upload and access outputs of an environment deployment.
19+
20+
## What commands can I use?
21+
The ADE CLI currently supports the following commands:
22+
- [ade definitions](#ade-definitions-command-set)
23+
- [ade environment](#ade-environment-command)
24+
- [ade files](#ade-files-command-set)
25+
- [ade init](#ade-init-command)
26+
- [ade log](#ade-log-command-set)
27+
- [ade operation-result](#ade-operation-result-command)
28+
- [ade outputs](#ade-outputs-command-set)
29+
30+
Additional information on how to invoke the ADE CLI commands can be found in the linked documentation.
31+
32+
## ade definitions command set
33+
The `ade definitions` command allows the user to see information related to the definition chosen for the environment being operated on, and download the related files, such as the primary and linked Infrastructure-as-Code (IaC) templates, to a specified file location.
34+
35+
The following commands are within this command set:
36+
37+
- [ade definitions list](#ade-definitions-list)
38+
- [ade definitions download](#ade-definitions-download)
39+
40+
### ade definitions list
41+
The list command is invoked as follows:
42+
43+
```definitionValue=$(ade definitions list)```
44+
45+
This command returns a data object describing the various properties of the environment definition.
46+
47+
#### Return type
48+
This command returns a JSON object describing the environment definition. Here's an example of the return object, based on one of our sample environment definitions:
49+
```
50+
{
51+
"id": "/projects/PROJECT_NAME/catalogs/CATALOG_NAME/environmentDefinitions/appconfig",
52+
"name": "AppConfig",
53+
"catalogName": "CATALOG_NAME",
54+
"description": "Deploys an App Config.",
55+
"parameters": [
56+
{
57+
"id": "name",
58+
"name": "name",
59+
"description": "Name of the App Config",
60+
"type": "string",
61+
"readOnly": false,
62+
"required": true,
63+
"allowed": []
64+
},
65+
{
66+
"id": "location",
67+
"name": "location",
68+
"description": "Location to deploy the environment resources",
69+
"default": "westus3",
70+
"type": "string",
71+
"readOnly": false,
72+
"required": false,
73+
"allowed": []
74+
}
75+
],
76+
"parametersSchema": "{\"type\":\"object\",\"properties\":{\"name\":{\"title\":\"name\",\"description\":\"Name of the App Config\"},\"location\":{\"title\":\"location\",\"description\":\"Location to deploy the environment resources\",\"default\":\"westus3\"}},\"required\":[\"name\"]}",
77+
"templatePath": "CATALOG_NAME/AppConfig/appconfig.bicep",
78+
"contentSourcePath": "CATALOG_NAME/AppConfig"
79+
}
80+
```
81+
82+
#### Utilizing returned property values
83+
84+
You can assign environment variables to certain properties of the returned definition JSON object by utilizing the JQ library (preinstalled on ADE-authored images), using the following format:\
85+
```environment_name=$(echo $definitionValue | jq -r ".Name")```
86+
87+
You can learn more about advanced filtering and other uses for the JQ library [here](https://devdocs.io/jq/).
88+
89+
### ade definitions download
90+
This command is invoked as follows:\
91+
```ade definitions download --folder-path EnvironmentDefinition```
92+
93+
This command downloads the main and linked Infrastructure-as-Code (IaC) templates and any other associated files with the provided template.
94+
95+
#### Options
96+
97+
**--folder-path**: The folder path to download the environment definition files to. If not specified, the command stores the files in a folder named EnvironmentDefinition at the current directory level at execution time.
98+
99+
#### What Files Do I Have Access To?
100+
Any files stored at or below the level of the environment definition manifest file (environment.yaml or manifest.yaml) within the catalog repository are accessible when invoking this command.
101+
102+
You can learn more about curating environment definitions and the catalog repository structure through the following links:
103+
104+
- [Add and Configure a Catalog in ADE](/azure/deployment-environments/how-to-configure-catalog?tabs=DevOpsRepoMSI)
105+
- [Add and Configure an Environment Definition in ADE](/azure/deployment-environments/configure-environment-definition)
106+
- [Best Practices For Designing Catalogs](/azure/deployment-environments/best-practice-catalog-structure)
107+
108+
Additionally, your files would also be available within the container at `/ade/repository/{YOUR_CATALOG_NAME}/{RELATIVE_DIRECTORY_TO_MANIFEST}`. For example, if within the repository you connected as your catalog, named Catalog1, your manifest file is stored at Folder1/Folder2/environment.yaml, your files would be present within the container at `/ade/repository/Catalog1/Folder1/Folder2`. ADE adds these files automatically to this file location, as it's necessary to execute your deployment or deletion successfully.
109+
110+
## ade environment command
111+
The `ade environment` command allows the user to see information related to their environment the operation is being performed on.
112+
113+
The command is invoked as follows:
114+
115+
```environmentValue=$(ade environment)```
116+
117+
This command returns a data object describing the various properties of the environment.
118+
119+
### Return type
120+
This command returns a JSON object describing the environment. Here's an example of the return object:
121+
```
122+
{
123+
"uri": "https://TENANT_ID-DEVCENTER_NAME.DEVCENTER_REGION.devcenter.azure.com/projects/PROJECT_NAME/users/USER_ID/environments/ENVIRONMENT_NAME",
124+
"name": "ENVIRONMENT_NAME",
125+
"environmentType": "ENVIRONMENT_TYPE",
126+
"user": "USER_ID",
127+
"provisioningState": "PROVISIONING_STATE",
128+
"resourceGroupId": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME",
129+
"catalogName": "CATALOG_NAME",
130+
"environmentDefinitionName": "ENVIRONMENT_DEFINITION_NAME",
131+
"parameters": {
132+
"location": "locationInput",
133+
"name": "nameInput"
134+
},
135+
"location": "regionForDeployment"
136+
}
137+
```
138+
139+
### Utilizing returned property values
140+
141+
You can assign environment variables to certain properties of the returned definition JSON object by utilizing the JQ library (preinstalled on ADE-authored images), using the following format:\
142+
```environment_name=$(echo $environment | jq -r ".Name")```
143+
144+
You can learn more about advanced filtering and other uses for the JQ library [here](https://devdocs.io/jq/).
145+
146+
## ade execute command
147+
The `ade execute` command is used to provide implicit logging for scripts executed inside the container. This way, any standard output, or standard error content produced during the command is logged to the operation's log file for the environment, and can be accessed using the Azure CLI.
148+
149+
You should pipe all standard errors from this command to the error log file specified at the environment variable $ADE_ERROR_LOG, so that environment error details are easily populated and surfaced on the developer portal.
150+
151+
### Options
152+
`--operation`: A string input specifying the operation being performed with the command. Typically, this information is supplied by using the $ADE_OPERATION_NAME environment variable.
153+
154+
`--command`: The command to execute and record logging for.
155+
156+
### Examples
157+
This command executes *deploy.sh*:
158+
159+
```
160+
ade execute --operation $ADE_OPERATION_NAME --command "./deploy.sh" 2> >(tee -a $ADE_ERROR_LOG)
161+
```
162+
163+
164+
## ade files command set
165+
The `ade files` command set allows a customer to upload and download files within the executing operation container for a certain environment to be used later in the container, or in later operation executions. This command set is also used to upload state files generated for certain Infrastructure-as-Code (IaC) providers.
166+
167+
The following commands are within this command set:
168+
* [ade files list](#ade-files-list)
169+
* [ade files download](#ade-files-download)
170+
* [ade files upload](#ade-files-upload)
171+
172+
### ade files list
173+
This command lists the available files for download while within the environment container.
174+
175+
#### Return type
176+
This command returns available files for download as an array of strings. Here's an example:
177+
```
178+
[
179+
"file1.txt",
180+
"file2.sh",
181+
"file3.zip"
182+
]
183+
```
184+
185+
### ade files download
186+
This command downloads a selected file to a specified file location within the executing container.
187+
188+
#### Options
189+
**--file-name**: The name of the file to download. This file name should be present within the list of available files returned from the `ade files list` command. This option is required.
190+
191+
**--folder-path**: The folder path to download the file to within the container. This path isn't required, and the CLI by default downloads the file to the current directory when the command is executed.
192+
193+
**--unzip**: Set this flag if you want to download a zip file from the list of available files, and want the contents unzipped to the specified folder location.
194+
195+
#### Examples
196+
197+
The following command downloads a file to the current directory:
198+
```
199+
ade files download --file-name file1.txt
200+
```
201+
202+
The following command downloads a file to a lower-level folder titled *folder1*.
203+
```
204+
ade files download --file-name file1.txt --folder-path folder1
205+
```
206+
207+
The last command downloads a zip file, and unzips the file contents into the current directory:
208+
```
209+
ade files download --file-name file3.zip --unzip
210+
```
211+
212+
### ade files upload
213+
This command uploads either a singular file specified, or a zip folder specified as a folder path to the list of available files for the environment to access.
214+
215+
#### Options
216+
**--file-path**: The path of where the file exists from the current directory to upload. Either this option or the `--folder-path` option is required to execute this command.
217+
218+
**--folder-path**: The path of where the folder exists from the current directory to upload as a zip file. The resulting accessible file is accessible under the name of the lowest folder. Either this option or the `--file-path` option is required to execute this command.
219+
220+
> [!Tip]
221+
> Specifying a file or folder with the same name as an existing accessible file for the environment for this command overwrites the previously saved file (that is, if file1.txt is an existing accessible file, executing `ade files --file-path file1.txt` overwrites the previously saved file).
222+
223+
#### Examples
224+
The following command uploads a file from the current directory named *file1.txt*:
225+
```
226+
ade files upload --file-path "file1.txt"
227+
```
228+
229+
This file is later accessible by running:
230+
```
231+
ade files download --file-name "file1.txt"
232+
```
233+
The following command uploads a folder one level lower than the current directory named *folder1* as a zip file named *folder1.zip*:
234+
```
235+
ade files upload --folder-path "folder1"
236+
```
237+
238+
Finally, the following command uploads a folder two levels lower than the current directory at *folder1/folder2* as a zip file named *folder2.zip*:
239+
```
240+
ade files upload --folder-path "folder1/folder2"
241+
```
242+
243+
## ade init command
244+
245+
The `ade init` command is used to initialize the container for ADE by setting necessary environment variables and downloading the environment definition specified for deployment. The command itself prints shell commands, which are then evaluated within the core entrypoint using the following command:
246+
247+
```
248+
eval $(ade init)
249+
```
250+
It's only necessary to run this command once. If you're basing your custom image on any of the ADE-authored images, you shouldn't need to rerun this command.
251+
252+
## ade log command set
253+
The `ade log` commands are used to record details regarding the execution of the operation on the environment while within the container. This command offers many different logging levels, which can be then accessed after the operation finishes to analyze, and a customer can specify different files to log to for different logging scenarios.
254+
255+
ADE logs all statements that are output to standard output or standard error streams within the container. This feature can be used to upload logs to customer-specified files that can be viewed separately from the main operation logs.
256+
### Options
257+
**--content**: A string input containing the information to log. This option is required for this command.
258+
259+
**--type**: The level of log (verbose, log, or error) to log the content under. If not specified, the CLI logs the content at the log level.
260+
261+
**--file**: The file to log the content to. If not specified, the CLI logs to an .log file specified by the unique Operation ID of the executing operation.
262+
263+
### Examples
264+
265+
This command logs a string to the default log file:
266+
```
267+
ade log --content "This is a log"
268+
```
269+
270+
This command logs an error to the default log file:
271+
```
272+
ade log --type error --content "This is an error."
273+
```
274+
275+
This command logs a string to a specified file named *specialLogFile.txt*:
276+
```
277+
ade log --content "This is a special log." --file "specialLogFile.txt"
278+
```
279+
280+
## ade operation-result command
281+
The `ade operation-result` command allows error details to be added to the environment being operated on if an operation fails, and updates the ongoing operation.
282+
283+
The command is invoked as follows:
284+
```
285+
ade operation-result --code "ExitCode" --message "The operation failed!"
286+
```
287+
288+
### Options
289+
**--code**: A string detailing the exit code causing the failure of the operation
290+
291+
**--message**: A string detailing the error message for the operation failure.
292+
293+
> [!Important]
294+
> This operation should only be used just before exiting the container, as setting the operation in a Failed state doesn't permit other CLI commands to successfully complete.
295+
296+
## ade outputs command set
297+
The `ade outputs` command allows a customer to upload outputs from the deployment of an Infrastructure-as-Code (IaC) template to be accessed from the Outputs API for ADE.
298+
299+
### ade outputs upload
300+
This command uploads the contents of a JSON file specified in the ADE EnvironmentOutput format to the environment, to be accessed later using the Outputs API for ADE.
301+
302+
#### Options
303+
**--file**: A file location containing a JSON object to upload.
304+
305+
#### Examples
306+
307+
This command uploads a .json file named *outputs.json* to the environment to serve as the outputs for the successful deployment:
308+
```
309+
ade outputs upload --file outputs.json
310+
```
311+
312+
#### EnvironmentOutputs Format
313+
In order for, the incoming JSON file to be serialized properly and accepted as the environments deployment outputs, the object submitted must follow the below structure:
314+
```
315+
{
316+
"outputs": {
317+
"output1": {
318+
"type": "string",
319+
"value": "This is output 1!",
320+
"sensitive": false
321+
},
322+
"output2": {
323+
"type": "int",
324+
"value": 22,
325+
"sensitive": false
326+
},
327+
"output3": {
328+
"type": "string",
329+
"value": "This is a sensitive output",
330+
"sensitive" true
331+
}
332+
}
333+
}
334+
```
335+
336+
This format is adapted from how ARM template deployments report outputs of a deployment, along with a property of *sensitive*. The *sensitive* property is optional, but restricts viewing the output to users with privileged access, such as the creator of the environment.
337+
338+
Acceptable types for outputs are "string", "int", "boolean", "array", and "object".
339+
340+
### How to Access Outputs
341+
342+
To access outputs either while within the container or post-execution, a customer can use the Outputs API for ADE, accessible either by calling the API endpoint or using the AZ CLI.
343+
344+
In order to access the outputs within the container, a customer needs to install the Azure CLI to their image (preinstalled on ADE-authored images), and run the following commands:
345+
```
346+
az login
347+
az devcenter dev environment show-outputs --dev-center-name DEV_CENTER_NAME --project-name PROJECT_NAME --environment-name ENVIRONMENT_NAME
348+
```
349+
350+
## Support
351+
352+
[File an issue.](https://github.com/Azure/deployment-environments/issues)
353+
354+
[Documentation about ADE](/azure/deployment-environments/)
355+
356+
## Related content
357+
- [Configure a container image to execute deployments](https://aka.ms/deployment-environments/container-image-generic)

articles/deployment-environments/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ items:
107107
- name: ADE CLI variables
108108
href: reference-deployment-environment-variables.md
109109
- name: Install Azure CLI extension
110-
href: how-to-install-devcenter-cli-extension.md
110+
href: how-to-install-devcenter-cli-extension.md
111+
- name: ADE CLI reference
112+
href: reference-deployment-environment-cli.md
111113
- name: Azure CLI - devcenter
112114
href: https://aka.ms/CLI-reference
113115
- name: REST API

0 commit comments

Comments
 (0)