我正在尝试将azure部署插槽添加到虚拟网络。以下是我当前用于将Web应用程序添加到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
如何更改以上脚本以使其与同一个Web应用程序的部署插槽配合使用? 预先感谢。
答案 0 :(得分:0)
您可以像这样更改代码。请注意ResourceName
和ResourceType
的变化。
#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