Azure VM: Adding a Reserved IP address to an existing VM

前端 未结 8 1659
情话喂你
情话喂你 2021-02-05 23:13

What I have read so far on the web is that there is no way to add a reserved IP to an existing VM (unless I recreate the VM which I am trying to avoid). However, I have noticed

8条回答
  •  孤街浪徒
    2021-02-05 23:59

    For new VMs (with resource manager) you should do the following:

    Create new static IP address:

    $ip = New-AzureRmPublicIpAddress -Name ""  -ResourceGroupName  -Location eastus -AllocationMethod Static
    

    Get information about VM Network Interface:

    Get-AzureRmVM -ResourceGroupName  -Name  | Select -ExpandProperty NetworkProfile
    

    Get corresponding network interface and set new ip and update NIC:

    $netInt = Get-AzureRmNetworkInterface -ResourceGroupName "group-name" -Name 
    $netInt.IpConfigurations[0].PublicIpAddress = $ip
    Set-AzureRmNetworkInterface -NetworkInterface $netInt
    

提交回复
热议问题