AZ-204 Develop Azure compute solutions Practice Question
You need to deploy a containerized application to Azure Container Instances (ACI) with a public IP address and DNS name label. The container must restart automatically if it exits unexpectedly. Which configuration should you use?
⚠ Common exam trap
Candidates might consider 'OnFailure' for unexpected exits, which is a valid policy for that scenario. However, 'Always' also fulfills the requirement and is correctly paired with the public IP/DNS name label in option D. A common mistake is also assuming a virtual network is required for public IP assignment, when ACI assigns a public IP by default unless configured otherwise.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Set restart policy to Always and assign a DNS name label.
Setting the restart policy to Always ensures the container automatically restarts if it exits unexpectedly, which is the required behavior. Assigning a DNS name label to the container group makes it accessible via a public IP address and a fully qualified domain name (FQDN) in the format <dns-name-label>.<region>.azurecontainer.io, meeting the requirement for a public IP address and DNS name label.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Deploy the container into an Azure Virtual Network.
Why it's wrong here
While Azure Container Instances (ACI) can be deployed into an Azure Virtual Network for private networking and secure integration with other VNet resources, it is not a mandatory requirement for deploying a containerized application that needs public access. ACI containers can directly expose public IP addresses and DNS labels without VNet integration, making this an unnecessary and more complex step if public accessibility is the primary goal for the application.
- ✗
Set restart policy to Never and configure a public IP.
Why it's wrong here
A restart policy of 'Never' dictates that the container will not automatically restart after it stops, regardless of the exit code. For a continuously running application, this policy is inappropriate as any termination, even graceful, would require manual intervention to restart the service, leading to unacceptable application downtime. While configuring a public IP addresses public access, the 'Never' restart policy makes the overall solution unreliable for a production application.
- ✗
Set restart policy to OnFailure and use a private IP address.
Why it's wrong here
The 'OnFailure' restart policy only restarts the container if it exits with a non-zero status code, indicating an error. If the application exits gracefully (status code 0) but needs to be restarted for any other reason, 'OnFailure' would not trigger a restart. Furthermore, using a private IP address within a virtual network means the application would not be directly accessible from the public internet, failing to meet the implicit requirement of deploying a containerized application for general public use.
- ✓
Set restart policy to Always and assign a DNS name label.
Why this is correct
The 'Always' restart policy ensures that the container instance continuously runs, automatically restarting the container whenever it stops, regardless of the exit code. This is crucial for maintaining application availability for long-running services. Assigning a DNS name label to the public IP address provides a user-friendly, resolvable hostname (e.g., myapp.eastus.azurecontainer.io), making the containerized application easily accessible and discoverable from the internet.
Go deeper
Related to this question
About these practice questions
One of 881 original AZ-204 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.