Last active
August 25, 2024 13:50
-
-
Save scottsauber/38c9fceb811c2d4b58b74ceefa4a2269 to your computer and use it in GitHub Desktop.
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
param appName string | |
@allowed(['dev', 'prod']) | |
param environment string | |
param location string | |
// This is reused between the App Service and the Slot | |
var appServiceProperties = { | |
serverFarmId: appServicePlan.id | |
httpsOnly: true | |
siteConfig: { | |
http20Enabled: true | |
linuxFxVersion: 'DOTNETCORE|8.0' | |
alwaysOn: true | |
ftpsState: 'Disabled' | |
minTlsVersion: '1.2' | |
webSocketsEnabled: true | |
requestTracingEnabled: true | |
detailedErrorLoggingEnabled: true | |
httpLoggingEnabled: true | |
} | |
} | |
resource appServicePlan 'Microsoft.Web/serverfarms@2022-09-01' = { | |
name: 'asp-${appName}-${environment}' | |
location: location | |
sku: { | |
name: 'P0V3' | |
} | |
kind: 'linux' | |
properties: { | |
reserved: true | |
} | |
} | |
resource appService 'Microsoft.Web/sites@2022-09-01' = { | |
name: 'app-${appName}-${environment}' | |
location: location | |
identity: { | |
type: 'SystemAssigned' | |
} | |
properties: appServiceProperties | |
} | |
resource appSettings 'Microsoft.Web/sites/config@2022-09-01' = { | |
name: 'appsettings' | |
kind: 'string' | |
parent: appService | |
properties: { | |
ASPNETCORE_ENVIRONMENT: environment | |
} | |
} | |
resource appServiceSlot 'Microsoft.Web/sites/slots@2022-09-01' = { | |
location: location | |
parent: appService | |
name: 'slot' | |
identity: { | |
type: 'SystemAssigned' | |
} | |
properties: appServiceProperties | |
} | |
resource appServiceSlotSetting 'Microsoft.Web/sites/slots/config@2022-09-01' = { | |
name: 'appsettings' | |
kind: 'string' | |
parent: appServiceSlot | |
properties: { | |
ASPNETCORE_ENVIRONMENT: environment | |
} | |
} |
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
param location string = 'eastus' | |
@allowed(['dev', 'prod']) | |
param environment string | |
// Normally I like creating the Resource Groups too in Bicep, but for this workshop that would require more permissions to give people than I'd like | |
targetScope = 'resourceGroup' | |
module app './appservice.bicep' = { | |
name: 'appservice' | |
params: { | |
appName: 'dometrain-github-actions-scottsauber' | |
environment: environment | |
location: location | |
} | |
} |
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
- name: Run Bicep | |
run: | | |
az deployment group create \ | |
--name ${{ inputs.env }}-deployment-${{ github.run_number }} \ | |
--template-file infrastructure/main.bicep \ | |
--resource-group ${{ inputs.resource_group_name }} \ | |
--verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would be better to put use a param for appName in main.bicep.