问题
I have a cloud service that has two VMs in it. I'm trying to follow the steps listed in this article to reserve my cloud service's IP address.
Login-AzureRmAccount -TenantId <my tenant id>
Set-AzureRmContext -SubscriptionId <my subscription id>
New-AzureReservedIP -ReservedIPName myname -Location "Central US" -ServiceName mycloudservicename
I always get this error:
New-AzureReservedIP : ResourceNotFound: No deployments were found.
The VMs were created in the new portal but are classic mode. I'm not sure if that is somehow my problem. I've tried other combinations of cmdlets to add accounts or set subscription but nothing helps.
Any ideas?
回答1:
I was fighting like 30 minutes with this. I'm not very sure why this was happening but I think was an error selecting the subscription. Last time it worked like this:
- Close Azure Power Shell and Open it again.
- Listed my subscriptions with: "Get-AzureSubscription" (Make sure you are logged in).
- Now I can see the exact Subscription ID and use "Select-AzureSubscription -SubscriptionId XXXXXXXX"
- After that the command worked.
- New-AzureReservedIP -ReservedIPName "myname" -Location "South Central US" -ServiceName "myservice"
Hope it helps.
回答2:
If your VMs were created in the new portal, you need to switch to the Resource Manager model, New-AzureReservedIP is only used for the classic portal services, so it prompted ResourceNotFound: No deployments were found
error.
There is no AzureReservedIP in Azure RM cmdlets. In the new portal, the IP address is associated to network interface.If you want to set your VMip to be static,run the following command:
$nic=Get-AzureRmNetworkInterface -ResourceGroupName JohTest -Name johtestvm250
$nic.IpConfigurations[0].PrivateIpAllocationMethod="Static"
$nic.IpConfigurations[0].PrivateIpAddress = "10.2.0.4"
Set-AzureRmNetworkInterface -NetworkInterface $nic
If you dont know the networkinterface in your RG, run the command to see:
Get-AzureRmNetworkInterface -ResourceGroupName JohTest
More information here
来源:https://stackoverflow.com/questions/35077602/why-does-new-azurereservedip-return-resourcenotfound-no-deployments-were-found