DP-300 · Question #51
DP-300 Question #51: Real Exam Question with Answer & Explanation
Azure SQL Dynamic Data Masking — Partial Mask Explanation Background: The partial() Masking Function Azure SQL's partial() masking function has three parameters: `` partial(exposed_prefix, padding_string, exposed_suffix) ` | Parameter | Meaning | |---|---| | exposed_prefix | #
Question
Hotspot Question You have an Azure SQL database that contains a table named Customer. Customer has the columns shown in the following table. You plan to implement a dynamic data mask for the Customer_Phone column. The mask must meet the following requirements: - The first six numerals of each customer's phone number must be masked. - The last four digits of each customer's phone number must be visible. - Hyphens must be preserved and displayed. How should you configure the dynamic data mask? To answer, select the appropriate options in the answer area. Answer:
Explanation
Azure SQL Dynamic Data Masking — Partial Mask Explanation
Background: The partial() Masking Function
Azure SQL's partial() masking function has three parameters:
partial(exposed_prefix, padding_string, exposed_suffix)
| Parameter | Meaning |
|---|---|
exposed_prefix | # of chars to show from the left (unmasked) |
padding_string | Fixed string displayed in the middle (replaces masked content) |
exposed_suffix | # of chars to show from the right (unmasked) |
Assume the phone format is 123-456-7890 (12 characters total).
Statement 1 — Exposed Prefix of 0 → Yes
The requirement says the first six numerals must be masked — nothing from the left should be visible. Setting prefix = 0 ensures zero characters are exposed from the start of the string. If prefix were 1 or more, digits would leak from the left.
Statement 2 — Padding String of 'xxx-xxxx' → Yes
The padding string is the literal replacement shown in the middle. Using xxx-xxxx accomplishes two things:
xxxmasks the first three digits-preserves the first hyphen (a literal character in the padding)xxxxmasks the next four digits
Result: xxx-xxxx-7890 — hyphens visible, first 6 numerals hidden.
Statement 3 — Exposed Suffix of 5 → Yes
The requirement is to show the last four digits plus preserve the hyphen before them. The rightmost 5 characters of 123-456-7890 are -7890. Setting suffix = 5 exposes exactly that: the separating hyphen + 4 digits.
If suffix were 4, only 7890 would show — the hyphen would be lost.
Final Masked Output
partial(0, 'xxx-xxxx', 5)
123-456-7890 → xxx-xxxx-7890
Memory Tip
"Prefix/Suffix count characters, not digits." The hyphen counts as a character in the suffix. Always count from the raw string, not just the numerals, when setting prefix/suffix values.
Topics
Community Discussion
No community discussion yet for this question.