@Adam Evans could you please try the below Bicep template for creating an Azure Function with an Event Grid Blob Trigger
please refer: https://learn.microsoft.com/en-us/azure/templates/microsoft.eventgrid/eventsubscriptions?pivots=deployment-language-bicep
param storageAccountName string
param functionAppName string
param location string = resourceGroup().location
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-04-01' = {
name: storageAccountName
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
}
resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
name: functionAppName
location: location
kind: 'functionapp'
properties: {
serverFarmId: 'YOUR_APP_SERVICE_PLAN_ID'
siteConfig: {
appSettings: [
{
name: 'AzureWebJobsStorage'
value: storageAccount.properties.primaryEndpoints.blob
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~3'
}
{
name: 'WEBSITE_NODE_DEFAULT_VERSION'
value: '~14'
}
]
}
}
}
resource eventGridSubscription 'Microsoft.EventGrid/eventSubscriptions@2021-06-01-preview' = {
name: 'blob-created-subscription'
scope: storageAccount
properties: {
destination: {
endpointType: 'AzureFunction'
properties: {
resourceId: functionApp.id
}
}
filter: {
includedEventTypes: [
'Microsoft.Storage.BlobCreated'
]
}
}
}
This template creates a storage account, a function app, and an Event Grid subscription that triggers the function app when a blob is created in the storage account. You will need to replace 'YOUR_APP_SERVICE_PLAN_ID'
with the ID of your App Service plan.
do let me know incase of further queries, I would be happy to assist you.