A Successful ARM Create Can Precede Data-Plane Access
An apply is a management-plane transaction. Azure Resource Manager validates the resource provider, the schema and the caller's management role, writes the resource and returns success. Nothing in that transaction asks the data plane whether a secret read would return a value.
Three readiness clocks start together and finish apart. The resource exists when ARM commits it, the grant is effective when the data plane next evaluates a token, and the name resolves when the linked zone answers the runner's resolver. An apply that returns in ninety seconds can leave two of the three unfinished.
Three clocks, one apply
The resource exists when ARM commits, the grant is effective when the data plane next evaluates a token, and the name resolves when the linked zone answers. A successful apply fixes none of the last two, so test them separately.
The provider is the first data-plane client, not the last. With storage_use_azuread set, container and blob resources read through the blob endpoint, and every Key Vault secret or certificate resource is a data-plane call by definition. A refresh can therefore fail on permissions before Terraform proposes a change.
A plan that only reads still needs the data plane. Refresh re-reads every object already in state, so a no-change plan run as the pipeline identity is a genuine authorization test. When it passes, that identity can read; when it fails, the defect arrived before the apply did.
The two planes close independently. Disabling public network access on a vault stops data-plane requests while ARM keeps creating resources and writing role assignments. Storage behaves the same way: the account stays manageable while blob, queue and table traffic is refused.
This release renamed the vault switch rather than deprecating it. In Terraform 1.17.1 with hashicorp/azurerm 5.13.0, Key Vault takes rbac_authorization_enabled, which is required, and the older enable_rbac_authorization was removed in 5.0. A configuration copied from a 4.x example fails validation instead of quietly meaning something else.
The public switch is spelled differently per resource. The storage account uses public_network_access with three accepted values, while the vault keeps a boolean public_network_access_enabled. That asymmetry is worth learning once: a wrong argument name is the cheapest failure you will ever get.
Dependency order is not propagation order. Terraform serialises creation; it cannot encode "wait until the data plane agrees". A depends_on edge orders two resources in a graph and promises nothing about a cache, a resolver or a token.
The private endpoint is an ARM object with a network consequence. Creating it is a control-plane write; reaching it is a data-plane path that depends on a subnet, a route, a firewall decision and a name. The resource can be perfectly healthy while the path does not exist.
Figure 1 places creation, authorization and name resolution on separate clocks and shows what each unfinished clock looks like from the client.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','signalColor':'#5a6e82','noteBkgColor':'#c4873b','noteTextColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
START["terraform apply"] --> ARM["ARM accepts the resource
201 Created"]
ARM --> RBAC["Role assignment written
scope and condition stored"]
ARM --> NIC["Private endpoint NIC
address allocated"]
RBAC --> TOKEN{"Token reissued
since the write?"}
NIC --> LINK{"Zone linked to the
runner VNet?"}
TOKEN -->|"no"| STALE["Stale group claims
403 despite the role"]
TOKEN -->|"yes"| AUTH{"Role, scope and
condition all match?"}
LINK -->|"no"| PUBLIC["Public answer
public endpoint closed"]
LINK -->|"yes"| PRIVATE["Endpoint address
returned"]
AUTH -->|"no"| DENY["403
AuthorizationPermissionMismatch"]
AUTH -->|"yes"| OK["Data-plane request
200"]
PUBLIC --> NETFAIL["403 or timeout
no role will fix it"]
PRIVATE --> OK
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class START,ARM,AUTH primary;
class RBAC,NIC,TOKEN,LINK,PRIVATE secondary;
class OK,PUBLIC ok;
class STALE,DENY,NETFAIL danger;
Figure 2 turns the same three clocks into a readiness board, because a status page is easier to argue with than a paragraph.
Read the board as three questions, not one status. Does the resource exist, does the caller's token carry the grant, and does the name reach the private address? Only the third question is answered by DNS, and only the second by RBAC.
Trace the Real Runner Through DNS and Private Endpoints
The runner is part of the topology, and it is usually the wrong part. A hosted CI agent sits outside every VNet you built, so it can create a private endpoint it will never reach. The only honest test runs from a NIC that inherits the subnet's route table, firewall rules and resolver.
Resolution happens before a single byte of the request. The client asks for the account's public host name, receives a CNAME into the privatelink namespace, and asks again. Only a zone linked to the client's own network answers that second question with the endpoint address.
A zone is three objects and one link. The zone owns the namespace, the virtual network link makes it answer for a given VNet, and the record maps the resource name to the NIC address. A zone without a link is invisible, and a link without a record answers nothing.
Let the zone group write the record. The endpoint's private_dns_zone_group block creates and owns the A record for the life of the endpoint. Write that record by hand and you have two owners of one name, which is how a stale address survives an endpoint rebuild.
Link every client VNet, not only the endpoint VNet. Resolution follows links and never follows peering. A spoke that can route to the hub still receives the public answer until the zone is linked to that spoke as well.
The private endpoint changes the address, not the name. The client still sends the public host name in SNI and in the Host header, and the certificate still matches that name. Connecting to the IP literal breaks TLS and, on storage, breaks the request signing path too.
One endpoint covers one subresource. Blob and vault are different services with different zones and different group identifiers, so an account serving files and queues needs an endpoint per subresource.
Caching outlives the record. A resolver that cached the public answer keeps returning it until the TTL expires, which is why a correct link can look broken for minutes and then heal with no configuration change.
Four symptoms, four different repairs. A private answer with a timeout is routing or filtering, a public answer with a working call is DNS, a private answer with a certificate error is the host name, and a private answer with a 403 is authorization.
Figure 3 follows the resolver first and the permission check last, because that is the order the client experiences.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','signalColor':'#5a6e82','noteBkgColor':'#c4873b','noteTextColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
Q["Client resolves
account host name"] --> C["Public DNS returns CNAME
into privatelink namespace"]
C --> L{"Zone linked to the
client VNet?"}
L -->|"no"| PUB["Public address
returned"]
L -->|"yes"| R{"A record for the
resource name?"}
R -->|"no"| NX["No answer
resolution fails"]
R -->|"yes"| IP["Endpoint address
private IP"]
IP --> P{"Route and filter
admit 443?"}
P -->|"no"| TMO["Timeout
no service error"]
P -->|"yes"| S{"SNI and Host match
the public name?"}
S -->|"no"| TLS["TLS failure
wrong address used"]
S -->|"yes"| A{"Data role at
this scope?"}
A -->|"no"| D4["403
AuthorizationPermissionMismatch"]
A -->|"yes"| OK["200
read or write"]
PUB --> PE{"Public access
disabled?"}
PE -->|"yes"| BLK["403 or refused
the design working"]
PE -->|"no"| LEAK["Served publicly
the design never applied"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class Q,C,L,R primary;
class IP,PE,A secondary;
class OK,BLK ok;
class NX,TMO,TLS,D4,PUB danger;
class LEAK warn;
Distinguish Role Assignment from Effective Access
An assignment is a stored record; a token is the evidence. ARM keeps the scope, the role definition, the principal and any optional condition. The data plane evaluates the access token attached to the request, whose group claims were frozen when that token was issued.
That freeze explains most "the role is there" tickets. Adding a principal to a group applies on the next token, not the next second. A long-lived session can carry stale claims for the token's full lifetime.
Scope sets reach and never sets sufficiency. A blob data role at account scope covers every container, the same role at container scope covers one. A management role at the same scope contributes no data action whatsoever.
The two vault authorization models are mutually exclusive. With rbac_authorization_enabled set to true, access policies are not consulted at all. A vault migrated with policies intact looks configured and refuses everyone those policies were meant to admit.
Key Vault Reader is metadata, not content. It lists the vault and describes its objects; reading a secret value needs a role that carries the secret read action. Granting Reader and expecting a secret back is the most common misreading of the built-in role list.
An ABAC condition can only narrow a grant. A condition on container name or blob prefix, paired with condition_version 2.0, turns one assignment into a scoped one. A condition that never evaluates true produces a listed assignment and a hard deny, with no warning at plan time.
Eligible is not active. A PIM-eligible assignment appears in the role list and grants nothing until it is activated. An access review that counts assignments therefore overstates access by exactly the eligible ones.
Two layers sit above every allow. A deny assignment outranks any role assignment, and a token that drops group claims cannot satisfy a group-based grant even when the membership is correct.
Overgrown group membership fails quietly. When a principal belongs to too many groups, the token omits them and expects the service to resolve membership separately. A group-based grant that worked for a small team can stop applying the month the team grows.
Propagation has a shape you can measure. Assignments usually appear within minutes, and the right response is a bounded retry with a deadline rather than a fixed sleep. When the deadline passes, the deadline is the evidence that something other than latency is wrong.
Built-in role names are display names. The provider resolves a name to a definition at apply time, so a custom role that shares a display name with a built-in one is not the role you reviewed. Pin the definition ID wherever the role is load-bearing.
Test with the principal, not with yourself. A successful read as an owner proves the network and nothing about the workload identity. The check has to use the same principal, the same token acquisition path and the same network position as production.
Figure 4 shows the five gates a request passes before a role assignment becomes an allowed call.
Read the right column as a diagnosis list. Each failure has a different owner, a different log and a different fix, and only the second and fourth are ever repaired by touching a role assignment.
Handle Storage and Key Vault Errors as Evidence
A 403 is a family, not a diagnosis. Storage separates a data-role failure from a network refusal with a machine-readable code, and Key Vault does the same. The message is prose written for a human; the code is the part you can branch on.
AuthorizationPermissionMismatch is the RBAC code. Storage returns it when the token is valid and the identity lacks the data action at that scope. Treat it as proof that DNS, routing and TLS all worked, because the service had to receive the request in order to reject it on authorization.
A bare refusal usually means the request never reached the data plane. When public access is disabled and the client resolved the public name, the call is stopped at the edge. No role change repairs that, and adding one hides the real defect for a week.
Key Vault names its refusals too. ForbiddenByFirewall points at the vault's network rules, while an RBAC refusal names the missing data action in its message body. The pair tells you which of two independent systems said no.
A 401 is about the token, not the role. An audience mismatch, an expired credential or a token from the wrong tenant fails before any authorization lookup runs. A token minted for the management plane will never read a secret.
Turning off Shared Key changes which error appears. The account stops accepting key-signed requests and says so, which is a configuration refusal rather than a permission one. A connection string that worked last week fails with no RBAC change at all.
The request ID is the join key. The client log, the service log and a support case are only connected by the correlation identifier returned in the error. Record it with the timestamp, status and host name, and the transcript becomes evidence rather than a screenshot.
Sanitize before the transcript leaves the machine. Drop the authorization header, the SAS signature fields, connection strings and secret values. Keep the status, the error code, the request ID, the host name, the resolved address and the audience host.
One variable per attempt. Change the role, the scope, the condition or the network rule, never two together, or the next success cannot be attributed. The same discipline applies to the DNS link, which is the fastest reversible variable in the system.
Probe with a read that changes nothing. A container list or a secret metadata read is repeatable and leaves no state behind. A write mixes the authorization question with a data question that is harder to unwind.
Figure 5 groups the three refusal families by what each one proves.
Read the middle column before widening anything. A firewall refusal is the one case where adding a permission feels like progress and guarantees a second incident, because the grant is unused and the path stays closed.
Prove Readiness and a Safe Failure Recovery
Readiness is a recorded test, not an elapsed time. A check that runs with the runtime identity, through the runtime path, and stores its result can be reviewed later. A sleep records only that the pipeline was patient.
Four proofs cover the system. The name resolves to the endpoint address, the route and filter admit the port, the identity is allowed the action, and an unauthorized caller is refused. The fourth proof is the one that shows the first three are actually in force.
Order the changes so a failure stays recoverable. Create with public access enabled and a narrow firewall, add the endpoint, the zone and the link, prove resolution and a read from the runner, then close public access and prove the outside refusal.
The management plane is the way back. Closing public access closes the data plane and leaves ARM open, so a privileged operator can re-enable it with the same root or a reviewed CLI change. That is the recovery boundary, and a policy that denies the change removes it.
Rehearse the DNS failure while it is cheap. Unlink the zone, resolve again, confirm the public answer returns, then relink. It is reversible in one apply, and it proves that the name, not the endpoint, is what steers the client.
Terraform cannot wait for what it cannot see. The provider has no signal for "the data plane agrees", so the wait belongs in your test rather than in a sleep resource. A sleep that happens to be long enough today is a timeout that fails under load tomorrow.
Record what remains assumed. Token lifetime, resolver TTL, group membership source, policy exemptions and the single subnet you tested from are all assumptions. A readiness claim that hides them is a claim about one machine at one moment.
Prove Readiness and a Safe Failure Recovery
Execution status: design-only. These steps were not run against a live subscription, and no timing below is a measurement. Use a disposable resource group and keep every command's output as evidence.
Prerequisites. Terraform 1.17.1 with hashicorp/azurerm 5.13.0, a subscription where you can create role assignments, a storage account and a Key Vault, a runner inside a spoke subnet with its own route table and resolver, and a second principal that must be refused.
- Create the account and the vault with public access still enabled and a firewall that admits only the runner's subnet. Confirm the apply succeeds and that the account and vault exist through ARM.
- Create the private endpoint for the blob subresource and the vault subresource, each with a private DNS zone group, and link both zones to the runner's VNet.
- Resolve the account host and the vault host from the runner. Both answers must be the endpoint addresses; record the addresses and the time of the query.
- Read the effective routes on the runner NIC and confirm that the endpoint subnet prefix wins over any broader route. A route table entry that loses longest-prefix selection is invisible here.
- Assign the workload identity the blob data role at container scope and the vault secret role at vault scope. Do not touch public access yet.
- Read one blob and one secret as that identity. If either fails, read the error code before changing anything, then retry once with a freshly issued token.
- Disable public access on both resources, then repeat both reads from outside the VNet. Expect a refusal rather than a timeout, and record which code arrives.
- Unlink the blob zone, resolve again from the runner, confirm the public answer, then relink and confirm the private answer returns.
| Check | Method | Pass condition | Failure signal |
|---|---|---|---|
| Control plane | Apply, then read both resources through ARM | Both exist with the intended settings | Apply failed, so later steps prove nothing |
| Resolution | Resolve both hosts from the runner | Answers equal the endpoint addresses | Public answer, so the zone is not linked |
| Route | Effective routes on the runner NIC | Endpoint prefix wins | A broader route wins, or a None route appears |
| Authorization | Read one object as the workload identity | Success against the private address | 403 with a data-role code, so check scope first |
| Denial | Read from outside after public access is closed | Refusal with a network code | Success, so the public path is still open |
| Recovery | Unlink the zone, resolve, relink | Public answer, then the private answer again | No change, so another zone is answering |
Expected observation. The apply finishes long before the reads succeed, the first read as the workload identity is the step most likely to fail, and the failure is a code rather than a timeout. After the zone is relinked the same command succeeds with no other change, which is the proof that the name was the only variable.
Failure checks. The lab fails if a clean apply is treated as readiness, if a timeout is answered with a role change, if the outside read succeeds after public access is closed, or if the only artifact is a terminal transcript with a token in it. It also fails if the runner used for the test is a hosted agent outside the VNet.
Cost and cleanup. Two private endpoints, two zones and their links, and a small runner bill by the hour; retained blob versions and a soft-deleted vault outlive the resources that created them. Destroy the workload root, then the network root, and confirm that no endpoint NIC, zone link or DNS record remains.
Evidence to keep. The apply output, both resolved addresses with timestamps, the effective route list, one allowed and one refused response with their error codes and request IDs, and the state list after destroy.
References (checked 6 November 2026): role assignment, Key Vault, private endpoint, and private endpoint DNS.
The closing rule is the one that survives a version bump. A resource exists when ARM says so, a caller is allowed when the data plane says so, and a name resolves when the linked zone says so. Only a test that asks all three, as the runtime identity, turns three green lights into one honest answer.