6

If I run

Get-AzureSubscription -Current

I get:

SubscriptionId            : a*<guid>
SubscriptionName          : Development                         
Environment               : AzureCloud                          
DefaultAccount            : t*<guid>          
IsDefault                 : True                                
IsCurrent                 : True                                
TenantId                  : 4*<guid>

Then I run:

Get-AzureRmResourceGroup

And neither of the two resources returned are in that subscription, of which there should many, according to the portal:

ResourceGroupName : Default-SQL-NorthCentralUS
Location          : northcentralus
ProvisioningState : Succeeded
Tags              :
ResourceId        : /subscriptions/0*<guid>*e/resourceGroups/Default-SQL-NorthCentralUS

ResourceGroupName : Default-Web-NorthCentralUS
Location          : northcentralus
ProvisioningState : Succeeded
Tags              :
ResourceId        : /subscriptions/0*<guid>*e/resourceGroups/Default-Web-NorthCentralUS

These are coming from another subscription I have, but as you can see, isn't the current one.

Why isn't Get-AzureRmResourceGroup getting the resource groups in the current subscription, and now do I fix this?

My Azure module is version 0.9.11 and AzureRM is version 1.0.1. I also don't have access to Switch-AzureMode or Get-AzureResourceGroup

  • 1
    Just to clarify on this: Get-AzureSubscription belongs to the ASM module (azure), and Get-AzureRmResourceGroup belongs to the ARM (azurerm) module. They are completely isolated and do not share sessions. You were probably logged in to another subscription with the AzureRM module. – Trondh Nov 9 '15 at 13:35
  • Indeed I was. Same account, different selected subscription. – TylerHam Nov 9 '15 at 16:57
8

I had to use

Select-AzureRmSubscription -SubscriptionId a*<guid>

Thanks to Michael Rodger for providing the answer.

1

You need to setup the context using below command if you have multiple subscriptions:

Set-AzureRmContext -SubscriptionName "Name"

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.