-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rbac): key vault data plane access example
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# RBAC Example for Key Vault | ||
# -------------------------- | ||
# Key Vault access is managed on the data plane | ||
# Instead of applying role assignments, we apply key | ||
# vault access policies. | ||
# | ||
# In this demo's organization, only admins have access to | ||
# destructive functionality. | ||
|
||
resource "azurerm_key_vault_access_policy" "team_group" { | ||
key_vault_id = azurerm_key_vault.kv.id | ||
object_id = var.team_group_id | ||
tenant_id = local.client_tenant_id | ||
|
||
secret_permissions = [ | ||
"backup", | ||
# "delete", # Admins-only | ||
"get", | ||
"list", | ||
# "purge", # Admins-only | ||
# "recover", # Admins-only | ||
"restore", | ||
"set" | ||
] | ||
} | ||
|
||
resource "azurerm_key_vault_access_policy" "admins_group" { | ||
key_vault_id = azurerm_key_vault.kv.id | ||
object_id = var.admin_group_id | ||
tenant_id = local.client_tenant_id | ||
|
||
secret_permissions = [ | ||
"backup", | ||
"delete", | ||
"get", | ||
"list", | ||
"purge", | ||
"recover", | ||
"restore", | ||
"set" | ||
] | ||
} | ||
|
||
# Important Footnotes | ||
# | ||
# - For brevity, this demo only applies permissions to secrets. | ||
# In real life, you will want to do the same for certificates | ||
# and keys. | ||
# | ||
# - In real life, you probably want to give developers admin | ||
# access to the key vault in their development environment. | ||
# | ||
# - As of Oct 2020 there is an alternate permissions model, | ||
# the RBAC Permission Model, which is in preview. For details, see: | ||
# https://docs.microsoft.com/en-us/azure/key-vault/general/rbac-guide |