Skip to content

Commit 1d2687b

Browse files
bbrandtBen Brandt
andauthored
Set the current user as the owner of the SP (#29)
* This allows the service principal to be managed by a user well less privileges. Co-authored-by: Ben Brandt <[email protected]>
1 parent 8292e48 commit 1d2687b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

azure/terraform/infra/credentials.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
data "azuread_client_config" "current" {}
2+
13
# Add an application, a service principal, and a password for the service principal
24
# This single service principal have access to:
35
# - Metaflow's storage container
@@ -6,10 +8,12 @@
68
# E.g. an end user needs to be able to access Metaflow storage AND submit jobs to AKS (possibly)
79
resource "azuread_application" "service_principal_application" {
810
display_name = var.service_principal_name
11+
owners = [data.azuread_client_config.current.object_id]
912
}
1013

1114
resource "azuread_service_principal" "service_principal" {
1215
application_id = azuread_application.service_principal_application.application_id
16+
owners = [data.azuread_client_config.current.object_id]
1317
}
1418

1519
# This will be used as a AZURE_CLIENT_SECRET in Metaflow's AKS workloads

0 commit comments

Comments
 (0)