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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Application Gateway v2 example #1036

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions docs/examples/101/application-gateway-v2-autoscale-create/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
param virtualNetworkName string = 'Application-Vnet'
param vnetAddressPrefix string = '10.0.0.0/16'
param subnetName string = 'ApplicationGatewaySubnet'
param subnetPrefix string = '10.0.0.0/24'
param applicationGatewayName string = 'applicationGatewayV2'
param minCapacity int = 2
param maxCapacity int = 10
param frontendPort int = 80
param backendPort int = 80
param backendIPAddresses array {
default: [
{
IpAddress: '10.0.0.4'
}
{
IpAddress: '10.0.0.5'
}
]
}
param cookieBasedAffinity string {
default: 'Disabled'
allowed: [
'Enabled'
'Disabled'
]
}
param location string = resourceGroup().location

var appGwPublicIpName = '${applicationGatewayName}-pip'

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2020-06-01' = {
name: virtualNetworkName
location: location
properties: {
addressSpace: {
addressPrefixes: [
vnetAddressPrefix
]
}
subnets: [
{
name: subnetName
properties: {
addressPrefix: subnetPrefix
}
}
]
}
}

resource publicIP 'Microsoft.Network/publicIPAddresses@2020-06-01' = {
name: appGwPublicIpName
location: location
sku: {
name: 'Standard'
}
properties: {
publicIPAllocationMethod: 'Static'
}
}

resource applicationGateway 'Microsoft.Network/applicationGateways@2020-06-01' = {
name: applicationGatewayName
location: location
properties: {
sku: {
name: 'Standard_v2'
tier: 'Standard_v2'
}
autoscaleConfiguration: {
minCapacity: minCapacity
maxCapacity: maxCapacity
}
gatewayIPConfigurations: [
{
name: 'appGatewayIpConfig'
properties: {
subnet: {
id: resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName, subnetName)
MCKLMT marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
]
frontendIPConfigurations: [
{
name: 'appGatewayFrontendIp'
properties: {
publicIPAddress: {
id: publicIP.id
}
}
}
]
frontendPorts: [
{
name: 'appGatewayFrontendPort'
properties: {
port: frontendPort
}
}
]
backendAddressPools: [
{
name: 'appGatewayBackendPool'
properties: {
backendAddresses: backendIPAddresses
}
}
]
backendHttpSettingsCollection: [
{
name: 'appGatewayBackendHttpSettings'
properties: {
port: backendPort
protocol: 'Http'
cookieBasedAffinity: cookieBasedAffinity
}
}
]
httpListeners: [
{
name: 'appGatewayHttpListener'
properties: {
frontendIPConfiguration: {
id: resourceId('Microsoft.Network/applicationGateways/frontendIPConfigurations', applicationGatewayName, 'appGatewayFrontendIp')
}
frontendPort: {
id: resourceId('Microsoft.Network/applicationGateways/frontendPorts', applicationGatewayName, 'appGatewayFrontendPort')
}
protocol: 'Http'
}
}
]
requestRoutingRules: [
{
name: 'rule1'
properties: {
ruleType: 'Basic'
httpListener: {
id: resourceId('Microsoft.Network/applicationGateways/httpListeners', applicationGatewayName, 'appGatewayHttpListener')
}
backendAddressPool: {
id: resourceId('Microsoft.Network/applicationGateways/backendAddressPools', applicationGatewayName, 'appGatewayBackendPool')
}
backendHttpSettings: {
id: resourceId('Microsoft.Network/applicationGateways/backendHttpSettingsCollection', applicationGatewayName, 'appGatewayBackendHttpSettings')
}
}
}
]
}
dependsOn: [
virtualNetwork
publicIP
MCKLMT marked this conversation as resolved.
Show resolved Hide resolved
]
}
201 changes: 201 additions & 0 deletions docs/examples/101/application-gateway-v2-autoscale-create/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualNetworkName": {
"type": "string",
"defaultValue": "Application-Vnet"
},
"vnetAddressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/16"
},
"subnetName": {
"type": "string",
"defaultValue": "ApplicationGatewaySubnet"
},
"subnetPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/24"
},
"applicationGatewayName": {
"type": "string",
"defaultValue": "applicationGatewayV2"
},
"minCapacity": {
"type": "int",
"defaultValue": 2
},
"maxCapacity": {
"type": "int",
"defaultValue": 10
},
"frontendPort": {
"type": "int",
"defaultValue": 80
},
"backendPort": {
"type": "int",
"defaultValue": 80
},
"backendIPAddresses": {
"type": "array",
"defaultValue": [
{
"IpAddress": "10.0.0.4"
},
{
"IpAddress": "10.0.0.5"
}
]
},
"cookieBasedAffinity": {
"type": "string",
"defaultValue": "Disabled",
"allowedValues": [
"Enabled",
"Disabled"
]
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
}
},
"functions": [],
"variables": {
"appGwPublicIpName": "[format('{0}-pip', parameters('applicationGatewayName'))]"
},
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2020-06-01",
"name": "[parameters('virtualNetworkName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('vnetAddressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('subnetName')]",
"properties": {
"addressPrefix": "[parameters('subnetPrefix')]"
}
}
]
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2020-06-01",
"name": "[variables('appGwPublicIpName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"properties": {
"publicIPAllocationMethod": "Static"
}
},
{
"type": "Microsoft.Network/applicationGateways",
"apiVersion": "2020-06-01",
"name": "[parameters('applicationGatewayName')]",
"location": "[parameters('location')]",
"properties": {
"sku": {
"name": "Standard_v2",
"tier": "Standard_v2"
},
"autoscaleConfiguration": {
"minCapacity": "[parameters('minCapacity')]",
"maxCapacity": "[parameters('maxCapacity')]"
},
"gatewayIPConfigurations": [
{
"name": "appGatewayIpConfig",
"properties": {
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnetName'))]"
}
}
}
],
"frontendIPConfigurations": [
{
"name": "appGatewayFrontendIp",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('appGwPublicIpName'))]"
}
}
}
],
"frontendPorts": [
{
"name": "appGatewayFrontendPort",
"properties": {
"port": "[parameters('frontendPort')]"
}
}
],
"backendAddressPools": [
{
"name": "appGatewayBackendPool",
"properties": {
"backendAddresses": "[parameters('backendIPAddresses')]"
}
}
],
"backendHttpSettingsCollection": [
{
"name": "appGatewayBackendHttpSettings",
"properties": {
"port": "[parameters('backendPort')]",
"protocol": "Http",
"cookieBasedAffinity": "[parameters('cookieBasedAffinity')]"
}
}
],
"httpListeners": [
{
"name": "appGatewayHttpListener",
"properties": {
"frontendIPConfiguration": {
"id": "[resourceId('Microsoft.Network/applicationGateways/frontendIPConfigurations', parameters('applicationGatewayName'), 'appGatewayFrontendIp')]"
},
"frontendPort": {
"id": "[resourceId('Microsoft.Network/applicationGateways/frontendPorts', parameters('applicationGatewayName'), 'appGatewayFrontendPort')]"
},
"protocol": "Http"
}
}
],
"requestRoutingRules": [
{
"name": "rule1",
"properties": {
"ruleType": "Basic",
"httpListener": {
"id": "[resourceId('Microsoft.Network/applicationGateways/httpListeners', parameters('applicationGatewayName'), 'appGatewayHttpListener')]"
},
"backendAddressPool": {
"id": "[resourceId('Microsoft.Network/applicationGateways/backendAddressPools', parameters('applicationGatewayName'), 'appGatewayBackendPool')]"
},
"backendHttpSettings": {
"id": "[resourceId('Microsoft.Network/applicationGateways/backendHttpSettingsCollection', parameters('applicationGatewayName'), 'appGatewayBackendHttpSettings')]"
}
}
}
]
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', variables('appGwPublicIpName'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]"
]
}
]
}