unable to run AZ module cmdlets

HK G 516 Reputation points
2021-09-07T20:28:36.2+00:00

I am try to get the detail of correlation ID. I installed the AZ module and tried the run the get-azlog cmdlet. However, I am getting the following error even if I tried it on different PC. It looks to be a problem from the AZ module and similar error also happens on other AZ cmdlets.

WARNING: 3:04:24 PM - The namespace for all the model classes will change from
Microsoft.Azure.Management.Monitor.Management.Models to Microsoft.Azure.Management.Monitor.Models in future releases.
WARNING: 3:04:24 PM - The namespace for output classes will be uniform for all classes in future releases to make it
independent of modifications in the model classes.
WARNING: [Get-AzActivityLog] Parameter deprecation: The DetailedOutput parameter will be deprecated in a future
breaking change release.
get-azlog : Exception type: ValidationException, Message: Microsoft.Rest.ValidationException:
'this.Client.SubscriptionId' cannot be null.
at Microsoft.Azure.Management.Monitor.ActivityLogsOperations.<ListWithHttpMessagesAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Monitor.ActivityLogsOperationsExtensions.<ListAsync>d__1.MoveNext(), Code: Null,
Status code:Null, Reason phrase: Null
At line:1 char:1

  • get-azlog
  • ~~~~~~~~~
  • CategoryInfo : CloseError: (:) [Get-AzActivityLog], PSInvalidOperationException
  • FullyQualifiedErrorId : Microsoft.Azure.Commands.Insights.Events.GetAzureRmLogCommand

Thanks

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,833 questions
0 comments No comments
{count} votes

Accepted answer
  1. tbgangav-MSFT 10,386 Reputation points
    2021-09-08T03:35:11.427+00:00

    Hi @HK G ,

    In general, the error "this.Client.SubscriptionId cannot be null" shows up if we don't set an Azure subscription. In this case, I would recommend to use Get-AzSubscription cmdlet to list all the available subscriptions and then set the subscription by using Select-AzSubscription <subscription ID> cmdlet. For more information w.r.t Az.Accounts PS module cmdlets, refer this document.


0 additional answers

Sort by: Most helpful