Skip to content

Commit

Permalink
🔨 DevOps - Fix Broken App Insights (#2328)
Browse files Browse the repository at this point in the history
* fixed formatting on bicep

* added test tracking event

* added fix to magic string looking for production one

* removed test useeffect

* added production tag variable

* fixed erraneous double quote

* added local testing app insights env

* Update .github/workflows/template-build.yml

Co-authored-by: Matt Wicks [SSW] <[email protected]>

* Update .github/workflows/template-build.yml

Co-authored-by: Matt Wicks [SSW] <[email protected]>

---------

Co-authored-by: Matt Wicks [SSW] <[email protected]>
  • Loading branch information
Harry-Ross and wicksipedia authored Mar 19, 2024
1 parent 193d532 commit 6d171f7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/template-build.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 6d171f7

Please sign in to comment.