Skip to content

Get-AzApplicationInsights returns a subscription ID null error when not authenticated #26183

@mikefrobbins

Description

@mikefrobbins

Description

Get-AzApplicationInsights returns a subscription ID null error when you're not authenticated. It should return an error like Get-AzResource.

Current behavior:

PS C:\> Get-AzApplicationInsights
Get-AzApplicationInsights_List: C:\Program Files\PowerShell\Modules\Az.ApplicationInsights\2.2.5\ApplicationInsights.Autorest\internal\ProxyCmdletDefinitions.ps1:1528
Line |
1528 |          $scriptCmd = {& $wrappedCmd @PSBoundParameters}
     |                                      ~~~~~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'SubscriptionId' because it is null.
PS C:\>

Expected behavior:

PS C:\> Get-AzApplicationInsights
Get-AzApplicationInsights: Run Connect-AzAccount to login.
PS C:\>

Issue script & Debug output

PS C:\> Get-AzApplicationInsights
DEBUG: 10:59:54 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:59:54 AM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 10:59:54 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:59:54 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:59:54 AM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:59:54 AM - GetAzureRMContextCommand end processing.
Get-AzApplicationInsights_List: C:\Program Files\PowerShell\Modules\Az.ApplicationInsights\2.2.5\ApplicationInsights.Autorest\internal\ProxyCmdletDefinitions.ps1:1528
Line |
1528 |          $scriptCmd = {& $wrappedCmd @PSBoundParameters}
     |                                      ~~~~~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'SubscriptionId' because it is null.
PS C:\>

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.5
PSEdition                      Core
GitCommitId                    7.4.5
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     12.3.0                AzPreview                           Core,Desk

Error output

HistoryId: 2

Message        : Cannot bind argument to parameter 'SubscriptionId' because it is null.
StackTrace     :    at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
                    at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception&
                 exceptionThrown, ExecutionOptions options)
Exception      : System.Management.Automation.ParameterBindingValidationException
InvocationInfo : {Get-AzApplicationInsights_List}
Line           :         $scriptCmd = {& $wrappedCmd @PSBoundParameters}

Position       : At C:\Program Files\PowerShell\Modules\Az.ApplicationInsights\2.2.5\ApplicationInsights.Autorest\inter
                 nal\ProxyCmdletDefinitions.ps1:1528 char:37
                 +         $scriptCmd = {& $wrappedCmd @PSBoundParameters}
                 +                                     ~~~~~~~~~~~~~~~~~~
HistoryId      : 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Azure PS TeamMonitor - ApplicationInsightsbugThis issue requires a change to an existing behavior in the product in order to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions