Reputation: 51
I'm using the Azure Free Trial and following the Cloud Ranger training videos. I have loaded the SDK to Powershell and I can add-azureaccount
and get-azuresubscription
with no problem. I only have one subscription so I'm definitely in the right one.
The display after Get-AzureSubscription
does not list any supported modes and I can't see any of my services listed -- When I use Get-AzureVM
nothing displays. I have a vm, cloud service and a storage account set up in the Azure portal. I can see them in the portal, but can't see them in PS.
Upvotes: 1
Views: 3578
Reputation: 51
Finally figured it out. I wanted to post in case someone in the future runs into this problem. I thought the problem might be eliminated when I went from the Azure Free Trial to Pay as You Go. But it surfaced again. I created vms in the portal (both in Preview and Manage) but they wouldn't show up in Powershell with Get-AzureVM no matter what I tried. Finally I gave up and created one in Powershell and then Get-AzureVM returned all the VMs.
Upvotes: 2
Reputation: 121829
Here is an example session:
Start Powershell: powershell
Log on to Azure: Add-AzureAccount
<= This displays an authentication pop-up for login
Check subscription(s): Get-AzureSubscription
<= Everything looks fine...
Check RM VMs: Get-AzureRMContext
<= This fails:
Get-AzureRMContext : Run Login-AzureRmAccount to login.
At line:1 char:1
+ Get-AzureRMContext
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-AzureRmContext], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.Profile.GetAzureRMContextCommand
Run separate login-AzureRmAccount
<= Get another login popup
Check content Get-AzureRMContext
<= OK
Re-run Get-AzureRMVM
<= Everything works this time: see expected server and server details
I was also able to run Get-AzureWebsite
(to see my deployed REST services), etc.
Use help Get-Azure
for a complete list of query commands.
NOTE:
Dealing with Powershell syntax can be a PITA.
So it's extremely important to make sure everything looks OK in the portal. That way, you can focus on troubleshooting a PS syntax error - rather than a real configuration problem.
'Hope that helps!
PS:
Here's a useful "cheat sheet":
Upvotes: 1