Skip to content

Commit 59e3595

Browse files
committed
changed function app to use globally managed identity for storage
1 parent aa8d058 commit 59e3595

4 files changed

Lines changed: 34 additions & 38 deletions

File tree

application/CohortManager/src/Functions/CaasIntegration/receiveCaasFile/ProcessFileClasses/CopyFailedBatchToBlob.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public async Task<bool> writeBatchToBlob(string jsonFromBatch, InvalidOperationE
2929
{
3030
// we do this so that we do not have files with the same names either failing to be added or over writing another failed batch
3131
var blobFile = new BlobFile(stream, $"failedBatch-{Guid.NewGuid()}.json");
32-
bool copied = false;
32+
var copied = false;
3333
if (_config.caasfolder_STORAGE != null)
3434
{
3535
copied = await _blobStorageHelper.UploadFileToBlobStorage(new Uri(_config.caasfolder_STORAGE.BlobServiceUri), "failed-batch", blobFile);

infrastructure/tf-core/environments/development.tfvars

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -293,24 +293,24 @@ function_apps = {
293293
docker_CI_enable = "true"
294294
docker_img_prefix = "cohort-manager"
295295

296-
enable_appsrv_storage = "false"
297-
ftps_state = "Disabled"
298-
https_only = true
299-
http2_enabled = true
300-
remote_debugging_enabled = false
301-
worker_32bit = false
302-
health_check_path = "/api/health"
296+
enable_appsrv_storage = "false"
297+
ftps_state = "Disabled"
298+
https_only = true
299+
http2_enabled = true
300+
remote_debugging_enabled = false
301+
storage_uses_managed_identity = true
302+
worker_32bit = false
303+
health_check_path = "/api/health"
303304

304305
fa_config = {
305306

306307
ReceiveCaasFile = {
307-
name_suffix = "receive-caas-file"
308-
function_endpoint_name = "ReceiveCaasFile"
309-
app_service_plan_key = "NonScaling"
310-
db_connection_string = "DtOsDatabaseConnectionString"
311-
service_bus_connections = ["internal"]
312-
storage_account_env_var_name = "caasfolder_STORAGE"
313-
storage_uses_managed_identity = true
308+
name_suffix = "receive-caas-file"
309+
function_endpoint_name = "ReceiveCaasFile"
310+
app_service_plan_key = "NonScaling"
311+
db_connection_string = "DtOsDatabaseConnectionString"
312+
service_bus_connections = ["internal"]
313+
storage_account_env_var_name = "caasfolder_STORAGE"
314314
app_urls = [
315315
{
316316
env_var_name = "ExceptionFunctionURL"
@@ -364,12 +364,11 @@ function_apps = {
364364
}
365365

366366
RetrieveMeshFile = {
367-
name_suffix = "retrieve-mesh-file"
368-
function_endpoint_name = "RetrieveMeshFile"
369-
app_service_plan_key = "NonScaling"
370-
key_vault_url = "KeyVaultConnectionString"
371-
storage_account_env_var_name = "caasfolder_STORAGE"
372-
storage_uses_managed_identity = true
367+
name_suffix = "retrieve-mesh-file"
368+
function_endpoint_name = "RetrieveMeshFile"
369+
app_service_plan_key = "NonScaling"
370+
key_vault_url = "KeyVaultConnectionString"
371+
storage_account_env_var_name = "caasfolder_STORAGE"
373372
app_urls = [
374373
{
375374
env_var_name = "ExceptionFunctionURL"
@@ -383,13 +382,12 @@ function_apps = {
383382
}
384383

385384
ProcessNemsUpdate = {
386-
name_suffix = "process-nems-update"
387-
function_endpoint_name = "ProcessNemsUpdate"
388-
app_service_plan_key = "NonScaling"
389-
key_vault_url = "KeyVaultConnectionString"
390-
storage_account_env_var_name = "nemsmeshfolder_STORAGE"
391-
storage_uses_managed_identity = true
392-
service_bus_connections = ["internal"]
385+
name_suffix = "process-nems-update"
386+
function_endpoint_name = "ProcessNemsUpdate"
387+
app_service_plan_key = "NonScaling"
388+
key_vault_url = "KeyVaultConnectionString"
389+
storage_account_env_var_name = "nemsmeshfolder_STORAGE"
390+
service_bus_connections = ["internal"]
393391
app_urls = [
394392
{
395393
env_var_name = "ExceptionFunctionURL"
@@ -1184,12 +1182,11 @@ function_apps = {
11841182
}
11851183

11861184
NemsMeshRetrieval = {
1187-
name_suffix = "nems-mesh-retrieval"
1188-
function_endpoint_name = "NemsMeshRetrieval"
1189-
app_service_plan_key = "NonScaling"
1190-
key_vault_url = "KeyVaultConnectionString"
1191-
storage_account_env_var_name = "nemsmeshfolder_STORAGE"
1192-
storage_uses_managed_identity = true
1185+
name_suffix = "nems-mesh-retrieval"
1186+
function_endpoint_name = "NemsMeshRetrieval"
1187+
app_service_plan_key = "NonScaling"
1188+
key_vault_url = "KeyVaultConnectionString"
1189+
storage_account_env_var_name = "nemsmeshfolder_STORAGE"
11931190
app_urls = [
11941191
{
11951192
env_var_name = "ExceptionFunctionURL"

infrastructure/tf-core/function_app.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module "functionapp" {
2828

2929
# Use the storage account assigned identity for the Function Apps:
3030
storage_account_name = module.storage["fnapp-${each.value.region}"].storage_account_name
31-
storage_uses_managed_identity = each.value.storage_uses_managed_identity
31+
storage_uses_managed_identity = var.function_apps.storage_uses_managed_identity
3232

3333
# Connection string for Application Insights:
3434
ai_connstring = data.azurerm_application_insights.ai.connection_string
@@ -221,7 +221,6 @@ locals {
221221
]
222222

223223
])
224-
storage_uses_managed_identity = config.storage_uses_managed_identity
225224
}
226225
)
227226
]

infrastructure/tf-core/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ variable "function_apps" {
287287
http2_enabled = optional(bool, false)
288288
pull_image_over_vnet = optional(bool, true)
289289
remote_debugging_enabled = bool
290+
storage_uses_managed_identity = bool
290291
worker_32bit = bool
291292
alert_4xx_threshold = optional(number, 1)
292293
alert_5xx_threshold = optional(number, 1)
@@ -314,8 +315,7 @@ variable "function_apps" {
314315
function_app_key = string
315316
endpoint_name = optional(string, "")
316317
})), [])
317-
env_vars_static = optional(map(string), {})
318-
storage_uses_managed_identity = optional(bool, false)
318+
env_vars_static = optional(map(string), {})
319319
}))
320320
})
321321
}

0 commit comments

Comments
 (0)