-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction-ingress.bicep
More file actions
85 lines (79 loc) · 2.61 KB
/
Copy pathfunction-ingress.bicep
File metadata and controls
85 lines (79 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
param name string
param location string
param storageAccountName string
param storageAccountId string
param queueName string
param applicationInsightsConnectionString string
param tags object
resource plan 'Microsoft.Web/serverfarms@2024-04-01' = {
name: 'plan-${name}'
location: location
tags: tags
kind: 'functionapp'
sku: { name: 'FC1', tier: 'FlexConsumption' }
properties: { reserved: true }
}
resource functionApp 'Microsoft.Web/sites@2024-04-01' = {
name: 'func-${name}'
location: location
tags: tags
kind: 'functionapp,linux'
identity: { type: 'SystemAssigned' }
properties: {
serverFarmId: plan.id
httpsOnly: true
publicNetworkAccess: 'Enabled'
siteConfig: {
minTlsVersion: '1.2'
ftpsState: 'Disabled'
appSettings: [
{ name: 'FUNCTIONS_WORKER_RUNTIME', value: 'python' }
{ name: 'WORK_QUEUE_NAME', value: queueName }
{ name: 'WORK_QUEUE_STORAGE__queueServiceUri', value: 'https://${storageAccountName}.queue.${environment().suffixes.storage}' }
{ name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', value: applicationInsightsConnectionString }
]
}
functionAppConfig: {
deployment: {
storage: {
type: 'blobContainer'
value: 'https://${storageAccountName}.blob.${environment().suffixes.storage}/app-package'
authentication: {
type: 'SystemAssignedIdentity'
}
}
}
scaleAndConcurrency: {
maximumInstanceCount: 100
instanceMemoryMB: 2048
}
runtime: {
name: 'python'
version: '3.12'
}
}
}
}
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' existing = {
name: storageAccountName
}
resource queueContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(storageAccountId, functionApp.id, 'queue-contributor')
scope: storageAccount
properties: {
principalId: functionApp.identity.principalId
principalType: 'ServicePrincipal'
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88')
}
}
resource blobContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(storageAccountId, functionApp.id, 'blob-contributor')
scope: storageAccount
properties: {
principalId: functionApp.identity.principalId
principalType: 'ServicePrincipal'
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')
}
}
output id string = functionApp.id
output principalId string = functionApp.identity.principalId