Skip to content

Commit a47ced9

Browse files
authored
## Purpose <!-- Describe the intention of the changes being proposed. What problem does it solve or functionality does it add? --> * ... ## Does this introduce a breaking change? <!-- Mark one with an "x". --> ``` [ ] Yes [ ] No ``` ## Pull Request Type What kind of change does this Pull Request introduce? <!-- Please check the one that applies to this PR using "x". --> ``` [ ] Bugfix [ ] Feature [ ] Code style update (formatting, local variables) [ ] Refactoring (no functional changes, no api changes) [ ] Documentation content changes [ ] Other... Please describe: ``` ## How to Test * Get the code ``` git clone [repo-address] cd [repo-name] git checkout [branch-name] npm install ``` * Test the code <!-- Add steps to run the tests suite and/or manually test --> ``` ``` ## What to Check Verify that the following are valid * ... ## Other Information <!-- Add any other helpful information that may be needed here. -->
1 parent 58db583 commit a47ced9

11 files changed

+536
-100
lines changed

.devcontainer/devcontainer.json

+10-8
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,22 @@
1717
"customizations": {
1818
"vscode": {
1919
"extensions": [
20-
"ms-azuretools.vscode-docker",
20+
"GitHub.vscode-github-actions",
21+
"esbenp.prettier-vscode",
22+
"ipedrazas.kubernetes-snippets",
23+
"ms-azuretools.azure-dev",
24+
"ms-azuretools.vscode-azurecontainerapps",
2125
"ms-azuretools.vscode-azurefunctions",
2226
"ms-azuretools.vscode-azurestorage",
23-
"ms-azuretools.vscode-azurecontainerapps",
27+
"ms-azuretools.vscode-docker",
28+
"ms-dotnettools.blazorwasm-companion",
2429
"ms-dotnettools.csdevkit",
30+
"ms-dotnettools.csharp",
2531
"ms-dotnettools.vscode-dotnet-runtime",
26-
"ms-dotnettools.blazorwasm-companion",
27-
"ms-kubernetes-tools.vscode-aks-tools",
2832
"ms-kubernetes-tools.aks-devx-tools",
33+
"ms-kubernetes-tools.vscode-aks-tools",
2934
"ms-kubernetes-tools.vscode-kubernetes-tools",
30-
"ipedrazas.kubernetes-snippets",
31-
"redhat.vscode-yaml",
32-
"GitHub.vscode-github-actions",
33-
"esbenp.prettier-vscode"
35+
"redhat.vscode-yaml"
3436
]
3537
}
3638
},

.vscode/extensions.json

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
{
2-
"recommendations": [
3-
"ms-azuretools.vscode-azurefunctions",
4-
"ms-dotnettools.csharp",
5-
"ms-azuretools.vscode-docker",
6-
"ms-azuretools.vscode-azurestorage",
7-
"ms-azuretools.vscode-azurecontainerapps",
8-
"ms-dotnettools.csdevkit",
9-
"ms-dotnettools.vscode-dotnet-runtime",
10-
"ms-dotnettools.blazorwasm-companion",
11-
"ms-kubernetes-tools.vscode-aks-tools",
12-
"ms-kubernetes-tools.aks-devx-tools",
13-
"ms-kubernetes-tools.vscode-kubernetes-tools",
14-
"ipedrazas.kubernetes-snippets",
15-
"redhat.vscode-yaml",
16-
"GitHub.vscode-github-actions",
17-
"esbenp.prettier-vscode"
18-
]
19-
}
2+
"recommendations": [
3+
"GitHub.vscode-github-actions",
4+
"esbenp.prettier-vscode",
5+
"ipedrazas.kubernetes-snippets",
6+
"ms-azuretools.azure-dev",
7+
"ms-azuretools.vscode-azurecontainerapps",
8+
"ms-azuretools.vscode-azurefunctions",
9+
"ms-azuretools.vscode-azurestorage",
10+
"ms-azuretools.vscode-docker",
11+
"ms-dotnettools.blazorwasm-companion",
12+
"ms-dotnettools.csdevkit",
13+
"ms-dotnettools.csharp",
14+
"ms-dotnettools.vscode-dotnet-runtime",
15+
"ms-kubernetes-tools.aks-devx-tools",
16+
"ms-kubernetes-tools.vscode-aks-tools",
17+
"ms-kubernetes-tools.vscode-kubernetes-tools",
18+
"redhat.vscode-yaml"
19+
]
20+
}

.vscode/launch.json

+52-49
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,54 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
"version": "0.2.0",
6-
"configurations": [
7-
{
8-
"name": "Frontend: Blazor client",
9-
"type": "coreclr",
10-
"request": "launch",
11-
"preLaunchTask": "build",
12-
"program": "${workspaceFolder}//app/backend/bin/Debug/net8.0/ClientApp.dll",
13-
"args": [],
14-
"cwd": "${workspaceFolder}",
15-
"stopAtEntry": false,
16-
"serverReadyAction": {
17-
"action": "openExternally",
18-
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
19-
},
20-
"env": {
21-
"ASPNETCORE_ENVIRONMENT": "Development"
22-
},
23-
"envFile": "${input:dotEnvFilePath}"
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Frontend: Blazor client",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
"program": "${workspaceFolder}/app/backend/bin/Debug/net8.0/ClientApp.dll",
13+
"args": [],
14+
"cwd": "${workspaceFolder}",
15+
"stopAtEntry": false,
16+
"serverReadyAction": {
17+
"action": "openExternally",
18+
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
2419
},
25-
{
26-
"name": "Backend: Minimal API",
27-
"type": "coreclr",
28-
"request": "launch",
29-
"preLaunchTask": "build",
30-
"program": "${workspaceFolder}/app/backend/bin/Debug/net8.0/MinimalApi.dll",
31-
"args": [],
32-
"cwd": "${workspaceFolder}",
33-
"stopAtEntry": false,
34-
"console": "internalConsole",
35-
"envFile": "${input:dotEnvFilePath}"
36-
}
37-
],
38-
"inputs": [
39-
{
40-
"id": "dotEnvFilePath",
41-
"type": "command",
42-
"command": "azure-dev.commands.getDotEnvFilePath"
43-
}
44-
],
45-
"compounds": [
46-
{
47-
"name": "Full Stack",
48-
"configurations": ["Backend: Minimal API", "Frontend: Blazor client"]
49-
}
50-
]
51-
}
20+
"env": {
21+
"ASPNETCORE_ENVIRONMENT": "Development"
22+
},
23+
"envFile": "${input:dotEnvFilePath}"
24+
},
25+
{
26+
"name": "Backend: Minimal API",
27+
"type": "coreclr",
28+
"request": "launch",
29+
"preLaunchTask": "build",
30+
"program": "${workspaceFolder}/app/backend/bin/Debug/net8.0/MinimalApi.dll",
31+
"args": [],
32+
"cwd": "${workspaceFolder}",
33+
"stopAtEntry": false,
34+
"console": "internalConsole",
35+
"envFile": "${input:dotEnvFilePath}"
36+
}
37+
],
38+
"inputs": [
39+
{
40+
"id": "dotEnvFilePath",
41+
"type": "command",
42+
"command": "azure-dev.commands.getDotEnvFilePath"
43+
}
44+
],
45+
"compounds": [
46+
{
47+
"name": "Full Stack",
48+
"configurations": [
49+
"Backend: Minimal API",
50+
"Frontend: Blazor client"
51+
]
52+
}
53+
]
54+
}

azure.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ services:
1111
docker:
1212
path: ../Dockerfile
1313
context: ../
14+
function:
15+
project: ./app/functions/EmbedFunctions
16+
host: function
17+
language: dotnet
1418
hooks:
1519
postprovision:
1620
windows:

infra/app/function.bicep

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
param name string
2+
param location string = resourceGroup().location
3+
param tags object = {}
4+
5+
param allowedOrigins array = []
6+
param applicationInsightsName string = ''
7+
param appServicePlanId string
8+
@secure()
9+
param appSettings object = {}
10+
param keyVaultName string
11+
param serviceName string = 'function'
12+
param storageAccountName string
13+
14+
module function '../core/host/functions.bicep' = {
15+
name: '${serviceName}-function'
16+
params: {
17+
name: name
18+
location: location
19+
tags: union(tags, { 'azd-service-name': serviceName })
20+
allowedOrigins: allowedOrigins
21+
alwaysOn: false
22+
appSettings: appSettings
23+
applicationInsightsName: applicationInsightsName
24+
appServicePlanId: appServicePlanId
25+
keyVaultName: keyVaultName
26+
runtimeName: 'dotnet-isolated'
27+
runtimeVersion: '8.0'
28+
storageAccountName: storageAccountName
29+
scmDoBuildDuringDeployment: false
30+
}
31+
}
32+
33+
output SERVICE_FUNCTION_IDENTITY_PRINCIPAL_ID string = function.outputs.identityPrincipalId
34+
output SERVICE_FUNCTION_NAME string = function.outputs.name
35+
output SERVICE_FUNCTION_URI string = function.outputs.uri
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
metadata description = 'Updates app settings for an Azure App Service.'
2+
@description('The name of the app service resource within the current resource group scope')
3+
param name string
4+
5+
@description('The app settings to be applied to the app service')
6+
@secure()
7+
param appSettings object
8+
9+
resource appService 'Microsoft.Web/sites@2022-03-01' existing = {
10+
name: name
11+
}
12+
13+
resource settings 'Microsoft.Web/sites/config@2022-03-01' = {
14+
name: 'appsettings'
15+
parent: appService
16+
properties: appSettings
17+
}

infra/core/host/appservice.bicep

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
metadata description = 'Creates an Azure App Service in an existing Azure App Service plan.'
2+
param name string
3+
param location string = resourceGroup().location
4+
param tags object = {}
5+
6+
// Reference Properties
7+
param applicationInsightsName string = ''
8+
param appServicePlanId string
9+
param keyVaultName string = ''
10+
param managedIdentity bool = !empty(keyVaultName)
11+
12+
// Runtime Properties
13+
@allowed([
14+
'dotnet', 'dotnetcore', 'dotnet-isolated', 'node', 'python', 'java', 'powershell', 'custom'
15+
])
16+
param runtimeName string
17+
param runtimeNameAndVersion string = '${runtimeName}|${runtimeVersion}'
18+
param runtimeVersion string
19+
20+
// Microsoft.Web/sites Properties
21+
param kind string = 'app,linux'
22+
23+
// Microsoft.Web/sites/config
24+
param allowedOrigins array = []
25+
param alwaysOn bool = true
26+
param appCommandLine string = ''
27+
@secure()
28+
param appSettings object = {}
29+
param clientAffinityEnabled bool = false
30+
param enableOryxBuild bool = contains(kind, 'linux')
31+
param functionAppScaleLimit int = -1
32+
param linuxFxVersion string = runtimeNameAndVersion
33+
param minimumElasticInstanceCount int = -1
34+
param numberOfWorkers int = -1
35+
param scmDoBuildDuringDeployment bool = false
36+
param use32BitWorkerProcess bool = false
37+
param ftpsState string = 'FtpsOnly'
38+
param healthCheckPath string = ''
39+
40+
resource appService 'Microsoft.Web/sites@2022-03-01' = {
41+
name: name
42+
location: location
43+
tags: tags
44+
kind: kind
45+
properties: {
46+
serverFarmId: appServicePlanId
47+
siteConfig: {
48+
linuxFxVersion: linuxFxVersion
49+
alwaysOn: alwaysOn
50+
ftpsState: ftpsState
51+
minTlsVersion: '1.2'
52+
appCommandLine: appCommandLine
53+
numberOfWorkers: numberOfWorkers != -1 ? numberOfWorkers : null
54+
minimumElasticInstanceCount: minimumElasticInstanceCount != -1 ? minimumElasticInstanceCount : null
55+
use32BitWorkerProcess: use32BitWorkerProcess
56+
functionAppScaleLimit: functionAppScaleLimit != -1 ? functionAppScaleLimit : null
57+
healthCheckPath: healthCheckPath
58+
cors: {
59+
allowedOrigins: union([ 'https://portal.azure.com', 'https://ms.portal.azure.com' ], allowedOrigins)
60+
}
61+
}
62+
clientAffinityEnabled: clientAffinityEnabled
63+
httpsOnly: true
64+
}
65+
66+
identity: { type: managedIdentity ? 'SystemAssigned' : 'None' }
67+
68+
resource configLogs 'config' = {
69+
name: 'logs'
70+
properties: {
71+
applicationLogs: { fileSystem: { level: 'Verbose' } }
72+
detailedErrorMessages: { enabled: true }
73+
failedRequestsTracing: { enabled: true }
74+
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
75+
}
76+
}
77+
78+
resource basicPublishingCredentialsPoliciesFtp 'basicPublishingCredentialsPolicies' = {
79+
name: 'ftp'
80+
properties: {
81+
allow: false
82+
}
83+
}
84+
85+
resource basicPublishingCredentialsPoliciesScm 'basicPublishingCredentialsPolicies' = {
86+
name: 'scm'
87+
properties: {
88+
allow: false
89+
}
90+
}
91+
}
92+
93+
module config 'appservice-appsettings.bicep' = if (!empty(appSettings)) {
94+
name: '${name}-appSettings'
95+
params: {
96+
name: appService.name
97+
appSettings: union(appSettings,
98+
{
99+
SCM_DO_BUILD_DURING_DEPLOYMENT: string(scmDoBuildDuringDeployment)
100+
ENABLE_ORYX_BUILD: string(enableOryxBuild)
101+
},
102+
runtimeName == 'python' && appCommandLine == '' ? { PYTHON_ENABLE_GUNICORN_MULTIWORKERS: 'true' } : {},
103+
!empty(applicationInsightsName) ? { APPLICATIONINSIGHTS_CONNECTION_STRING: applicationInsights.properties.ConnectionString } : {},
104+
!empty(keyVaultName) ? { AZURE_KEY_VAULT_ENDPOINT: keyVault.properties.vaultUri } : {})
105+
}
106+
}
107+
108+
resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = if (!(empty(keyVaultName))) {
109+
name: keyVaultName
110+
}
111+
112+
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing = if (!empty(applicationInsightsName)) {
113+
name: applicationInsightsName
114+
}
115+
116+
output identityPrincipalId string = managedIdentity ? appService.identity.principalId : ''
117+
output name string = appService.name
118+
output uri string = 'https://${appService.properties.defaultHostName}'

infra/core/host/appserviceplan.bicep

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
metadata description = 'Creates an Azure App Service plan.'
2+
param name string
3+
param location string = resourceGroup().location
4+
param tags object = {}
5+
6+
param kind string = ''
7+
param reserved bool = true
8+
param sku object
9+
10+
resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
11+
name: name
12+
location: location
13+
tags: tags
14+
sku: sku
15+
kind: kind
16+
properties: {
17+
reserved: reserved
18+
}
19+
}
20+
21+
output id string = appServicePlan.id
22+
output name string = appServicePlan.name

0 commit comments

Comments
 (0)