我正在尝试使用高级存储在Azure中创建DS Series VM,并为其分配静态公共IP。根据我的阅读,您不能再将公共静态IP分配给资源组(它只适用于较旧的服务组)。我创建了一个Powershell脚本,尝试创建负载均衡器并将新VM分配给负载均衡器。理论上,负载均衡器可以分配公共静态IP,流量将路由到VM。该脚本似乎正在运行并且已创建VM但它不会启动。 VM的状态列为“失败”。有人可以告诉我这个剧本中我做错了什么吗?
Switch-AzureMode AzureResourceManager
Add-AzureAccount
$subscr="mysubscription" Select-AzureSubscription -SubscriptionName $subscr
$rgName="testRG" $locName="West US" New-AzureResourceGroup -Name $rgName -Location $locName
$saName="teststorage" $saType="Premium_LRS" New-AzureStorageAccount
-Name $saName -ResourceGroupName $rgName –Type $saType -Location $locName
$frontendSubnet=New-AzureVirtualNetworkSubnetConfig -Name "testfrontendSubnet" -AddressPrefix 10.0.1.0/24 $backendSubnet=New-AzureVirtualNetworkSubnetConfig -Name "testbackendSubnet" -AddressPrefix 10.0.2.0/24 New-AzurevirtualNetwork
-Name "testVNet" -ResourceGroupName $rgName -Location $locName -AddressPrefix 10.0.0.0/16 -Subnet $frontendSubnet,$backendSubnet
$publicIP = New-AzurePublicIpAddress -Name "testPublicIp"
-ResourceGroupName $rgName -Location $locName –AllocationMethod Static -DomainNameLabel "testIP" $frontendIP = New-AzureLoadBalancerFrontendIpConfig -Name "test-LB-Frontend"
-PublicIpAddress $publicIP $beaddresspool= New-AzureLoadBalancerBackendAddressPoolConfig -Name "test-LB-backend" $lbrule = New-AzureLoadBalancerRuleConfig -Name "HTTP"
-FrontendIpConfiguration $frontendIP -BackendAddressPool $beAddressPool -Protocol Tcp -FrontendPort 80 -BackendPort 80 $NRPLB = New-AzureLoadBalancer -ResourceGroupName $rgName -Name "test-LB"
-Location $locName -FrontendIpConfiguration $frontendIP -LoadBalancingRule $lbrule -BackendAddressPool $beAddressPool
$nicName="test-NIC" $lbName="test-LB" $bePoolIndex=0 $vnetName="testVNet" $subnetIndex=0 $natRuleIndex=0 $vnet=Get-AzurevirtualNetwork -Name $vnetName -ResourceGroupName $rgName $lb=Get-AzureLoadBalancer -Name $lbName -ResourceGroupName $rgName
$backendSubnet = Get-AzureVirtualNetworkSubnetConfig -Name "testbackendSubnet" -VirtualNetwork $vnet $nic=New-AzureNetworkInterface -Name $nicName -ResourceGroupName $rgName -Location $locName -Subnet $backendSubnet
-LoadBalancerBackendAddressPool $lb.BackendAddressPools[$bePoolIndex] -LoadBalancerInboundNatRule $lb.InboundNatRules[$natRuleIndex]
# TWO OTHERS I'VE TRIED WITHOUT SUCCESS
# $nic=New-AzureNetworkInterface -Name $nicName -ResourceGroupName $rgName -Location $locName -Subnet $backendSubnet
-LoadBalancerBackendAddressPool $lb.BackendAddressPools[$bePoolIndex]
# $nic=New-AzureNetworkInterface -Name $nicName -ResourceGroupName $rgName -Location $locName -Subnet $vnet.Subnets[$subnetIndex].Id
-LoadBalancerBackendAddressPool $lb.BackendAddressPools[$bePoolIndex]
$vmName="test" $vmSize="Standard_DS2" $vm=New-AzureVMConfig -VMName $vmName -VMSize $vmSize
$pubName="MicrosoftWindowsServer" $offerName="WindowsServer" $skuName="2012-R2-Datacenter" $cred=Get-Credential -Message "Type the name and password of the local administrator account." $vm=Set-AzureVMOperatingSystem -VM $vm -Windows -ComputerName $vmName
-Credential $cred -ProvisionVMAgent -EnableAutoUpdate $vm=Set-AzureVMSourceImage -VM $vm -PublisherName $pubName -Offer $offerName -Skus $skuName -Version "latest" $vm=Add-AzureVMNetworkInterface -VM $vm -Id $nic.Id
$diskName="test-OSDisk" $storageAcc=Get-AzureStorageAccount
-ResourceGroupName $rgName -Name $saName $osDiskUri=$storageAcc.PrimaryEndpoints.Blob.ToString() + "vhds/" + $diskName + ".vhd" $vm=Set-AzureVMOSDisk -VM $vm -Name $diskName
-VhdUri $osDiskUri -CreateOption fromImage New-AzureVM -ResourceGroupName $rgName -Location $locName -VM $vm
答案 0 :(得分:-1)
您正在使用位于美国西部的位置,而Azure在几天内在美国东部2和美国西部使用高级存储的DS系列虚拟机存在严重的容量问题。
遗憾的是,Azure状态页面未提及此问题。
尝试使用支持高级存储的其他位置,例如西欧,您的VM应该创建并正常启动。