简体   繁体   English

Azure公共IP计划的更改

[英]Azure Public IP scheduled change

I've got an Azure Load Balancer with: 我有一个Azure负载平衡器,具有:

  • Load Balancer fronend IP config: Azure Public IP (dynamic) 负载平衡器前IP配置:Azure公用IP(动态)

  • Load Balancer backend pool: single VM 负载均衡器后端池:单个VM

Is there a way to schedule periodically change of Azure Public IP? 有没有办法定期安排Azure公共IP的更改? Maybe using automation scripts? 也许使用自动化脚本? Or maybe I can create multiple Azure Public IPs and make LB to switch them periodically? 或者,也许我可以创建多个Azure公共IP并使LB定期切换它们?

Yes, it is possible. 对的,这是可能的。 You could use the following example. 您可以使用以下示例。

$rgName = "shuilinux"
$nicName = "shui648"
$pipName = "shui-ip"
##unattach public IP on nic
$nic = Get-AzureRmNetworkInterface -ResourceGroupName $rgName -Name $nicName
$nic.IpConfigurations.PublicIpAddress.Id=""
$nic|Set-AzureRmNetworkInterface

##attach public IP to a nic
##If you want to create a new Public IP, use $pip = New-AzureRmPublicIpAddress -Name $pipName -ResourceGroupName $rgName -Location $locName -AllocationMethod Dynamic -Force
$pip = Get-AzureRmPublicIpAddress -Name $pipName -ResourceGroupName $rgName
$nic = Get-AzureRmNetworkInterface -ResourceGroupName $rgName -Name $nicName
$nic.IpConfigurations[0].PublicIpAddress = $pip 
Set-AzureRmNetworkInterface -NetworkInterface $nic

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM