Skip to content

Instantly share code, notes, and snippets.

@manukanne
Created April 25, 2022 00:52
Show Gist options
  • Save manukanne/82b4c6465ca3fc280bb71e7a83347cfa to your computer and use it in GitHub Desktop.
Save manukanne/82b4c6465ca3fc280bb71e7a83347cfa to your computer and use it in GitHub Desktop.
Deploy an Azure Function using Bicep
@description('Function App name')
param functionAppName string
@description('Function App runtime')
@allowed([
'dotnet'
'node'
'python'
'java'
])
param functionAppRuntime string
@description('Application Insights Instrumentation Key')
@secure()
param applicationInsightsKey string
@description('Storage Account connection string')
@secure()
param storageAccountConnectionString string
@description('Key Vault URI Connection String reference')
@secure()
param databaseConnectionString string
var function_extension_version = '~4'
var databaseConnectionStringKeyVaultRef = '@Microsoft.KeyVault(SecretUri=${databaseConnectionString})'
resource functionAppSettings 'Microsoft.Web/sites/config@2021-03-01' = {
name: '${functionAppName}/appsettings'
properties: {
AzureWebJobsStorage: storageAccountConnectionString
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING: storageAccountConnectionString
WEBSITE_CONTENTSHARE: toLower(functionAppName)
FUNCTIONS_EXTENSION_VERSION: function_extension_version
APPINSIGHTS_INSTRUMENTATIONKEY: applicationInsightsKey
FUNCTIONS_WORKER_RUNTIME: functionAppRuntime
//WEBSITE_TIME_ZONE only available on windows
WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG: 1
DatabaseConnectionString: databaseConnectionStringKeyVaultRef
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment