question

HKG-7714 avatar image
0 Votes"
HKG-7714 asked tbgangav-MSFT commented

unable to run AZ module cmdlets

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

tbgangav-MSFT avatar image
0 Votes"
tbgangav-MSFT answered tbgangav-MSFT commented

Hi @HKG-7714,

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.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the reply. The get-azsubscription returned nothing even though I was logging as global admin.

0 Votes 0 ·

I just logged in to the azure cloud shell and saw that I don't have any subscription. I thought my Office 365 subscription by itself is already a subscription.

0 Votes 0 ·

Hi @HKG-7714,

Okay. Once you get valid Azure subscription then I recommend to set the subscription and try Get-AzLog Az PS cmdlet.
Let me know if you have any further queries w.r.t it.

0 Votes 0 ·