File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,17 +45,16 @@ pctasks:
4545 run :
4646 task_runner_type : " batch"
4747 streaming_task_namespace : " pc"
48- streaming_task_node_group : {{ tf.aks_streaming_task_node_group_name }}
4948 task_poll_seconds : 30
5049
5150 notifications :
5251 queue_name : " notifications"
53- connection_string : {{ tf.sa_connection_string }}
52+ connection_string : " NOT_USED "
5453
5554 tables :
5655 account_url : {{ tf.sa_tables_account_url }}
5756 account_name : {{ tf.sa_account_name }}
58- connection_string : {{ tf.sa_connection_string }}
57+ connection_string : " NOT_USED "
5958 image_key_table_name : " imagekeys"
6059
6160 blob :
@@ -82,7 +81,7 @@ pctasks:
8281 batch :
8382 enabled : true
8483 url : " {{ tf.batch_url }}"
85- key : " {{ tf.batch_key }} "
84+ key : " NOT_USED "
8685 default_pool_id : " {{ tf.batch_default_pool_id }}"
8786 submit_threads : 0
8887
Original file line number Diff line number Diff line change @@ -12,9 +12,18 @@ resource "azurerm_batch_account" "pctasks" {
1212 name = local. nodash_prefix
1313 resource_group_name = azurerm_resource_group. pctasks . name
1414 location = azurerm_resource_group. pctasks . location
15- pool_allocation_mode = " BatchService "
15+ pool_allocation_mode = " UserSubscription "
1616 storage_account_id = azurerm_storage_account. pctasks-batch . id
17- storage_account_authentication_mode = " StorageKeys"
17+ storage_account_authentication_mode = " BatchAccountManagedIdentity"
18+ allowed_authentication_modes = [" AAD" ]
19+ key_vault_reference {
20+ id = data. azurerm_key_vault . pctasks . id
21+ url = data. azurerm_key_vault . pctasks . vault_uri
22+ }
23+
24+ identity {
25+ type = " SystemAssigned"
26+ }
1827
1928 tags = {
2029 ManagedBy = " AI4E"
@@ -53,3 +62,10 @@ resource "azurerm_role_assignment" "batch-tasks-blob-storage-contributor" {
5362 " /subscriptions/1b045d0d-e560-456a-952d-7514f87f1b1f" , # NOAA Data Project
5463 ])
5564}
65+
66+ # Allow workflow identity to submit and manage Batch jobs
67+ resource "azurerm_role_assignment" "workflows-batch-contributor" {
68+ role_definition_name = " Azure Batch Job Submitter"
69+ principal_id = azurerm_user_assigned_identity. workflows . principal_id
70+ scope = azurerm_batch_account. pctasks . id
71+ }
Original file line number Diff line number Diff line change @@ -9,6 +9,17 @@ resource "azurerm_role_assignment" "functions-secrets-user" {
99 scope = data. azurerm_key_vault . pctasks . id
1010}
1111
12+ # Required for Batch UserSubscription mode
13+ data "azuread_service_principal" "batch" {
14+ display_name = " Microsoft Azure Batch"
15+ }
16+
17+ resource "azurerm_role_assignment" "batch-keyvault-secrets-officer" {
18+ role_definition_name = " Key Vault Secrets Officer"
19+ principal_id = data. azuread_service_principal . batch . object_id
20+ scope = data. azurerm_key_vault . pctasks . id
21+ }
22+
1223# Store database information as a secret
1324
1425resource "azurerm_key_vault_secret" "pgstac-connection-string" {
@@ -18,8 +29,8 @@ resource "azurerm_key_vault_secret" "pgstac-connection-string" {
1829}
1930
2031resource "azurerm_key_vault_secret" "task-application-insights-connection-string" {
21- name = " task-application-insights-connection-string"
22- value = azurerm_application_insights. pctasks . connection_string
32+ name = " task-application-insights-connection-string"
33+ value = azurerm_application_insights. pctasks . connection_string
2334 key_vault_id = data. azurerm_key_vault . pctasks . id
2435}
2536
Original file line number Diff line number Diff line change @@ -86,10 +86,6 @@ output "batch_url" {
8686 value = " https://${ azurerm_batch_account . pctasks . account_endpoint } "
8787}
8888
89- output "batch_key" {
90- value = azurerm_batch_account. pctasks . primary_access_key
91- }
92-
9389output "batch_default_pool_id" {
9490 value = var. batch_default_pool_id
9591}
@@ -134,10 +130,6 @@ output "sa_account_name" {
134130 value = azurerm_storage_account. pctasks . name
135131}
136132
137- output "sa_connection_string" {
138- value = azurerm_storage_account. pctasks . primary_connection_string
139- }
140-
141133# # Keyvault
142134
143135output "keyvault_url" {
You can’t perform that action at this time.
0 commit comments