可以在两个Azure Web应用程序上配置网络配置

发布于 2025-02-12 05:38:56 字数 1987 浏览 2 评论 0原文

面对我不了解的VNET和Azure Web应用程序的问题。

我的问题

这是我的设置:

sp1 (sp1(p1v2:1))和vnet, vnet1

“在此处输入图像描述”

两个子网都有 microsoft.web/serverfarms 委托。

我想在我的WebApps WebApps1 WebApps4 上添加网络配置。

我运行此PowerShell脚本:

properties = @{
    subnetResourceId = "/subscriptions/XXX/resourceGroups/RG1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/sub01"
}

$vNetParams = @{
    ResourceName      = "mywebapps1/VirtualNetwork"
    Location          = "West Europe"
    ResourceGroupName = "RG1"
    ResourceType      = "Microsoft.Web/sites/networkConfig"
    PropertyObject    = $properties
}


$result = New-AzResource @vNetParams -Force

$properties = @{
    subnetResourceId = "/subscriptions/XXX/resourceGroups/RG1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/sub02"
}

$vNetParams = @{
    ResourceName      = "mywebapps4/VirtualNetwork"
    Location          = "West Europe"
    ResourceGroupName = "RG1"
    ResourceType      = "Microsoft.Web/sites/networkConfig"
    PropertyObject    = $properties
}

$result = New-AzResource @vNetParams -Force

第一个 new-azResource 正常工作:

“ https://i.sstatic.net/lj2w9.jpg” alt =“在此处输入图像说明”>

但是第二个抛出此错误消息:

new-azResource:{“代码”:“冲突”,“消息”:“添加此VNET将会 超过1

的应用程序服务计划VNET限制

我所做的

我搜索此错误消息。但是发现只有一种没有帮助我的情况,或者也许我不明白。

我需要的

  1. 了解它的含义。
  2. 我应该怎么做

谢谢你

Facing a problem about VNET and Azure Web Apps I don't understand.

My issue

This is my setting:

enter image description here

Two web apps on the same service plan SP1 (SP1 (P1v2: 1)) and a VNET, VNET1:

enter image description here

Both subnets have Microsoft.Web/serverFarms delegation.

I want to add network config on my webapps webapps1 and webapps4.

I run this PowerShell script:

properties = @{
    subnetResourceId = "/subscriptions/XXX/resourceGroups/RG1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/sub01"
}

$vNetParams = @{
    ResourceName      = "mywebapps1/VirtualNetwork"
    Location          = "West Europe"
    ResourceGroupName = "RG1"
    ResourceType      = "Microsoft.Web/sites/networkConfig"
    PropertyObject    = $properties
}


$result = New-AzResource @vNetParams -Force

$properties = @{
    subnetResourceId = "/subscriptions/XXX/resourceGroups/RG1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/sub02"
}

$vNetParams = @{
    ResourceName      = "mywebapps4/VirtualNetwork"
    Location          = "West Europe"
    ResourceGroupName = "RG1"
    ResourceType      = "Microsoft.Web/sites/networkConfig"
    PropertyObject    = $properties
}

$result = New-AzResource @vNetParams -Force

First new-azresource works fine:

enter image description here

But the second one throw this error message:

New-AzResource : {"Code":"Conflict","Message":"Adding this VNET would
exceed the App Service Plan VNET limit of 1

What I did

I search for this error message. But found only one situation that did not help me or maybe I did not understand.

What I need

  1. Understand what it means.
  2. How I should do

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蝶舞 2025-02-19 05:38:56
  • 区域虚拟集成可以每个工作人员使用一个虚拟接口,这意味着每个应用程序服务计划一个区域虚拟网络集成。同一应用服务计划中的所有应用程序只能将相同的虚拟网络集成到特定子网中。

  • 门道所需的虚拟网络集成使应用程序一次仅连接到一个虚拟网络。
    这可以使最多五个虚拟网络集成到应用程序服务计划中。

请参阅此文档有关不同的虚拟网络集成及其局限性的更多信息。

有关更多信息,您可以参考这些类似的线程:

https://social.msdn.microsoft.com/forums/en-us/a8b51183-d94b-48c9-9b6c-e6a4dbec9919/vnet-limitegration-limit-limit-limit---------- integration-limit-limit--forum = azureapecconfiguratiguration

  • Regional virtual integration can use One virtual interface per worker means one regional virtual network integration per App Service plan. All the apps in the same App Service plan can only use the same virtual network integration to a specific subnet.

  • Gate-way required virtual network integration Enables an app to connect to only one virtual network at a time.
    This can Enables up to five virtual networks to be integrated within an App Service plan.

Refer to this documentation for more information about different virtual network integrations and their limitations as well.

For more information you can refer to these similar threads:

https://social.msdn.microsoft.com/Forums/en-US/a8b51183-d94b-48c9-9b6c-e6a4dbec9919/vnet-integration-limit-of-1?forum=azureappconfiguration

遗弃M 2025-02-19 05:38:56

据我了解,您将获得所需的输出。请注意,您正在使用新的zresource,基本上是创建资源的,应该使用set-azResource命令。

建议

使用set-azResource代替new-azResource

配置vnet集成

$ subnetresourceid =“//subscriptions/qumsubscriptionid/resourcegroups/resourcegroups/quroupnecgroupname/quroupname providers/microsproviders/microsoft.network.network.network/
美元
$ webapp.properties.virtualnetworksubnetid = $ subnetresourceid
$ WebApp | set -azResource -force

区域VNET集成功能基本上是使用REST API调用,在Microsoft.network/virtualnetwork和Microsoft.web/serverfarm资源之间创建关联或链接。
在这种情况下,您使用的是新的zresoruce,它调用REST API来建立已经存在的服务关联,因此其投掷错误。如果您尝试从门户网站执行此操作,则不应得到该操作,因为门户网站验证会处理REST API调用类型。

As per my understanding you're getting desired output. Please note that you are using New-AzResource which basically creates resources instead you should use Set-AzResource command.

Suggestion

Use Set-AzResource instead of New-AzResource

Configure VNet Integration

$subnetResourceId = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Network/virtualNetworks/$vNetName/subnets/$integrationSubnetName"
$webApp = Get-AzResource -ResourceType Microsoft.Web/sites -ResourceGroupName $resourceGroupName -ResourceName $siteName
$webApp.Properties.virtualNetworkSubnetId = $subnetResourceId
$webApp | Set-AzResource -Force

Regional VNet integration feature basically creates association or link between Microsoft.Network/VirtualNetwork and Microsoft.Web/Serverfarm resources using Rest API call.
In this scenario you're using New-AzResoruce which invoke REST API for creation of service association which is already existed hence its throwing error. If you try to do it from portal you shouldn't get that as portal validation takes care of type of REST API call.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文