Question

Difficulty: MediumConfigure Azure Container Instances (ACI)

A company requires a lightweight compute solution to run a batch utility in Azure. The utility connects to a database, processes transaction records, and then exits. If the utility encounters a database connection error during its run, it must automatically attempt to rerun. However, if the process finishes successfully, it must terminate and remain stopped until the next scheduled run. You also need to protect the database credentials used by the utility from being exposed in plain text in the deployment configuration.

Which two options should you configure for the Azure Container Instances (ACI) deployment? (Select two.)

  1. Set the restart policy of the container group to OnFailure.Answer
  2. Define the database credentials as secure environment variables.Answer
  3. C
    Set the restart policy of the container group to Always.
  4. D
    Set the restart policy of the container group to Never.
  5. E
    Deploy the container group inside an Azure Availability Set.

Answer

Configure the container group restart policy to OnFailure and pass the database credentials as secure environment variables.
Setting the container group's restart policy to OnFailure ensures that the container automatically restarts only if its execution exits with an error code, which aligns with the requirement to retry on a database connection error. Configuring credentials as secure environment variables prevents the sensitive data from being visible in clear text when querying the container group's properties or viewing it in the Azure portal.

Step-by-Step Solution

1
Determine the appropriate restart policy based on container lifecycle requirements.
The restart policy must be set to OnFailure.
Since the task needs to rerun if it fails (exit code non-zero) but must remain stopped upon successful execution (exit code zero), OnFailure is the only policy that meets these criteria.
2
Determine the secure method for passing database credentials to the container.
Configure the database connection credentials as secure environment variables.
Using secure environment variables (secureValue in ARM templates) prevents sensitive values from being returned in the container instance properties or shown in the portal.

Key Concept

Azure Container Instances (ACI) restart policies and secure environment configuration
Rate this question