Contoso enabled the firewall on a key vault named KV1 and allowed trusted Microsoft services to bypass it. A virtual machine in subnet Subnet1 of virtual network VNet1 has no static public IP address, and only this virtual machine must read secrets in KV1. KV1 has no private endpoints. Subnet1 contains only this virtual machine. What should you configure to keep the allowed scope as narrow as possible?
Show answer and explanation
Answer: B
Explanation
A virtual machine that can’t use a static IP address should be placed in a virtual network, and traffic from that specific virtual network and subnet should be allowed to access the key vault. You enable the Key Vault service endpoint on the subnet and add the subnet as a virtual network rule.[1]
IP network rules are only allowed for public IP addresses, and private ranges defined in RFC 1918, such as addresses that start with 10., can’t be used, so option A is wrong.[1] Option C allows all IP addresses for Azure virtual machines, which the article describes as something you may not want, and it opens access to other virtual machines as well.[1] Disabling public access allows only connections through private endpoints, and KV1 has no private endpoint, so this virtual machine couldn’t connect either.[1] So option D is also wrong.