-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge: pull request #18 from lrottach/feat/bicep-deployment
feat: implemented bicep deployment
- Loading branch information
Showing
4 changed files
with
218 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
|
||
/////////////////////////////////////////////// | ||
// | ||
// Type: Main | ||
// Author: Lukas Rottach | ||
// CreationDate: 15.08.2023 | ||
// Name: Azure Chronos Deployment | ||
// | ||
/////////////////////////////////////////////// | ||
|
||
//////////////////////////////// | ||
// Deployoment Scope | ||
//////////////////////////////// | ||
targetScope = 'subscription' | ||
|
||
//////////////////////////////// | ||
// Parameter Area | ||
//////////////////////////////// | ||
|
||
// Deployment parameter | ||
param deploymentLocation string | ||
param rgName string | ||
|
||
// Function parameter | ||
param functionAppName string | ||
|
||
@description('The language worker runtime to load in the function app.') | ||
@allowed([ | ||
'dotnet' | ||
'dotnet-isolated' | ||
]) | ||
param runtime string | ||
|
||
@allowed([ | ||
'v7.0' | ||
'v6.0' | ||
]) | ||
param dotnetVersion string | ||
|
||
// Storage parameter | ||
param storageName string | ||
|
||
//////////////////////////////// | ||
// Resource Area | ||
//////////////////////////////// | ||
resource rg 'Microsoft.Resources/resourceGroups@2022-09-01' = { | ||
name: rgName | ||
location: deploymentLocation | ||
} | ||
|
||
//////////////////////////////// | ||
// Module Area | ||
//////////////////////////////// | ||
module func './modules/Microsoft.Web/functionapp.module.bicep' = { | ||
scope: rg | ||
name: 'deploy-${rg.name}' | ||
params: { | ||
deploymentLocation: deploymentLocation | ||
dotnetVersion: dotnetVersion | ||
functionAppName: functionAppName | ||
runtime: runtime | ||
storageName: storageName | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
/////////////////////////////////////////////// | ||
// | ||
// Type: Module | ||
// Author: Lukas Rottach | ||
// CreationDate: 15.08.2023 | ||
// Name: Azure Function App | ||
// Provider: Microsoft.Web | ||
// | ||
/////////////////////////////////////////////// | ||
|
||
//////////////////////////////// | ||
// Deployoment Scope | ||
//////////////////////////////// | ||
targetScope = 'resourceGroup' | ||
|
||
//////////////////////////////// | ||
// Parameter Area | ||
//////////////////////////////// | ||
|
||
// Deployment parameter | ||
param deploymentLocation string | ||
|
||
// Function parameter | ||
param functionAppName string | ||
|
||
@description('The language worker runtime to load in the function app.') | ||
@allowed([ | ||
'dotnet' | ||
'dotnet-isolated' | ||
]) | ||
param runtime string | ||
|
||
@allowed([ | ||
'v7.0' | ||
'v6.0' | ||
]) | ||
param dotnetVersion string | ||
|
||
// Storage parameter | ||
param storageName string | ||
|
||
//////////////////////////////// | ||
// Resource Area | ||
//////////////////////////////// | ||
|
||
// Hosting Plan | ||
resource asp 'Microsoft.Web/serverfarms@2022-09-01' = { | ||
name: '${functionAppName}-asp1-we' | ||
location: deploymentLocation | ||
sku: { | ||
name: 'Y1' | ||
tier: 'Dynamic' | ||
} | ||
properties: {} | ||
} | ||
|
||
// Storage Account | ||
resource sto 'Microsoft.Storage/storageAccounts@2023-01-01' = { | ||
name: storageName | ||
location: deploymentLocation | ||
sku: { | ||
name: 'Standard_LRS' | ||
} | ||
kind: 'StorageV2' | ||
properties: { | ||
supportsHttpsTrafficOnly: true | ||
defaultToOAuthAuthentication: true | ||
} | ||
} | ||
|
||
// Application Insights | ||
resource appin 'Microsoft.Insights/components@2020-02-02' = { | ||
name: '${functionAppName}-appin1-we' | ||
location: deploymentLocation | ||
kind: 'web' | ||
properties: { | ||
Application_Type: 'web' | ||
Request_Source: 'rest' | ||
} | ||
} | ||
|
||
// Azure Function App | ||
resource func 'Microsoft.Web/sites@2022-09-01' = { | ||
name: functionAppName | ||
location: deploymentLocation | ||
kind: 'functionapp' | ||
identity: { | ||
type: 'SystemAssigned' | ||
} | ||
properties: { | ||
serverFarmId: asp.id | ||
siteConfig: { | ||
appSettings: [ | ||
{ | ||
name: 'AzureWebJobsStorage' | ||
value: 'DefaultEndpointsProtocol=https;AccountName=${sto.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${sto.listKeys().keys[0].value}' | ||
} | ||
{ | ||
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING' | ||
value: 'DefaultEndpointsProtocol=https;AccountName=${sto.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${sto.listKeys().keys[0].value}' | ||
} | ||
{ | ||
name: 'WEBSITE_CONTENTSHARE' | ||
value: toLower(functionAppName) | ||
} | ||
{ | ||
name: 'FUNCTIONS_EXTENSION_VERSION' | ||
value: '~4' | ||
} | ||
{ | ||
name: 'APPINSIGHTS_INSTRUMENTATIONKEY' | ||
value: appin.properties.InstrumentationKey | ||
} | ||
{ | ||
name: 'FUNCTIONS_WORKER_RUNTIME' | ||
value: runtime | ||
} | ||
] | ||
cors: { | ||
allowedOrigins: [ | ||
'https://portal.azure.com' | ||
] | ||
} | ||
netFrameworkVersion: dotnetVersion | ||
use32BitWorkerProcess: true | ||
ftpsState: 'FtpsOnly' | ||
minTlsVersion: '1.2' | ||
} | ||
httpsOnly: true | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using 'main.bicep' | ||
|
||
// Deployment Parameter | ||
param deploymentLocation = 'West Europe' | ||
param rgName = 'rg-dev-chronos1-we' | ||
|
||
// Function Parameter | ||
param functionAppName = 'azure-chronos-dev' | ||
param storageName = 'devazchronossto1we' | ||
param runtime = 'dotnet-isolated' | ||
param dotnetVersion = 'v7.0' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using 'main.bicep' | ||
|
||
// Deployment Parameter | ||
param deploymentLocation = 'West Europe' | ||
param rgName = 'rg-prod-chronos1-we' | ||
|
||
// Function Parameter | ||
param functionAppName = 'azure-chronos' | ||
param storageName = 'prodazchronossto1we' | ||
param runtime = 'dotnet-isolated' | ||
param dotnetVersion = 'v7.0' |