【问题标题】:Create a VM with a reserved IP创建具有保留 IP 的 VM
【发布时间】:2014-10-18 07:40:22
【问题描述】:

我尝试使用保留的 IP 地址创建一个虚拟机,如下所示:

New-AzureQuickVM -ImageName a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201409.01-en.us-127GB.vhd -ServiceName VmPIPBis3 -Windows -AdminUsername amethyste -Location "West Europe" -Password SuperMotDePasse12 -ReservedIPName.

但我得到的只是这个错误消息:

New-AzureQuickVM : BadRequest: 保留的 IP 104.45.13.146 不存在。

唯一创建的就是服务云

有人知道发生了什么吗?

谢谢

【问题讨论】:

  • 您是否首先调用 New-AzureReservedIP 和/或 Get-AzureReservedIP 以确定您拥有 IP 地址?

标签: azure


【解决方案1】:

您需要先在 Azure 订阅中保留 IP,然后在调用 New-AzureQuickVM 时将 ReservedIPName(不是地址)传递给 ReservedIPName 参数。下面是一个脚本,如果给定名称的 IP 不存在,则创建一个新的预留 IP,然后使用预留 IP 创建一个新 VM。

$location = "West US"
$appVMName = "AppVM01"
$appVMServiceName = [Guid]::NewGuid().ToString();
$imageName = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201409.01-en.us-127GB.vhd"
$adminUser = "AdminUser"
$adminPswd = "AdminPassw0rd"
$reservedIPName = $appVMName + "-resrvdIP"

# Get the reserved IP if it exists or create a new one.
$reservedIP = Get-AzureReservedIP -ReservedIPName $reservedIPName -ErrorAction SilentlyContinue
if ($reservedIP -eq $null)
{
    Write-Host "Reserving IP in '$location' as '$reservedIPName'."
    New-AzureReservedIP -ReservedIPName $reservedIPName -Location $location
    $reservedIP = Get-AzureReservedIP -ReservedIPName $reservedIPName -ErrorAction Stop
}

# Create a new VM using the reserved IP
New-AzureQuickVM -Name $appVMName -ServiceName $appVMServiceName -Windows -ImageName $imageName `
  -AdminUsername $adminUser -Password $adminPswd -Location $location -ReservedIPName $reservedIP.ReservedIPName

Write-Host "VM Created using the following reserved IP Address:... " + $reservedIP.Address

【讨论】:

  • 谢谢你是对的,我觉得有点傻!
猜你喜欢
  • 1970-01-01
  • 2017-08-31
  • 2015-11-02
  • 2015-12-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-05
相关资源
最近更新 更多