Last active
September 28, 2021 10:56
-
-
Save ljtill/af025397631c01d9c220271415583c67 to your computer and use it in GitHub Desktop.
Provides the ability to deploy Azure Functions via Bicep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------ | |
// Scopes | |
// ------ | |
targetScope = 'subscription' | |
// --------- | |
// Modules | |
// --------- | |
module resources './resources.bicep' = { | |
name: 'Microsoft.Service.Interface.Resources.${count}' | |
scope: subscription() | |
params: { | |
name: name | |
location: location | |
tags: tags | |
} | |
} | |
module storage './storage.bicep' = { | |
name: 'Microsoft.Service.Interface.Storage.${count}' | |
scope: resourceGroup(name) | |
params: { | |
name: name | |
location: location | |
tags: tags | |
} | |
dependsOn: [ | |
resources | |
] | |
} | |
module web './web.bicep' = { | |
name: 'Microsoft.Service.Interface.Web.${count}' | |
scope: resourceGroup(name) | |
params: { | |
name: name | |
location: location | |
tags: tags | |
storage: storage.outputs.storage | |
insights: insights | |
} | |
dependsOn: [ | |
storage | |
] | |
} | |
// --------- | |
// Parameters | |
// --------- | |
param count int | |
param tags object | |
param location string | |
param name string | |
param insights object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------ | |
// Scopes | |
// ------ | |
targetScope = 'subscription' | |
// --------- | |
// Resources | |
// --------- | |
resource resource_group 'Microsoft.Resources/resourceGroups@2020-06-01' = { | |
name: name | |
location: location | |
properties: {} | |
tags: tags | |
} | |
// --------- | |
// Parameters | |
// --------- | |
param name string | |
param location string | |
param tags object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------ | |
// Scopes | |
// ------ | |
targetScope = 'resourceGroup' | |
// --------- | |
// Resources | |
// --------- | |
resource storage_account 'Microsoft.Storage/storageAccounts@2021-02-01' = { | |
name: name | |
location: location | |
sku: { | |
name: 'Standard_LRS' | |
tier: 'Standard' | |
} | |
properties: {} | |
kind: 'Storage' | |
tags: tags | |
} | |
// --------- | |
// Parameters | |
// --------- | |
param name string | |
param location string | |
param tags object | |
// --------- | |
// Outputs | |
// --------- | |
output storage object = storage_account |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------ | |
// Scopes | |
// ------ | |
targetScope = 'resourceGroup' | |
// --------- | |
// Resources | |
// --------- | |
resource server_farm 'Microsoft.Web/serverfarms@2020-12-01' = { | |
name: name | |
location: location | |
kind: 'functionapp' | |
sku: { | |
name: 'Y1' | |
tier: 'Dynamic' | |
size: 'Y1' | |
family: 'Y' | |
capacity: 0 | |
} | |
properties: { | |
reserved: true | |
} | |
tags: tags | |
} | |
resource site 'Microsoft.Web/sites@2020-12-01' = { | |
name: name | |
location: location | |
kind: 'functionapp,linux' | |
properties: { | |
serverFarmId: server_farm.id | |
httpsOnly: true | |
siteConfig: { | |
appSettings: [ | |
{ | |
name: 'APPINSIGHTS_INSTRUMENTATIONKEY' | |
value: insights.properties.InstrumentationKey | |
} | |
{ | |
name: 'AzureWebJobsStorage' | |
value: concat('DefaultEndpointsProtocol=https;AccountName=', name, ';AccountKey=', listKeys(storage.resourceId, '2021-02-01').keys[0].value, ';EndpointSuffix=core.windows.net') | |
} | |
{ | |
name: 'FUNCTIONS_EXTENSION_VERSION' | |
value: '~3' | |
} | |
{ | |
name: 'FUNCTIONS_WORKER_RUNTIME' | |
value: 'dotnet-isolated' | |
} | |
] | |
linuxFxVersion: 'dotnet|5.0' | |
} | |
} | |
tags: tags | |
} | |
resource diagnostics 'microsoft.insights/diagnosticSettings@2017-05-01-preview' = { | |
scope: site | |
name: 'default' | |
properties: { | |
workspaceId: insights.properties.workspaceResourceId | |
metrics: [ | |
{ | |
category: 'AllMetrics' | |
enabled: true | |
retentionPolicy: { | |
days: 0 | |
enabled: false | |
} | |
} | |
] | |
logs: [ | |
{ | |
category: 'FunctionAppLogs' | |
enabled: true | |
} | |
] | |
} | |
} | |
// --------- | |
// Parameters | |
// --------- | |
param name string | |
param location string | |
param tags object | |
param storage object | |
param insights object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment