Azure Dev Boxes and Azure Key Vault: Private Connectivity for Managed Identity Secret Access After Restart
0 reputation · 09 Nov 2023, 12:56 UTC
0 reputation · 09 Nov 2023, 12:56 UTC
Repeatable developer workstation provisioning is being designed around Azure Dev Boxes placed in a custom virtual network with a private endpoint to Azure Key Vault. The goal is secret retrieval via system-assigned managed identity without public internet egress.
The integration boundary involves Dev Box VM lifecycle events such as auto-shutdown and auto-start, and the persistence of private endpoint reachability and private DNS resolution for privatelink.vaultcore.azure.net across VM deallocation and reallocation. Managed identity authorization is scoped to the Dev Box resource, not the interactive user session, and custom VNet support is region and SKU dependent.
Documentation does not clearly guarantee automatic re-establishment of private connectivity after restart or project changes, and firewall rules that block public access may affect provisioning.
Does a system-assigned managed identity retain Key Vault access over the private endpoint after an auto-shutdown/start cycle without manual intervention? Is private DNS resolution for the vault guaranteed to persist across VM deallocation and reallocation? How does Key Vault firewall configuration interact with initial Dev Box provisioning when public access is denied?
33275 reputation · 09 Nov 2023, 23:54 UTC
1. Does the system‑assigned managed identity keep Key Vault access over the private endpoint after an auto‑shutdown/start cycle without manual intervention?
Yes. The identity is tied to the Dev Box resource, not to the underlying VM. When the box is deallocated and later started, Azure re‑attaches the same identity to the new VM instance. Once the VM boots, the identity’s token endpoint (https://.privatelink.vaultcore.azure.net) is reachable via the existing private endpoint, so the identity can request a token and access the vault.
2. Is private DNS resolution for the vault guaranteed to persist across VM deallocation and reallocation?
Only if the DNS zone for privatelink.vaultcore.azure.net is linked to the VNet that hosts the Dev Box. Azure does not automatically create or link a private DNS zone when you provision a Dev Box. If the link is missing, the VM will fail to resolve the vault hostname after a restart, even though the private endpoint exists.
3. How does Key Vault firewall configuration interact with initial Dev Box provisioning when public access is denied?
If the vault’s firewall is set to “Deny all public network access”, the Dev Box must reach the vault exclusively via the private endpoint. Provisioning will fail or the VM will be unable to retrieve secrets if the vault’s subnet rule does not include the subnet that the Dev Box’s NIC belongs to. In practice, you either temporarily allow the Dev Box subnet during provisioning or ensure the private endpoint is created before the box is fully provisioned.
Confirm the identity is present before and after a restart:
az devbox list \
--query "[?name=='<devbox-name>'].identity.principalId"
Check that the private endpoint remains attached to the correct subnet:
az network private-endpoint show \
--name <pe-name> \
--resource-group <rg> \
--query "subnet.id"
Verify the DNS zone link exists:
az network private-dns zone show \
--name privatelink.vaultcore.azure.net \
--query "virtualNetworkLinks[].virtualNetwork.id"
Test secret retrieval after a restart from inside the Dev Box:
az keyvault secret show \
--name <secret-name> \
--vault-name <vault-name>
Inspect Key Vault firewall logs to confirm the request originates from the Dev Box subnet:
az monitor metrics list \
--resource <vault-id> \
--metric "SuccessfulRequests" \
--interval PT1M \
--aggregation Total \
--filter "clientSubnet eq '<devbox-subnet>'"
Ask yourself: Did you create a private DNS zone link for privatelink.vaultcore.azure.net to the Dev Box VNet? If not, link it and retry.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.