Create an Application Gateway with Public IP

{"apiversion": "2020-05-01", "type": "microsoft.network/publicipaddresses", "name": "[variables('publicipaddressname')]", "location": "[parameters('location')]", "properties": {"publicipallocationmethod": "dynamic"}}{"apiversion": "2020-05-01", "type": "microsoft.network/virtualnetworks", "name": "[variables('virtualnetworkname')]", "location": "[parameters('location')]", "properties": {"addressspace": {"addressprefixes": ["[parameters('addressprefix')]"]}, "subnets": [{"name": "[variables('subnetname')]", "properties": {"addressprefix": "[parameters('subnetprefix')]"}}]}}{"apiversion": "2020-05-01", "name": "[variables('applicationgatewayname')]", "type": "microsoft.network/applicationgateways", "location": "[parameters('location')]", "dependson": ["[resourceid('microsoft.network/virtualnetworks/", variables('virtualnetworkname'))]", "[resourceid('microsoft.network/publicipaddresses/", variables('publicipaddressname'))]"], "properties": {"sku": {"name": "[parameters('skuname')]", "tier": "standard", "capacity": "[parameters('capacity')]"}, "sslcertificates": [{"name": "appgatewaysslcert", "properties": {"data": "[parameters('certdata')]", "password": "[parameters('certpassword')]"}}], "gatewayipconfigurations": [{"name": "appgatewayipconfig", "properties": {"subnet": {"id": "[resourceid('microsoft.network/virtualnetworks/subnets", variables('virtualnetworkname'), variables('subnetname'))]"}}}], "frontendipconfigurations": [{"name": "appgatewayfrontendip", "properties": {"publicipaddress": {"id": "[resourceid('microsoft.network/publicipaddresses",variables('publicipaddressname'))]"}}}], "frontendports": [{"name": "appgatewayfrontendport", "properties": {"port": 443}}], "backendaddresspools": [{"name": "appgatewaybackendpool", "properties": {"backendaddresses": [{"ipaddress": "[parameters('backendipaddress1')]"}, {"ipaddress": "[parameters('backendipaddress2')]"}]}}], "backendhttpsettingscollection": [{"name": "appgatewaybackendhttpsettings", "properties": {"port": 80, "protocol": "http", "cookiebasedaffinity": "disabled"}}], "httplisteners": [{"name": "appgatewayhttplistener", "properties": {"frontendipconfiguration": {"id": "[resourceid('microsoft.network/applicationgateways/frontendipconfigurations",variables('applicationgatewayname'), "appgatewayfrontendip')]"}, "frontendport": {"id": "[resourceid('microsoft.network/applicationgateways/frontendports",variables('applicationgatewayname'), "appgatewayfrontendport')]"}, "protocol": "https", "sslcertificate": {"id": "[resourceid('microsoft.network/applicationgateways/sslcertificates",variables('applicationgatewayname'), "appgatewaysslcert')]"}}}], "requestroutingrules": [{"name": "rule1", "properties": {"ruletype": "basic", "httplistener": {"id": "[resourceid('microsoft.network/applicationgateways/httplisteners",variables('applicationgatewayname'), "appgatewayhttplistener')]"}, "backendaddresspool": {"id": "[resourceid('microsoft.network/applicationgateways/backendaddresspools",variables('applicationgatewayname'), "appgatewaybackendpool')]"}, "backendhttpsettings": {"id": "[resourceid('microsoft.network/applicationgateways/backendhttpsettingscollection",variables('applicationgatewayname'), "appgatewaybackendhttpsettings')]"}}}]}}