如何为Azure虚拟机预留静态IP地址?

3

亚马逊提供弹性IP,您可以为实例分配IP地址,

在Azure上如何为现有VM执行此操作?

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

我找到了一些关于运行PowerShell命令的文章: 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)。

有什么想法吗?

这是我在PowerShell上得到的错误:

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个回答

4
听起来你缺少 PowerShell 所需的 CMD。请下载 Microsoft Webinstaller:

下载 Microsoft Web-Installer

并进行 Microsoft PowerShell 的全新安装。这样,您就可以使用“New-AzureReservedIP”命令了。也许您正在运行没有此 CMDlet 的旧版本的 PowerShell。

enter image description here

有关安装 PowerShell 的更多信息,请参阅:配置和安装 PowerShell(Azure)


谢谢,现在我遇到了一个新的错误 - New-AzureReservedIP:未指定默认订阅。使用Select-AzureSubscription -Default <subscriptionName>来设置默认订阅。我找不到正确的subscriptionName(我的Azure门户上显示为“BizSpark”...) - Yovav
使用Get-AzureSubscription命令可以查看正确名称的列表。 - opHASnoNAME

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接