Skip to content

Instantly share code, notes, and snippets.

@mattruma
Last active March 27, 2021 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattruma/120805a96744d7f33715760c212de6a1 to your computer and use it in GitHub Desktop.
Save mattruma/120805a96744d7f33715760c212de6a1 to your computer and use it in GitHub Desktop.
Adventures with Bicep: How to Create an App Service for Containers
param resourcePrefix string
resource plan 'Microsoft.Web/serverfarms@2020-06-01' = {
name: '${resourcePrefix}plan'
location: resourceGroup().location
sku: {
name: 'B2'
capacity: 1
}
kind: 'linux'
}
resource acr 'Microsoft.ContainerRegistry/registries@2020-11-01-preview' = {
name: '${resourcePrefix}acr'
location: resourceGroup().location
sku: {
name: 'Basic'
}
properties: {
adminUserEnabled: true
}
}
resource app 'Microsoft.Web/sites@2020-06-01' = {
name: '${resourcePrefix}app'
location: resourceGroup().location
kind: 'app,linux,container'
identity: {
type: 'SystemAssigned'
}
properties: {
serverFarmId: plan.id
httpsOnly: true
siteConfig: {
alwaysOn: true
minTlsVersion: '1.2'
appSettings: [
{
name: 'WEBSITES_ENABLE_APP_SERVICE_STORAGE'
value: 'false'
}
{
name: 'DOCKER_REGISTRY_SERVER_PASSWORD'
value: listCredentials(resourceId('Microsoft.ContainerRegistry/registries', acr.name), '2020-11-01-preview').passwords[0].value
}
{
name: 'DOCKER_REGISTRY_SERVER_URL'
value: '${resourcePrefix}acr.azurecr.io'
}
{
name: 'DOCKER_REGISTRY_SERVER_USERNAME'
value: '${resourcePrefix}acr'
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment