Azure 部署槽 - 使用 powershell 将其添加到虚拟网络

Azure deployment slots - Adding it to a virtual network using powershell

我正在尝试将 Azure 部署槽添加到虚拟网络。下面是我目前用于将 webapp 添加到 Vnet 的 powershell 脚本,它工作正常:

#Property array with the SubnetID
$properties = @{
  subnetResourceId = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualNetworks/vnetName/subnets/subnetName"
}

#Creation of the VNet integration
$vnetParams = @{
  ResourceName = "WebappName/VirtualNetwork"
  Location = "South Central US"
  ResourceGroupName = "resourceGroupName"
  ResourceType = "Microsoft.Web/sites/networkConfig"
  PropertyObject = $properties
}
New-AzResource @vnetParams -Force

如何更改上述脚本以使用同一个 webapp 的部署槽? 提前致谢。

您可以像这样更改您的代码。注意 ResourceNameResourceType.

的变化
#Property array with the SubnetID
$properties = @{
  subnetResourceId = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualNetworks/vnetName/subnets/subnetName"
}

#Creation of the VNet integration
$vnetParams = @{
  ResourceName = "WebappName/slot/VirtualNetwork"
  Location = "South Central US"
  ResourceGroupName = "resourceGroupName"
  ResourceType = "Microsoft.Web/sites/slots/networkConfig"
  PropertyObject = $properties
}
New-AzResource @vnetParams -Force