AZ-204: Developer Associate Flashcards
Exam question prep
You need to deploy a containerized application to Azure. The application consists of multiple containers that need to communicate with each other. Which Azure service should you use?
A. Azure Container Instances (ACI)
B. Azure App Service
C. Azure Kubernetes Service (AKS)
D. Azure Functions
Answer: C. Azure Kubernetes Service (AKS)
Explanation: Azure Kubernetes Service (AKS) is designed for deploying, managing, and scaling containerized applications using Kubernetes. It’s ideal for multi-container applications that need container orchestration, scaling, and communication between containers.
You are developing an application that processes images uploaded by users. The processing is triggered by new uploads to a blob storage container. Which Azure service should you use to implement this event-driven processing?
A. Azure Logic Apps
B. Azure Functions
C. Azure Service Bus
D. Azure Event Grid
Answer: B. Azure Functions
Explanation: Azure Functions is ideal for this scenario as it provides serverless compute with native triggers for blob storage events. When a new image is uploaded to the blob container, an Azure Function can be automatically triggered to process the image.
You are developing an Azure Function App with multiple functions that share code. What is the best way to share code between these functions?
A. Use Azure DevOps Artifacts to manage shared libraries
B. Create a separate function for shared code and call it from other functions
C. Use shared code files in a common directory within the Function App
D. Store shared code in Azure Blob Storage and download it when needed
Answer: C. Use shared code files in a common directory within the Function App
Explanation: Azure Functions supports sharing code through common files placed in directories such as a ‘shared’ folder within the Function App. Functions within the same Function App can reference and use this code.
You are deploying a web application to Azure App Service. The application needs to automatically scale based on CPU usage. Which feature should you configure?
A. Deployment slots
B. Auto-scaling
C. Always On
D. Application Insights
Answer: B. Auto-scaling
Explanation: Auto-scaling in Azure App Service allows you to automatically adjust the number of instances based on metrics like CPU usage. Deployment slots are for staging environments, Always On prevents the app from being unloaded due to inactivity, and Application Insights is for monitoring and diagnostics.
You need to implement a microservice architecture where services communicate asynchronously. Which Azure service is most appropriate for this communication pattern?
A. Azure Storage Queues
B. Azure Redis Cache
C. Azure Service Bus
D. Azure API Management
Answer: C. Azure Service Bus
Explanation: Azure Service Bus is designed for enterprise messaging scenarios and supports asynchronous communication between microservices with features like message sessions, transactions, duplicate detection, and FIFO guarantees.
You are developing a containerized application and need to store container images securely. Which Azure service should you use?
A. Azure Blob Storage
B. Azure Container Registry (ACR)
C. Azure Kubernetes Service (AKS)
D. Azure DevOps Artifacts
Answer: B. Azure Container Registry (ACR)
Explanation: Azure Container Registry is specifically designed for storing and managing container images with features like geo-replication, image scanning, and integration with Azure security features.
Your company has a web application hosted in Azure App Service. You need to implement a staging environment for testing before deploying to production. Which App Service feature should you use?
A. Deployment slots
B. App Service Environment
C. Azure DevOps Pipelines
D. Scale-out
Answer: A. Deployment slots
Explanation: Deployment slots in Azure App Service provide a staging environment for your web app. You can deploy changes to a slot, test them, and then swap the slot with production, minimizing downtime and risk.
You are developing a .NET application that will be deployed to Azure App Service. The application needs to run a background task that performs data processing. How should you implement this background task?
A. Use Azure Functions with a Timer trigger
B. Implement IHostedService in the application
C. Use WebJobs SDK
D. Any of the above, depending on specific requirements
Answer: D. Any of the above, depending on specific requirements
Explanation: All three options are valid ways to implement background processing in Azure. Azure Functions with a Timer trigger is good for serverless scenarios, IHostedService is a native .NET Core way to implement background tasks within the web app process, and WebJobs provide a way to run background tasks in the same context as the App Service.
You are developing an Azure Function that will be triggered when a message appears in an Azure Service Bus queue. The function should process the message and then create an entry in Azure Cosmos DB. What is the recommended way to handle a Cosmos DB failure in the function?
A. Let the function fail and rely on Azure Functions’ automatic retry for Service Bus triggers
B. Implement a try-catch block and ignore the error
C. Implement a custom retry policy using Polly
D. Use Azure Logic Apps instead of Functions
Answer: A. Let the function fail and rely on Azure Functions’ automatic retry for Service Bus triggers
Explanation: Azure Functions with Service Bus triggers have built-in retry mechanisms. If the function fails (e.g., due to a Cosmos DB error), the Service Bus message won’t be removed from the queue and will be available for reprocessing based on the queue’s retry policy.
You are developing a new API using Azure Functions. You need to ensure that the API can be managed and secured properly. Which service should you use?
A. Azure Front Door
B. Azure API Management
C. Azure Application Gateway
D. Azure Traffic Manager
Answer: B. Azure API Management
Explanation: Azure API Management is designed for managing APIs, providing features like security, rate limiting, quotas, analytics, and developer portal.
You need to deploy a Docker container to Azure with minimal management overhead. The container doesn’t need to scale out to multiple instances. Which service should you use?
A. Azure Kubernetes Service (AKS)
B. Azure Container Instances (ACI)
C. Azure App Service with container support
D. Azure Container Registry (ACR)
Answer: B. Azure Container Instances (ACI)
Explanation: Azure Container Instances provides the simplest way to run a container in Azure without having to manage virtual machines or adopt a higher-level service. ACI is ideal for simple applications, batch jobs, or task automation.
You are deploying a CPU-intensive application to Azure App Service. You want to ensure the application has enough resources during peak usage times. Which action should you take?
A. Implement connection pooling
B. Scale up to a higher pricing tier
C. Enable auto-scaling
D. Enable local cache
Answer: B. Scale up to a higher pricing tier
Explanation: Scaling up (vertical scaling) to a higher pricing tier provides more CPU, memory, and disk resources per instance, which is beneficial for CPU-intensive applications.
You are developing a new API with Azure Functions and need to allow cross-origin resource sharing (CORS). Where should you configure CORS settings?
A. In the function code using response headers
B. In the Azure portal under Function App CORS settings
C. In the host.json file
D. In the function.json file
Answer: B. In the Azure portal under Function App CORS settings
Explanation: For Azure Functions, CORS can be configured at the Function App level in the Azure portal under the ‘CORS’ section of the Function App settings. This is the recommended approach for enabling cross-origin requests to your function API.
You need to implement a solution that runs a container whenever a new message is received in an Azure Storage Queue. The solution should minimize management overhead. What should you use?
A. Azure Container Instances with Event Grid
B. Azure Kubernetes Service with KEDA
C. Azure Functions with a Docker container
D. Azure Logic Apps with a container action
Answer: C. Azure Functions with a Docker container
Explanation: Azure Functions supports custom containers and provides native triggers for Azure Storage Queues. By using a container-based Azure Function with a Queue trigger, you get serverless scaling with minimal management overhead.
You have a web application that needs to process background tasks. The tasks are CPU-intensive and can take up to 10 minutes to complete. Which Azure service is best suited for these background tasks?
A. Azure Functions on Consumption Plan
B. Azure Functions on Premium Plan
C. Azure Logic Apps
D. Azure App Service WebJobs
Answer: B. Azure Functions on Premium Plan
Explanation: Azure Functions on the Premium Plan supports longer execution times (up to 60 minutes) and provides more powerful instances for CPU-intensive workloads.
You are developing an Azure Function App that needs to connect to an on-premises SQL Server database. Which networking solution should you use?
A. Public endpoint with IP restrictions
B. VNet Integration
C. Hybrid Connections
D. VPN Gateway
Answer: C. Hybrid Connections
Explanation: Hybrid Connections is a feature of Azure App Service (including Function Apps) that enables secure communication with on-premises resources without requiring changes to your corporate network infrastructure.
You are developing an Azure Function that needs to be triggered when a new user is created in Azure Active Directory. Which trigger should you use?
A. HTTP trigger with a webhook
B. Queue trigger
C. Event Grid trigger
D. Timer trigger with Microsoft Graph API calls
Answer: C. Event Grid trigger
Explanation: Azure Active Directory can publish events to Azure Event Grid when certain directory events occur, such as when a user is created. By using an Event Grid trigger in your Azure Function, you can directly respond to these events.
You are implementing a solution that needs to run a batch process every hour. The process must be executed exactly once per hour, even if the previous run is still in progress. Which Azure service is best suited for this requirement?
A. Azure Functions with a Timer trigger
B. Azure Logic Apps with a recurrence trigger
C. Azure Batch
D. Azure Automation
Answer: D. Azure Automation
Explanation: Azure Automation with scheduled runbooks provides job scheduling with the ability to ensure that new job instances start regardless of whether previous jobs have completed.
You are developing an Azure Function that will be triggered by an HTTP request. You need to secure the function so that only authenticated users can access it. Which authentication method should you use?
A. Function Keys
B. Azure Active Directory
C. Client Certificates
D. Any of the above is valid, depending on requirements
Answer: D. Any of the above is valid, depending on requirements
Explanation: Azure Functions support multiple authentication methods, and the best choice depends on specific requirements. Function Keys provide a simple API key approach, Azure Active Directory provides identity-based auth with support for users and service principals, and Client Certificates provide certificate-based authentication.
You are developing a stateful application that will be deployed to Azure. The application needs to maintain session state across multiple instances. Which service should you use to store the session state?
A. Azure Blob Storage
B. Azure Redis Cache
C. In-memory session state with sticky sessions
D. Azure Cosmos DB
Answer: B. Azure Redis Cache
Explanation: Azure Redis Cache is specifically designed for scenarios like distributed session management. It provides high-performance, in-memory storage with features designed for session state scenarios.
You are developing an application that needs to store large amounts of unstructured data. The data will be accessed infrequently but needs to be retained for compliance reasons. Which storage tier should you use?
A. Hot
B. Cool
C. Archive
D. Premium
Answer: C. Archive
Explanation: Archive storage tier is designed for data that will be rarely accessed and stored for at least 180 days, with lower storage costs and higher retrieval costs. It’s ideal for long-term retention for compliance reasons.
You need to implement a solution that allows multiple applications to read and process messages in order. Which Azure storage service should you use?
A. Azure Table Storage
B. Azure Cosmos DB
C. Azure Queue Storage
D. Azure Blob Storage
Answer: C. Azure Queue Storage
Explanation: Azure Queue Storage provides a messaging solution for communication between application components. While basic Queue Storage doesn’t guarantee strict ordering by default, you can implement patterns to ensure ordered processing.
You need to migrate a MongoDB database to Azure with minimal code changes. Which Azure service should you use?
A. Azure SQL Database
B. Azure Database for PostgreSQL
C. Azure Cosmos DB API for MongoDB
D. Azure Table Storage
Answer: C. Azure Cosmos DB API for MongoDB
Explanation: Azure Cosmos DB API for MongoDB provides MongoDB compatibility, allowing applications to connect using the MongoDB protocol with minimal code changes.
You are developing an application that needs to read and write data to Azure Blob Storage. Which of the following is the correct approach to authenticate the application?
A. Use a connection string with Shared Key authentication
B. Use Azure Active Directory (AAD) with a Managed Identity
C. Use a SAS (Shared Access Signature) token
D. All of the above are valid approaches
Answer: D. All of the above are valid approaches
Explanation: All three authentication methods are valid depending on the scenario. Shared Key authentication uses account keys, Managed Identities provide AAD-based authentication without secrets, and SAS tokens provide limited access with specific permissions and expiration times.