Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃敤 DevOps - Fix Broken App Insights #2328

Merged
merged 10 commits into from Mar 19, 2024
2 changes: 1 addition & 1 deletion .github/workflows/template-build.yml
Expand Up @@ -79,7 +79,7 @@ jobs:
run: |
# AppInsight - Connection String
az config set extension.use_dynamic_install=yes_without_prompt
$AppInsightName = if ("${{ inputs.tag }}" -ieq "production") { "${{ env.APP_INSIGHT_PROD }}" } else { "${{ env.APP_INSIGHT_DEV }}" }
$AppInsightName = if ("${{ inputs.tag }}" -clike "pr-*") { "${{ env.APP_INSIGHT_DEV }}" } else { "${{ env.APP_INSIGHT_PROD }}" }

$AppInsightConnectionString = (az monitor app-insights component show --resource-group ${{ env.AZURE_RESOURCE_GROUP }} --app $AppInsightName --query connectionString -o tsv)
echo "AppInsightConnectionString=$AppInsightConnectionString" >> $env:GITHUB_OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions infra/appInsight.bicep
Expand Up @@ -20,7 +20,7 @@ resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10
}
}

resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
name: appInsightName
location: location
kind: 'web'
Expand All @@ -31,7 +31,7 @@ resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10
Request_Source: 'rest'
WorkspaceResourceId: logAnalyticsWorkspace.id
}
}
}

output applicationInsightsId string = applicationInsights.id
output appInsightConnectionString string = applicationInsights.properties.ConnectionString
13 changes: 13 additions & 0 deletions infra/main.bicep
Expand Up @@ -38,6 +38,10 @@ var value = {
'cost-category': 'value'
}

var dev = {
'cost-category': 'dev/test'
}

module acr 'acr.bicep' = {
name: 'acr-${now}'
params: {
Expand All @@ -61,6 +65,15 @@ module appInsight 'appInsight.bicep' = {
}
}

module appInsightLocal 'appInsight.bicep' = {
name: 'appInsight-local-${now}'
params: {
projectName: '${projectName}-local'
location: location
tags: dev
}
}

module appService 'appService.bicep' = {
name: 'appService-${now}'
params: {
Expand Down