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

前端 未结 8 1674
情话喂你
情话喂你 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:37

    I read all of the previous entries and did not come away with a clear picture of how to proceed with assigning a reserved IP address to my existing Azure classic VM, so I opened a support ticket. I got excellent clear guidance from "Sruthi Saranya K", a support engineer in Azure Networking. Sruthi stated "in classic deployment model it is not possible to have a static public IP assigned to a VM", which I had read elsewhere, but she clarified that you simply assign the IP address to the cloud service and not the VM directly, then the VM will automatically pick up on the change. I outline all of the commands here for your convenience, starting from an Azure PowerShell prompt. The critical command was specified in the top response here, but not all of the steps. Also, that example also includes specifying the service, but it does not appear to be a supported parameter for that command, instead there is a second command to associate the IP with the service.

    add-azureaccount (to log in to Azure from PowerShell)
    New-AzureReservedIP -ReservedIPName "ipname" -Location "East US"
    get-azurereservedip (just to see what the reserved IP address is)
    Set-AzureReservedIPAssociation -ReservedIPName "ipname" -ServiceName "your cloud service name"

    Also, depending on the use, you may want to look up the IP address on mxtoolbox.com to make sure it is not already blacklisted. My reserved IP was for a web site, but the default @ DNS entry for the domain meant our domain was generally going to be associated with that IP address, and previously our mail has been blacklisted because our web server IP address was sullied by some other Azure tenant. If you get a blacklisted address, you can remove it and get a new one, also a suggestion from Sruthi. Here are the commands to remove the reserved IP, and to remove the cloud service association if needed:

    remove-azurereservedip
    Remove-AzureReservedIPAssociation

    My sincere thanks to Sruthi for making it so simple and preventing an unnecessary redeployment of our company's public web server.

提交回复
热议问题