Skip to content

Commit 707e674

Browse files
committed
fix role assignment
1 parent 64ef8b7 commit 707e674

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Deployment/testFunctions/parts/linuxFunctionFlex.bicep

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ resource function 'Microsoft.Web/sites@2024-04-01' = {
7272
name: functionName
7373
location: location
7474
kind: 'functionapp,linux'
75+
identity: {
76+
type: 'SystemAssigned'
77+
}
7578
properties: {
7679
serverFarmId: functionFarm.id
7780
httpsOnly: true
@@ -143,3 +146,16 @@ module configurationRegistration 'configurationRegistration.bicep' = {
143146
sortOrder: sortOrder
144147
}
145148
}
149+
150+
var storageRoleDefinitionId = 'b7e6dc6d-f1e8-4753-8033-0f276bb0955b' //Storage Blob Data Owner role
151+
152+
// Allow access from function app to storage account using a managed identity
153+
resource storageRoleAssignment 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
154+
name: guid(storageAccount.id, storageRoleDefinitionId)
155+
scope: storageAccount
156+
properties: {
157+
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', storageRoleDefinitionId)
158+
principalId: functionFarm.identity.principalId
159+
principalType: 'ServicePrincipal'
160+
}
161+
}

0 commit comments

Comments
 (0)