Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 61 additions & 2 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ resource cosmosDbAccount 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {

// CosmosDB Database
resource cosmosDatabase 'sqlDatabases' = {
name: 'forms-db'
name: 'formsdb'
properties: {
resource: {
id: 'forms-db'
id: 'formsdb'
}
}
}
Expand Down Expand Up @@ -229,6 +229,7 @@ resource submissionAppSettings 'Microsoft.Web/sites/config@2024-11-01' = {
Aspire__Azure__Messaging__ServiceBus__submissionsqueue__FullyQualifiedNamespace: serviceBusNamespace.properties.serviceBusEndpoint
Aspire__Azure__Messaging__ServiceBus__submissionsqueue__QueueOrTopicName: 'submissions'
AzureWebJobsStorage__accountName: storageAccount.name
AzureWebJobsStorage__credential: 'managedidentity'
AzureWebJobsStorage__blobServiceUri: storageAccount.properties.primaryEndpoints.blob
AzureWebJobsStorage__queueServiceUri: storageAccount.properties.primaryEndpoints.queue
AzureWebJobsStorage__tableServiceUri: storageAccount.properties.primaryEndpoints.table
Expand Down Expand Up @@ -268,6 +269,8 @@ resource notificationFunc 'Microsoft.Web/sites@2024-11-01' = {
}
siteConfig: {
// appSettings moved to child resource notificationAppSettings
minTlsVersion: '1.2'
http20Enabled: true
cors: {
allowedOrigins: ['*']
}
Expand Down Expand Up @@ -390,6 +393,62 @@ resource notificationServiceBusRoleAssignment 'Microsoft.Authorization/roleAssig
}
}

// Assign Storage Queue Data Contributor role to Submission Function
resource submissionQueueRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(storageAccount.id, submissionFunc.id, 'StorageQueueDataContributor')
scope: storageAccount
properties: {
roleDefinitionId: subscriptionResourceId(
'Microsoft.Authorization/roleDefinitions',
'974c5e8b-45b9-4653-ba55-5f855dd0fb88'
)
principalId: submissionFunc.identity.principalId
principalType: 'ServicePrincipal'
}
}

// Assign Storage Queue Data Contributor role to Notification Function
resource notificationQueueRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(storageAccount.id, notificationFunc.id, 'StorageQueueDataContributor')
scope: storageAccount
properties: {
roleDefinitionId: subscriptionResourceId(
'Microsoft.Authorization/roleDefinitions',
'974c5e8b-45b9-4653-ba55-5f855dd0fb88'
)
principalId: notificationFunc.identity.principalId
principalType: 'ServicePrincipal'
}
}

// Assign Storage Table Data Contributor role to Submission Function
resource submissionTableRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(storageAccount.id, submissionFunc.id, 'StorageTableDataContributor')
scope: storageAccount
properties: {
roleDefinitionId: subscriptionResourceId(
'Microsoft.Authorization/roleDefinitions',
'0a9a7e1f-b9d0-4cc4-a60d-0319b160aafe'
)
principalId: submissionFunc.identity.principalId
principalType: 'ServicePrincipal'
}
}

// Assign Storage Table Data Contributor role to Notification Function
resource notificationTableRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(storageAccount.id, notificationFunc.id, 'StorageTableDataContributor')
scope: storageAccount
properties: {
roleDefinitionId: subscriptionResourceId(
'Microsoft.Authorization/roleDefinitions',
'0a9a7e1f-b9d0-4cc4-a60d-0319b160aafe'
)
principalId: notificationFunc.identity.principalId
principalType: 'ServicePrincipal'
}
}

// Outputs
output submissionFuncName string = submissionFunc.name
output notificationFuncName string = notificationFunc.name
Expand Down
Loading