@@ -7,8 +7,9 @@ param tags object = {}
7
7
param applicationInsightsName string = ''
8
8
param appServicePlanId string
9
9
param keyVaultName string = ''
10
- param managedIdentity bool = !empty (keyVaultName )
10
+ param managedIdentity bool = !empty (keyVaultName ) || storageManagedIdentity
11
11
param storageAccountName string
12
+ param storageManagedIdentity bool = false
12
13
param virtualNetworkSubnetId string = ''
13
14
14
15
// Runtime Properties
@@ -56,7 +57,8 @@ module functions 'appservice.bicep' = {
56
57
applicationInsightsName : applicationInsightsName
57
58
appServicePlanId : appServicePlanId
58
59
appSettings : union (appSettings , {
59
- AzureWebJobsStorage : 'DefaultEndpointsProtocol=https;AccountName=${storage .name };AccountKey=${storage .listKeys ().keys [0 ].value };EndpointSuffix=${environment ().suffixes .storage }'
60
+ AzureWebJobsStorage__accountName : storageManagedIdentity ? storage .name : null
61
+ AzureWebJobsStorage : storageManagedIdentity ? null : 'DefaultEndpointsProtocol=https;AccountName=${storage .name };AccountKey=${storage .listKeys ().keys [0 ].value };EndpointSuffix=${environment ().suffixes .storage }'
60
62
FUNCTIONS_EXTENSION_VERSION : extensionVersion
61
63
FUNCTIONS_WORKER_RUNTIME : runtimeName
62
64
})
@@ -79,6 +81,16 @@ module functions 'appservice.bicep' = {
79
81
}
80
82
}
81
83
84
+ module storageOwnerRole '../../core/security/role.bicep' = if (storageManagedIdentity ) {
85
+ name : 'search-index-contrib-role-api'
86
+ params : {
87
+ principalId : functions .outputs .identityPrincipalId
88
+ // Search Index Data Contributor
89
+ roleDefinitionId : '8ebe5a00-799e-43f5-93ac-243d3dce84a7'
90
+ principalType : 'ServicePrincipal'
91
+ }
92
+ }
93
+
82
94
resource storage 'Microsoft.Storage/storageAccounts@2021-09-01' existing = {
83
95
name : storageAccountName
84
96
}
0 commit comments