- Best practice / security implications
Assigning the Key Vault Secrets User role at the vault level is common and works, but it’s broader than necessary. As a best practice, grant the minimum required scope. If the SPN needs access to only one secret, assign the role at that secret level, not the vault.
Giving vault-level access means the SPN can potentially list and read all secrets in the vault (depending on the role). That can increase exposure risk.
- SPN’s effective access when assigned at vault level
Even if you share only one secret name with the app team, technically:
The SPN still has access to all secrets in that vault (if its role allows it).
The app team’s code may only call the specific secret, but from an Azure access perspective, the SPN could fetch others.
- IAM under specific secret
When you open a specific secret in Key Vault → Access Control (IAM) there lets you assign roles only for that object. If you assign the Key Vault Secrets User role at the secret level, the SPN can fetch only that secret. It will not have access to other secrets or vault-level operations.
- Changing from vault-level to secret-level access
You can safely remove the SPN’s vault-level role and reassign it at the secret level. This will restrict the SPN’s access to that secret only. There is no impact on other apps unless they relied on that vault-level assignment.
- When to assign at each level
| Scope | When to use | Example |
|---|---|---|
| Vault level | SPN needs access to multiple secrets, keys, or certs in the vault | Shared infrastructure app accessing many secrets |
| Secret level | SPN needs access to only one or a few specific secrets | Application fetching a single database password |
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin