While working on one of my expired and disabled Microsoft Azure subscription with PowerShell, I was receiving error (Get-AzVirtualNetwork: 'this.Client.SubscriptionId' cannot be null) when trying to get information from Azure Virtual Network. Although I was receiving error for all the resources when getting information. Below are the two commands tried first.
Connect-AzAccount Get-AzVirtualNetwork
Next to resolve this issue get the list of Azure subscription. In the followed command use one of the subscription name which you want to connect and set it as context in Az Powershell.
Get-AzSubscription Get-AzSubscription -SubscriptionName <Your subscription name> | Set-AzContext
Once subscription is set as context (Sets the tenant, subscription, and environment for cmdlets to use in the current session), I am able to fetch Virtual Network information without any error.
Useful Articles
Create a Virtual machine on Microsoft Azure
PowerShell List All Azure Resverations
Powershell get the list of Azure Reservations Virtual Machines instances
Get the list Azure Reservation Catalog with PowerShell and AzureCLI
Azure automation account DSC for On-Premise Virtual Machine on boarding
Azure Powershell : Operation returned an invalid status code 'BadRequest'
Create an Azure Automation account on using Portal PowerShell and AzureCLI
Get Azure virtual machine backup reports using Powershell
Why is my Azure recovery services vault not getting deleted?