Skip to content

Commit 20ea2f4

Browse files
authored
Merge pull request #171 from davidxw/main
Enable diagnostic settings for App Service
2 parents e32d34c + cd81b4a commit 20ea2f4

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

.github/workflows/open-ai-app.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ jobs:
7878
with:
7979
inlineScript: |
8080
rg=$(az webapp list --query "[?name=='${{ secrets.AZURE_APP_SERVICE_NAME }}'].resourceGroup" --output tsv)
81-
az webapp config appsettings set -n ${{ secrets.AZURE_APP_SERVICE_NAME }} -g $rg --settings SCM_DO_BUILD_DURING_DEPLOYMENT=false
82-
az webapp config set --startup-file="node server.js" -n ${{ secrets.AZURE_APP_SERVICE_NAME }} -g $rg
81+
echo Setting SCM_DO_BUILD_DURING_DEPLOYMENT=false on app service ${{ secrets.AZURE_APP_SERVICE_NAME }}
82+
az webapp config appsettings set -n ${{ secrets.AZURE_APP_SERVICE_NAME }} -g $rg --settings SCM_DO_BUILD_DURING_DEPLOYMENT=false -o none
83+
echo Setting --startup-file=\"node server.js\" on app service ${{ secrets.AZURE_APP_SERVICE_NAME }}
84+
az webapp config set --startup-file="node server.js" -n ${{ secrets.AZURE_APP_SERVICE_NAME }} -g $rg -o none
8385
sleep 10
8486
8587
- name: 🚀 Deploy to Azure Web App

infra/resources.bicep

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ var appservice_name = toLower('${name}-app-${resourceToken}')
3434
// keyvault name must be less than 24 chars - token is 13
3535
var kv_prefix = take(name, 7)
3636
var keyVaultName = toLower('${kv_prefix}-kv-${resourceToken}')
37+
var la_workspace_name = toLower('${name}-la-${resourceToken}')
38+
var diagnostic_setting_name = 'AppServiceConsoleLogs'
3739

3840
var keyVaultSecretsUserRole = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '4633458b-17de-408a-b874-0445c86b69e6')
3941

@@ -64,7 +66,6 @@ var deployments = [
6466
}
6567
]
6668

67-
6869
resource appServicePlan 'Microsoft.Web/serverfarms@2020-06-01' = {
6970
name: appservice_name
7071
location: location
@@ -166,6 +167,26 @@ resource webApp 'Microsoft.Web/sites@2020-06-01' = {
166167
identity: { type: 'SystemAssigned'}
167168
}
168169

170+
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2021-12-01-preview' = {
171+
name: la_workspace_name
172+
location: location
173+
}
174+
175+
resource webDiagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
176+
name: diagnostic_setting_name
177+
scope: webApp
178+
properties: {
179+
workspaceId: logAnalyticsWorkspace.id
180+
logs: [
181+
{
182+
category: 'AppServiceConsoleLogs'
183+
enabled: true
184+
}
185+
]
186+
metrics: []
187+
}
188+
}
189+
169190
resource kvFunctionAppPermissions 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
170191
name: guid(kv.id, webApp.name, keyVaultSecretsUserRole)
171192
scope: kv

0 commit comments

Comments
 (0)