我已经创建了一个模板,它似乎做了创建连接所需的一切,但由于某种原因没有建立连接.查看门户网站显示该站点已连接到vNet并且证书已同步,但vNet网关上的点对站配置未显示活动连接.
但是,如果我从vNet断开Web应用程序的连接,然后使用Azure门户中的设置按钮重新连接到同一个vNet,则一切正常.
我的模板中肯定会有一些东西丢失,但过去几个小时看起来我无法解决问题
这是我的ARM模板
{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.Json#","contentVersion": "1.0.0.0","parameters": { },"variables": { },"resources": [ { "type": "Microsoft.Network/networkSecurityGroups","name": "[variables('nsgname')]","APIVersion": "2016-03-30","location": "[parameters('location')]","propertIEs": { "securityRules": [] },"resources": [ ],"dependsOn": [ ] },{ "type": "Microsoft.Network/networkSecurityGroups","name": "[variables('infrastructureNsgname')]",{ "type": "Microsoft.Network/virtualNetworks","name": "[variables('vnetname')]","propertIEs": { "addressspace": { "addressprefixes": [ "10.1.0.0/16" ] },"subnets": [ { "name": "default","propertIEs": { "addressprefix": "10.1.0.0/17","networkSecurityGroup": { "ID": "[resourceID('Microsoft.Network/networkSecurityGroups',variables('nsgname'))]" } } },{ "name": "infrastructure","propertIEs": { "addressprefix": "10.1.254.0/24",variables('infrastructureNsgname'))]" } } },{ "name": "Gatewaysubnet","propertIEs": { "addressprefix": "10.1.128.0/24" } } ] },"dependsOn": [ "[resourceID('Microsoft.Network/networkSecurityGroups',variables('nsgname'))]","[resourceID('Microsoft.Network/networkSecurityGroups',variables('infrastructureNsgname'))]" ] },{ "type": "Microsoft.Web/sites","kind": "API","name": "[variables('gatewaySitename')]","APIVersion": "2015-08-01","propertIEs": { "name": "[variables('gatewaySitename')]","hostnames": [ "[concat(variables('gatewaySitename'),'.azurewebsites.net')]" ],"enabledHostnames": [ "[concat(variables('gatewaySitename'),'.azurewebsites.net')]","[concat(variables('gatewaySitename'),'.scm.azurewebsites.net')]" ],"hostnameSslStates": [ { "name": "[concat(variables('gatewaySitename'),"sslState": 0,"thumbprint": null,"ipBasedSslState": 0 },{ "name": "[concat(variables('gatewaySitename'),'.scm.azurewebsites.net')]","ipBasedSslState": 0 } ],"serverFarmID": "[resourceID('Microsoft.Web/serverfarms',variables('gatewayServerFarmname'))]" },"resources": [],"dependsOn": [ "[resourceID('Microsoft.Web/serverfarms',variables('gatewayServerFarmname'))]","[concat('Microsoft.Network/virtualNetworks/',variables('vnetname'))]" ] },{ "type": "Microsoft.Web/serverfarms","sku": { "name": "S1","tIEr": "Standard","size": "S1","family": "S","capacity": 1 },"kind": "","name": "[variables('gatewayServerFarmname')]","propertIEs": { "name": "[variables('gatewayServerFarmname')]","numberOfWorkers": 1 },{ "name": "[variables('vnetGatewayIpname')]","type": "Microsoft.Network/publicIPAddresses","APIVersion": "2015-06-15","propertIEs": { "publicIPAllocationMethod": "Dynamic" } },{ "name": "[variables('vnetGatewayname')]","type": "Microsoft.Network/virtualNetworkGateways","dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/',variables('vnetGatewayIpname'))]",variables('vnetname'))]" ],"propertIEs": { "ipConfigurations": [ { "propertIEs": { "privateIPAllocationMethod": "Dynamic","subnet": { "ID": "[resourceID('Microsoft.Network/virtualNetworks/subnets',variables('vnetname'),'Gatewaysubnet')]" },"publicIPAddress": { "ID": "[resourceID('Microsoft.Network/publicIPAddresses',variables('vnetGatewayIpname'))]" } },"name": "vnetGatewayConfig" } ],"gatewayType": "Vpn","vpnType": "RouteBased","enableBgp": false,"vpnClIEntConfiguration": { "vpnClIEntAddresspool": { "addressprefixes": [ "172.16.201.0/24" ] },"vpnClIEntRootCertificates": [ { "name": "AppServiceCertificate.cer","propertIEs": { "PublicCertData": "[reference(concat('Microsoft.Web/sites/',variables('gatewaySitename'),'/virtualNetworkConnections/virtualNetworkConnections')).certBlob]" } } ] } } },{ "name": "[variables('gatewayVnetConnectionname')]","type": "Microsoft.Web/sites/virtualNetworkConnections","dependsOn": [ "[concat('Microsoft.Web/sites/',variables('gatewaySitename'))]","propertIEs": { "vnetResourceID": "[resourceID('Microsoft.Network/virtualNetworks',variables('vnetname'))]" } } ]}解决方法 我只能通过ARM模板来完成这项工作.
但是,如果您可以在创建后再花费一个PowerShell命令,那么它可以很好地工作:
# Set VNET Integration for Web App$ResourceGroup = "WeMadeThatInWestEuropeDIDntWe"$WebApp = "LearningMomentsInProduction"$PropertIEsObject = @{ vnetname = "JimAreYouSureThisIsTheStagingVNET";}Set-AzureRmResource -PropertyObject $PropertIEsObject ` -ResourceGroupname $ResourceGroup ` -ResourceType Microsoft.Web/sites/config ` -Resourcename $WebApp/web ` -APIVersion 2015-08-01 -Force -Verbose | Select -expand PropertIEs | Select Vnetname# Expected output:## Vnetname # -------- # JimAreYouSureThisIsTheStagingVNET## At this point your Web App is hooked up to the VNET
编辑:
这不符合我的想法.
要重新同步Point-to-site证书:
$ResourceGroup = "WeMadeThatInWestEuropeDIDntWe"# VNET name or Gateway name,try with gateway name!$vnetname = "JimAreYouSureThisIsTheStagingVNET";$PropertIEsObject = @{ resyncrequired = "true"}Set-AzureRmResource -PropertyObject $PropertIEsObject -ResourceGroupname $ResourceGroup ` -ResourceType Microsoft.Web/sites/virtualNetworkConnections ` -Resourcename $Vnetname -APIVersion 2015-08-01 ` -Force -Verbose总结
以上是内存溢出为你收集整理的使用ARM模板将Azure Web App连接到vNet全部内容,希望文章能够帮你解决使用ARM模板将Azure Web App连接到vNet所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)