Udostępnij za pośrednictwem


Azure: Reprovisioning VMs with Reserved IPs

Had issues setting reservations for VMs I was working with, so found a known issue in the Azure modules, V0.9.4; therefore, downgraded to the last version to get working. Get previous versions from GitHub here.

Next task was setting the reservation to existing VMs deployed into my cloud service. After removing, find image not in use then re-provision passing the parameters into the New-AzureVM using the –ReservedIPName switch. See example:

 $vm = New-AzureVMConfig -Name $name -InstanceSize A5 -DiskName (Get-AzureDisk | where {$_.AttachedTo -like ''}).DiskName | `
Add-AzureEndpoint -Protocol tcp -LocalPort 443 -PublicPort 443 -Name "HTTPS" | Set-AzureSubnet $subnet
New-AzureVM -ServiceName $cloudService -Location $location -VNetName $vnet -VMs $vm -ReservedIPName $vip.ReservedIPName -Verbose

Reference links for more details:

https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-reserved-public-ip/

https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-reserved-public-ip/\#how-to-manage-reserved-vips