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

2
  • 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, 2015 at 13:35
  • Indeed I was. Same account, different selected subscription.
    – TylerHam
    Nov 9, 2015 at 16:57

2 Answers 2

9

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"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .