Soru

Zorluk: OrtaManage Container Images in Azure Container Registry

A developer is configuring a continuous integration workflow using Azure Container Registry (ACR). The developer needs to automate container image builds whenever source code changes are pushed to a GitHub repository. The developer plans to create a task in the registry named acrtask204 to build and push the image. Which sequence of steps should the developer perform to configure, execute, and monitor the task?

  1. 1Generate a GitHub Personal Access Token (PAT) with appropriate scopes to access the repository.
  2. 2Run the `az acr task create` command, specifying the repository URL, task name, and the GitHub PAT.
  3. 3Run the `az acr task run` command to manually trigger the build task for the first time.
  4. 4Run the `az acr task logs` command to stream the build logs and monitor the progress.

Cevap

The correct sequence of steps is: first generate a GitHub Personal Access Token (PAT); second, create the task using the `az acr task create` command; third, trigger the task manually using the `az acr task run` command; and finally, view the build logs using the `az acr task logs` command.
The correct sequence starts with generating a GitHub Personal Access Token (PAT) because authentication credentials must exist before creating the task. Next, the task is created using the `az acr task create` command to specify the repository and credentials. Once defined, the task is manually triggered using `az acr task run`. Finally, the progress of the execution is monitored by streaming the build logs using the `az acr task logs` command.

Adım Adım Çözüm

1
Generate a GitHub Personal Access Token (PAT)
A token that grants Azure Container Registry access to the GitHub repository.
Azure Container Registry requires authentication credentials to clone the code from the GitHub repository.
2
Create the ACR Task using the Azure CLI
A task resource named `acrtask204` is registered in Azure Container Registry.
The task must be defined in ACR with the repository path, image name, and authentication token before it can be triggered.
3
Trigger the task manually using `az acr task run`
The build task starts executing in ACR.
To test the task configuration and build the image immediately, the task must be manually run.
4
Retrieve and stream the logs using `az acr task logs`
The console displays the build steps, Docker commands, and completion status of the task.
Streaming the logs allows the developer to verify if the container image builds and pushes successfully.

Anahtar Kavram

Automating container builds and image management using Azure Container Registry (ACR) Tasks with source code triggers.
Tahmini Süre:2m 0s
Bu soruyu puanla