-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Remove Application creation; 2. Re-use given application account; 3. Re-design to work with docker.
- Loading branch information
Showing
7 changed files
with
56 additions
and
66 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
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
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
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,12 @@ | ||
{ | ||
"clientId": "${client_id}", | ||
"clientSecret": "${client_secret}", | ||
"subscriptionId": "${subscription_id}", | ||
"tenantId": "${tenant_id}", | ||
"activeDirectoryEndpointUrl": "https://login.microsoftonline.com", | ||
"resourceManagerEndpointUrl": "https://management.azure.com/", | ||
"activeDirectoryGraphResourceId": "https://graph.windows.net/", | ||
"sqlManagementEndpointUrl": "https://management.core.windows.net:8443/", | ||
"galleryEndpointUrl": "https://gallery.azure.com/", | ||
"managementEndpointUrl": "https://management.core.windows.net/" | ||
} |
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 |
---|---|---|
@@ -1,60 +1,10 @@ | ||
# Import subscription data | ||
data "azurerm_subscription" "main" { | ||
} | ||
data "azurerm_client_config" "current" { | ||
} | ||
|
||
# Create Azure AD App random name | ||
|
||
resource "random_id" "main" { | ||
byte_length = 8 | ||
prefix = "kerberus-" | ||
} | ||
|
||
# Create Azure AD App | ||
resource "azuread_application" "main" { | ||
display_name = random_id.main.hex | ||
required_resource_access { | ||
resource_app_id = var.azure_app_id | ||
|
||
resource_access { | ||
id = "1cda74f2-2616-4834-b122-5cb1b07f8a59" | ||
type = "Role" | ||
} | ||
resource_access { | ||
id = "78c8a3c8-a07e-4b9e-af1b-b5ccab50a175" | ||
type = "Role" | ||
} | ||
data "azurerm_client_config" "current" {} | ||
|
||
} | ||
|
||
} | ||
|
||
# Create Service Principal associated with the Azure AD App | ||
resource "azuread_service_principal" "main" { | ||
application_id = azuread_application.main.application_id | ||
data "azuread_application" "current" { | ||
application_id = data.azurerm_client_config.current.client_id | ||
} | ||
|
||
# Create Service Principal password | ||
resource "azuread_service_principal_password" "main" { | ||
service_principal_id = azuread_service_principal.main.id | ||
# value = "${random_string.password.result}" | ||
end_date_relative = "17520h" | ||
} | ||
|
||
# Create App password | ||
resource "azuread_application_password" "main" { | ||
application_object_id = azuread_application.main.object_id | ||
# value = "${random_string.password.result}" | ||
end_date_relative = "8760h" | ||
} | ||
|
||
# Create role assignment for service principal | ||
resource "azurerm_role_assignment" "main" { | ||
scope = data.azurerm_subscription.main.id | ||
role_definition_name = "Owner" | ||
principal_id = azuread_service_principal.main.id | ||
provisioner "local-exec" { | ||
command = "az ad app permission admin-consent --id ${azuread_application.main.application_id}" | ||
} | ||
application_object_id = data.azuread_application.current.object_id | ||
end_date_relative = "8760h" | ||
} |
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
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