Skip to content

Instantly share code, notes, and snippets.

@MattHodge
Created January 31, 2022 12:06
Show Gist options
  • Save MattHodge/65674ec14198c8ead33d5b0b1d3bd932 to your computer and use it in GitHub Desktop.
Save MattHodge/65674ec14198c8ead33d5b0b1d3bd932 to your computer and use it in GitHub Desktop.
Basic AppGW
param name string
param subnetId string
param publicIpId string
var nameFrontendPortHTTP = 'frontend-port-http'
var nameFrontendIPConfiguration = 'frontend-ip'
var nameHTTPListener = 'placeholder_http_listener_managed_by_bicep'
var nameBackendAddressPool = 'placeholder_backend_address_pool_managed_by_bicep'
var nameBackendHttpSettings = 'DefaultHTTP'
resource appgw 'Microsoft.Network/applicationGateways@2021-05-01' = {
name: name
location: resourceGroup().location
properties: {
globalConfiguration:{
enableRequestBuffering: false
enableResponseBuffering: false
}
sku: {
name: 'Standard_v2'
tier: 'Standard_v2'
}
autoscaleConfiguration: {
minCapacity: 0
maxCapacity: 2
}
gatewayIPConfigurations: [
{
name: '${name}-ip-config'
properties: {
subnet: {
id: subnetId
}
}
}
]
frontendPorts: [
{
name: nameFrontendPortHTTP
properties: {
port: 80
}
}
]
frontendIPConfigurations: [
{
name: nameFrontendIPConfiguration
properties: {
publicIPAddress: {
id: publicIpId
}
}
}
]
backendAddressPools: [
{
name: nameBackendAddressPool
}
]
backendHttpSettingsCollection: [
{
name: nameBackendHttpSettings
properties: {
cookieBasedAffinity: 'Disabled'
port: 80
protocol: 'Http'
requestTimeout: 30
}
}
]
httpListeners: [
{
name: nameHTTPListener
properties: {
frontendIPConfiguration: {
id: resourceId('Microsoft.Network/applicationGateways/frontendIPConfigurations', name, nameFrontendIPConfiguration)
}
frontendPort: {
id: resourceId('Microsoft.Network/applicationGateways/frontendPorts', name, nameFrontendPortHTTP)
}
}
}
]
requestRoutingRules: [
{
name: 'placeholder_request_routing_rule_managed_by_bicep'
properties: {
ruleType: 'Basic'
httpListener: {
id: resourceId('Microsoft.Network/applicationGateways/httpListeners', name, nameHTTPListener)
}
backendAddressPool: {
id: resourceId('Microsoft.Network/applicationGateways/backendAddressPools', name, nameBackendAddressPool)
}
backendHttpSettings: {
id: resourceId('Microsoft.Network/applicationGateways/backendHttpSettingsCollection', name, nameBackendHttpSettings)
}
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment