如何为Azure虚拟机保留静态IP?

时间:2015-07-31 03:34:43

标签: powershell azure

亚马逊拥有可以分配给实例的弹性IP,

如何使用Azure为现有VM执行此操作?

(如果IP更改,我不想更改所有DNS条目)

我找到了一些关于运行power shell命令的文章 1. http://michaelwasham.com/windows-azure-powershell-reference-guide/using-reserved-ip-addresses-with-microsoft-azure-virtual-machines/ 2. http://azure.microsoft.com/blog/2014/05/14/reserved-ip-addresses/ 3. http://azure.microsoft.com/blog/2014/04/22/static-internal-ip-address-for-virtual-machines/

但是我的服务器(Windows Server 2012 R2)无法识别这些命令

知道我该怎么做?

这是我在Power Shell上遇到的错误:

PS C:\> New-AzureReservedIP – ReservedIPName "137.117.11.18" –Label "people-dns-ip" –Location "US West"
New-AzureReservedIP : The term 'New-AzureReservedIP' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ New-AzureReservedIP – ReservedIPName "137.117.11.18" –Label "people-dns-ip" –Loc ...
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-AzureReservedIP:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

1 个答案:

答案 0 :(得分:4)

听起来你错过了PowerShell的必备CMD。请下载Microsoft Webinstaller:

Download Microsoft Web-Installer

并执行Microsoft PowerShell的全新安装。在此之后,您应该能够使用" New-AzureReservedIP"命令。也许你在没有这个CMDlet的情况下运行旧版本的PowerShell。

enter image description here

有关安装PowerShell的详细信息,请参阅:Configure and Install PowerShell (Azure)