DP-420 practice question 3 of 25
You have a database in an Azure Cosmos DB Core (SQL) API account. You need to create an Azure function that will access the database to retrieve records based on a variable named accountnumber. The solution must protect against SQL injection attacks. How should you define the command statement in the function?
Full set: 144 questionsUsing parameterized queries is the recommended mitigation against SQL injection in Cosmos DB. Parameters are referenced with the @ symbol inside the query text and are supplied separately to the SDK or Azure Function binding, ensuring the input is treated strictly as data.
A. Embeds user input directly in the query string, leaving it vulnerable to injection.
B. “= LIKE @accountnumber” is syntactically invalid and still insecure.
D. String concatenation of user input bypasses parameterization and permits injection attacks.
1. Microsoft Docs – “Parameterized queries in Azure Cosmos DB SQL API”
section “Syntax” (https://learn.microsoft.com/azure/cosmos-db/sql/query-parameterized).
2. Microsoft Docs – “Azure Functions Cosmos DB binding”
subsection “Using parameters in queries” (https://learn.microsoft.com/azure/azure-functions/functions-bindings-cosmosdb-v2-output).
Keep practicing
Take the free DP-420 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DP-420 practice questions
- Question 1You have an Azure Cosmos DB for NoSQL account. You need to create an Azure Monitor query …
- Question 6You are troubleshooting the current issues caused by the application updates. Which actio…
- Question 9You have an Azure Cosmos DB Core (SQL) API account that is used by 10 web apps. You need …
- Question 12You need to create a data store for a directory of small and medium-sized businesses (SMB…
- Question 13You need to configure an Apache Kafka instance to ingest data from an Azure Cosmos DB Cor…
- Question 16You configure multi-region writes for account1. You need to ensure that App1 supports the…
