|
| 1 | +targetScope = 'resourceGroup' |
| 2 | + |
| 3 | +@description('Short lowercase application name used in resource names.') |
| 4 | +param applicationName string = 'casloop' |
| 5 | + |
| 6 | +@description('Deployment environment name.') |
| 7 | +@allowed(['dev', 'test', 'staging', 'prod']) |
| 8 | +param environment string = 'dev' |
| 9 | + |
| 10 | +@description('Azure region for all regional resources.') |
| 11 | +param location string = resourceGroup().location |
| 12 | + |
| 13 | +@description('Foundry project resource ID receiving the agent caller role assignment.') |
| 14 | +param foundryProjectResourceId string |
| 15 | + |
| 16 | +var suffix = uniqueString(resourceGroup().id, applicationName, environment) |
| 17 | +var foundrySegments = split(foundryProjectResourceId, '/') |
| 18 | +var tags = { |
| 19 | + application: applicationName |
| 20 | + environment: environment |
| 21 | + managedBy: 'bicep' |
| 22 | + dataClassification: 'internal' |
| 23 | +} |
| 24 | + |
| 25 | +module observability 'modules/observability.bicep' = { |
| 26 | + name: 'observability' |
| 27 | + params: { |
| 28 | + name: '${applicationName}-${environment}' |
| 29 | + location: location |
| 30 | + tags: tags |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +module storage 'modules/storage.bicep' = { |
| 35 | + name: 'storage' |
| 36 | + params: { |
| 37 | + name: take('st${applicationName}${environment}${suffix}', 24) |
| 38 | + location: location |
| 39 | + tags: tags |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +module ingress 'modules/function-ingress.bicep' = { |
| 44 | + name: 'function-ingress' |
| 45 | + params: { |
| 46 | + name: '${applicationName}-${environment}-${suffix}' |
| 47 | + location: location |
| 48 | + storageAccountName: storage.outputs.name |
| 49 | + storageAccountId: storage.outputs.id |
| 50 | + queueName: storage.outputs.queueName |
| 51 | + applicationInsightsConnectionString: observability.outputs.connectionString |
| 52 | + tags: tags |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +module foundryRbac 'modules/foundry-rbac.bicep' = { |
| 57 | + name: 'foundry-rbac' |
| 58 | + scope: resourceGroup(foundrySegments[2], foundrySegments[4]) |
| 59 | + params: { |
| 60 | + accountName: foundrySegments[8] |
| 61 | + projectName: foundrySegments[10] |
| 62 | + principalId: ingress.outputs.principalId |
| 63 | + } |
| 64 | +} |
| 65 | + |
| 66 | +@description('System-assigned principal used by ingress for queue and Foundry access.') |
| 67 | +output ingressPrincipalId string = ingress.outputs.principalId |
| 68 | + |
| 69 | +@description('Ingress function resource ID.') |
| 70 | +output ingressResourceId string = ingress.outputs.id |
0 commit comments