none
Retrieve Azure classic resources -powershell RRS feed

  • Question

  • So I have a list of subscriptions where for few there are both classic and arm resources

    So to retrieve lets say for example nsg

    I provide login

    Get-azurermsubscription gives me list of subscriptions which has both classic and arm resources

    Get-azuresubscription gives 3-4 subscriptions and it is missing the above subscripions with classic resources

    So to retrieve classic nsgs if I try get-azurenetworksecuritygroup with subscription id as parameter(i know this subscription has classic nsgs) It says no subscription with such id

    How to retrive those classic nsgs list 

    Tuesday, August 13, 2019 3:59 PM

All replies

  • Hi Tejaps,

    Can you please make sure you are added as co-owner/service administrator as part of classic administrators with in the subscription in which you have classic resources. 

    You can run the below commands in sequence to get the Classic Network Security Groups

    ## adding the azure account context
    
    add-azureaccount
    
    ## Get Azure Subscriptions associated to the context 
    Get-AzureSubscription
    
    ## select the subscription which you need as default with in the context
    Select-AzureSubscription -SubscriptionName 'YourSubscriptionName'
    
    ## Get Classic Network Security Groups with in the subscription 
    
    Get-AzureNetworkSecurityGroup
    Hope the above information helps. Thanks


    Friday, August 16, 2019 12:04 AM
    Owner