You are deploying a containerized background worker to Azure Container Instances (ACI) using a YAML template. The containerized application requires a database connection string that contains sensitive credentials. You must ensure that the connection string is passed to the container as an environment variable, but the plaintext value of the connection string must not be visible to users who run the 'az container show' command or view the container properties in the Azure portal. Which of the following configurations should you define in the YAML template to meet this requirement?
- ADefine the connection string in the container's environmentVariables array using the @Microsoft.KeyVault(SecretUri=...) reference syntax.
- BConfigure a system-assigned managed identity for the container group to authenticate with Azure Container Registry (ACR) and pull the container image containing the embedded connection string.
- Define the connection string in the container's environmentVariables array using the secureValue property.Cevap
- DEnable a system-assigned managed identity for the container group, but do not assign any access policies or RBAC roles to it on the Key Vault containing the connection string secret.
Cevap
Define the connection string in the container's environmentVariables array using the secureValue property.
The correct approach is to define the connection string using the secureValue property inside the environmentVariables list. Azure Container Instances treats secureValue objects as write-only, masking their values in the Azure Portal, CLI command output (such as 'az container show'), and resource logs, while still presenting them to the running container as standard environment variables.
Adım Adım Çözüm
Anahtar Kavram
Secure environment variables in Azure Container Instances
Tahmini Süre:1m 30s