Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-AzRoleDefinition : Object reference not set to an instance of an object. #22716

Closed
terrycms opened this issue Sep 1, 2023 · 10 comments · Fixed by #22730
Closed

Get-AzRoleDefinition : Object reference not set to an instance of an object. #22716

terrycms opened this issue Sep 1, 2023 · 10 comments · Fixed by #22730
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported needs-team-attention This issue needs attention from Azure service team or SDK team

Comments

@terrycms
Copy link

terrycms commented Sep 1, 2023

Description

Attempting to find the name of an Azure AD built-in role. Getting errors in powershell. I suspect there is an issue between Az and Rm modules but not sure how to resolve it.

The bug not just that Get-AzRoleDefinition doesn't work; it is mostly a bug about user experience for the Az modules; see the attempts below to get role definitions from AzureAd. The Az module can be improved to let me know what to do to resolve the issue or resolve the problem for me.

C:\WINDOWS\system32> Get-AzRoleDefinition | FT Name, Description Get-AzRoleDefinition : The term 'Get-AzRoleDefinition' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Get-AzRoleDefinition | FT Name, Description + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-AzRoleDefinition:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\WINDOWS\system32> Import-Module Az.Accounts Install-Module Import-Module : A positional parameter cannot be found that accepts argument 'Install-Module'. At line:1 char:1 + Import-Module Az.Accounts Install-Module + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Import-Module], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

PS C:\WINDOWS\system32> Install-Module -Name Az -Repository PSGallery -Force
PackageManagement\Install-Package : The following commands are already available on this
system:'Login-AzAccount,Logout-AzAccount,Resolve-Error,Send-Feedback'. This module 'Az.Accounts' may override the
existing commands. If you still want to install this module 'Az.Accounts', use -AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21

  • ... $null = PackageManagement\Install-Package @PSBoundParameters
  •                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],
      Exception
    • FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.Pack
      ageManagement.Cmdlets.InstallPackage

PS C:\WINDOWS\system32> PS C:\WINDOWS\system32> Install-Module -Name Az -Repository PSGallery -Force -AllowClobber PS C:\WINDOWS\system32> Get-AzRoleDefinition | FT Name, Description WARNING: Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide Get-AzRoleDefinition : Object reference not set to an instance of an object. At line:1 char:1 + Get-AzRoleDefinition | FT Name, Description

  •   + CategoryInfo          : CloseError: (:) [Get-AzRoleDefinition], NullReferenceException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand
    
    

PS C:\WINDOWS\system32> Uninstall-AzureRm
PS C:\WINDOWS\system32> Get-AzRoleDefinition | FT Name, Description
Get-AzRoleDefinition : Object reference not set to an instance of an object.
At line:1 char:1

  • Get-AzRoleDefinition | FT Name, Description
  •   + CategoryInfo          : CloseError: (:) [Get-AzRoleDefinition], NullReferenceException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand
    
    

PS C:\WINDOWS\system32> Get-AzRoleDefinition
Get-AzRoleDefinition : Object reference not set to an instance of an object.
At line:1 char:1

  • Get-AzRoleDefinition
  •   + CategoryInfo          : CloseError: (:) [Get-AzRoleDefinition], NullReferenceException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand
    
    

PS C:\WINDOWS\system32> Install-Module -Name Az -Repository PSGallery -Force -AllowClobber
WARNING: The version '2.12.5' of module 'Az.Accounts' is currently in use. Retry the operation after closing the
applications.
WARNING: The version '6.9.0' of module 'Az.Resources' is currently in use. Retry the operation after closing the
applications.
PS C:\WINDOWS\system32> Get-AzRoleDefinition
Get-AzRoleDefinition : Object reference not set to an instance of an object.
At line:1 char:1

  • Get-AzRoleDefinition
  •   + CategoryInfo          : CloseError: (:) [Get-AzRoleDefinition], NullReferenceException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand
    
    

PS C:\WINDOWS\system32> Get-AzRoleDefinition
Get-AzRoleDefinition : Object reference not set to an instance of an object.
At line:1 char:1

  • Get-AzRoleDefinition
  •   + CategoryInfo          : CloseError: (:) [Get-AzRoleDefinition], NullReferenceException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand
    
    

PS C:\WINDOWS\system32> Get-AzRoleDefinition -Id 13bd1c72-6f4a-4dcf-985f-18d3b80f208a
Get-AzRoleDefinition : Object reference not set to an instance of an object.
At line:1 char:2

  • Get-AzRoleDefinition -Id 13bd1c72-6f4a-4dcf-985f-18d3b80f208a
  •  + CategoryInfo          : CloseError: (:) [Get-AzRoleDefinition], NullReferenceException
     + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand
    
    
    

PS C:\WINDOWS\system32> Get-AzRoleDefinition -Id 13bd1c72-6f4a-4dcf-985f-18d3b80f208a
Get-AzRoleDefinition : Object reference not set to an instance of an object.
At line:1 char:2

  • Get-AzRoleDefinition -Id 13bd1c72-6f4a-4dcf-985f-18d3b80f208a
  •  + CategoryInfo          : CloseError: (:) [Get-AzRoleDefinition], NullReferenceException
     + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand
    
    

PS C:\WINDOWS\system32> Get-AzRoleDefinition
Get-AzRoleDefinition : Object reference not set to an instance of an object.
At line:1 char:1

  • Get-AzRoleDefinition
  •   + CategoryInfo          : CloseError: (:) [Get-AzRoleDefinition], NullReferenceException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand
    
    

Issue script & Debug output

PS C:\WINDOWS\system32> Get-AzRoleDefinition
DEBUG: 8:54:32 AM - GetAzureRoleDefinitionCommand begin processing with ParameterSet 'RoleDefinitionNameParameterSet'.
DEBUG: 8:54:32 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
Returning default value [True].
DEBUG: 8:54:32 AM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning
default value [True].
Get-AzRoleDefinition : Object reference not set to an instance of an object.
At line:1 char:1
+ Get-AzRoleDefinition
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzRoleDefinition], NullReferenceException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand

DEBUG: 8:54:32 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
Returning default value [True].
DEBUG: 8:54:32 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Resources:6.9.0; CommandName: Get-AzRoleDefinition; PSVersion: 5.1.22621.1778;
IsSuccess: False; Duration: 00:00:00.0330040; Exception: Object reference not set to an instance of an object.;
DEBUG: 8:54:32 AM - GetAzureRoleDefinitionCommand end processing.

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.22621.1778
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.1778
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.12.5     Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear...
Script     6.9.0      Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDeny...
Script     5.1.2      Azure                               {Add-AzureAccount, Add-AzureApplicationGatewaySslCertifica...
Binary     2.0.2.140  AzureAD                             {Add-AzureADApplicationOwner, Add-AzureADDeviceRegisteredO...

Error output

PS C:\WINDOWS\system32> Resolve-AzError
DEBUG: 8:59:51 AM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 8:59:51 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
Returning default value [True].


   HistoryId: 21


Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzRoleDefinition}
Line           : Get-AzRoleDefinition
Position       : At line:1 char:1
                 + Get-AzRoleDefinition
                 + ~~~~~~~~~~~~~~~~~~~~
HistoryId      : 21



   HistoryId: 17


Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzRoleDefinition}
Line           : Get-AzRoleDefinition
Position       : At line:1 char:1
                 + Get-AzRoleDefinition
                 + ~~~~~~~~~~~~~~~~~~~~
HistoryId      : 17



   HistoryId: 16


Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzRoleDefinition}
Line           :  Get-AzRoleDefinition -Id 13bd1c72-6f4a-4dcf-985f-18d3b80f208a
Position       : At line:1 char:2
                 +  Get-AzRoleDefinition -Id 13bd1c72-6f4a-4dcf-985f-18d3b80f208a
                 +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 16



   HistoryId: 15


Message        : The specified module 'Azure.Storage' with version '4.2.1' was not loaded because no valid module file
                 was found in any module directory.
StackTrace     :
Exception      : System.IO.FileNotFoundException
InvocationInfo : {Import-Module}
Line           :     Import-Module Azure.Storage -MinimumVersion 4.2.1 -Scope Global

Position       : At C:\Program Files\WindowsPowerShell\Modules\Azure\5.1.2\Azure.psm1:19 char:5
                 +     Import-Module Azure.Storage -MinimumVersion 4.2.1 -Scope Global
                 +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 15



   HistoryId: 14


Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzRoleDefinition}
Line           :  Get-AzRoleDefinition -Id 13bd1c72-6f4a-4dcf-985f-18d3b80f208a
Position       : At line:1 char:2
                 +  Get-AzRoleDefinition -Id 13bd1c72-6f4a-4dcf-985f-18d3b80f208a
                 +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 14



   HistoryId: 13


Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzRoleDefinition}
Line           : Get-AzRoleDefinition
Position       : At line:1 char:1
                 + Get-AzRoleDefinition
                 + ~~~~~~~~~~~~~~~~~~~~
HistoryId      : 13



   HistoryId: 12


Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzRoleDefinition}
Line           : Get-AzRoleDefinition
Position       : At line:1 char:1
                 + Get-AzRoleDefinition
                 + ~~~~~~~~~~~~~~~~~~~~
HistoryId      : 12



   HistoryId: 10


Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzRoleDefinition}
Line           : Get-AzRoleDefinition
Position       : At line:1 char:1
                 + Get-AzRoleDefinition
                 + ~~~~~~~~~~~~~~~~~~~~
HistoryId      : 10



   HistoryId: 9


Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzRoleDefinition}
Line           : Get-AzRoleDefinition | FT Name, Description
Position       : At line:1 char:1
                 + Get-AzRoleDefinition | FT Name, Description
                 + ~~~~~~~~~~~~~~~~~~~~
HistoryId      : 9



   HistoryId: 7


Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.Resources.GetAzureRoleDefinitionCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzRoleDefinition}
Line           : Get-AzRoleDefinition | FT Name, Description
Position       : At line:1 char:1
                 + Get-AzRoleDefinition | FT Name, Description
                 + ~~~~~~~~~~~~~~~~~~~~
HistoryId      : 7



   HistoryId: 5


Message        : The following commands are already available on this
                 system:'Login-AzAccount,Logout-AzAccount,Resolve-Error,Send-Feedback'. This module 'Az.Accounts' may
                 override the existing commands. If you still want to install this module 'Az.Accounts', use
                 -AllowClobber parameter.
StackTrace     :
Exception      : System.Exception
InvocationInfo : {Install-Package}
Line           :             $null = PackageManagement\Install-Package @PSBoundParameters

Position       : At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
                 + ...          $null = PackageManagement\Install-Package @PSBoundParameters
                 +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5



   HistoryId: 4


Message        : A positional parameter cannot be found that accepts argument 'Install-Module'.
StackTrace     :    at System.Management.Automation.CmdletParameterBinderController.VerifyArgumentsProcessed(ParameterB
                 indingException originalBindingException)
                    at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidati
                 on(Collection`1 arguments)
                    at
                 System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1
                 arguments)
                    at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
                    at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
                    at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary
                 psDefaultParameterValues)
                    at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
                    at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
                 input)
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
                 input)
                    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput,
                 CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
                 commandRedirections, FunctionContext funcContext)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
                 frame)
Exception      : System.Management.Automation.ParameterBindingException
InvocationInfo : {Import-Module}
Line           : Import-Module Az.Accounts Install-Module
Position       : At line:1 char:1
                 + Import-Module Az.Accounts Install-Module
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 4



   HistoryId: 3


Message        : The term 'Get-AzRoleDefinition' is not recognized as the name of a cmdlet, function, script file, or
                 operable program. Check the spelling of the name, or if a path was included, verify that the path is
                 correct and try again.
StackTrace     :    at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName,
                 CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin
                 commandOrigin, ExecutionContext context)
                    at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName,
                 CommandOrigin commandOrigin, Nullable`1 useLocalScope)
                    at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
                    at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe,
                 CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[]
                 redirections, ExecutionContext context)
                    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput,
                 CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
                 commandRedirections, FunctionContext funcContext)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
                 frame)
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : Get-AzRoleDefinition | FT Name, Description
Position       : At line:1 char:1
                 + Get-AzRoleDefinition | FT Name, Description
                 + ~~~~~~~~~~~~~~~~~~~~
HistoryId      : 3



   HistoryId: -1


Message        : Unable to find type [Microsoft.PowerShell.Commands.PowerShellGet.Telemetry].
StackTrace     :    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
                 funcContext, Exception exception)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
                 frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
                 frame)
Exception      : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line           :     $telemetryMethods = ([Microsoft.PowerShell.Commands.PowerShellGet.Telemetry] | Get-Member
                 -Static).Name

Position       : At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:715 char:26
                 + ... yMethods = ([Microsoft.PowerShell.Commands.PowerShellGet.Telemetry] | ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : -1



DEBUG: 8:59:51 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.12.5; CommandName: Resolve-AzError; PSVersion: 5.1.22621.1778; IsSuccess:
True; Duration: 00:00:00.3407147
DEBUG: 8:59:51 AM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: 8:59:51 AM - ResolveError end processing.
@terrycms terrycms added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Sep 1, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Sep 1, 2023
@isra-fel
Copy link
Member

isra-fel commented Sep 3, 2023

Thanks for reporting :) @NoriZC hi, please go through the issue and let's talk about it. Thanks.

@NoriZC
Copy link
Contributor

NoriZC commented Sep 4, 2023

Hi @terrycms,

Could you please run Get-AzContext to list your account information?
I cannot reproduce this issue for now. But guess that is caused by an empty subscription. Please help confirm, thanks.

@isra-fel
Copy link
Member

isra-fel commented Sep 6, 2023

Also please make sure to mask any sensitive information before posting it here.

@isra-fel isra-fel added the needs-author-feedback More information is needed from author to address the issue. label Sep 6, 2023
@terrycms
Copy link
Author

terrycms commented Sep 6, 2023

PS C:\WINDOWS\system32> Get-AzContext
DEBUG: 11:27:40 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: 11:27:40 AM - GetAzureRMContextCommand end processing.

Tried connect-azuread and Add-AzureAccount before and after Get-AzContext, but get same result as shown above

@microsoft-github-policy-service microsoft-github-policy-service bot added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels Sep 6, 2023
@isra-fel
Copy link
Member

Reopen this because we rolled back the fix. #22866

@isra-fel isra-fel reopened this Oct 16, 2023
@Dylan-Prins
Copy link

When is this going to be fixed?

@NoriZC
Copy link
Contributor

NoriZC commented Jan 23, 2024

@Dylan-Prins This should be already fixed. Could you please install the latest Resources module and have a try?

@NoriZC NoriZC closed this as completed Jan 23, 2024
@Dylan-Prins
Copy link

I can confirm this is fixed.
Too bad microsoft still uses 9.3.0. in their default azure DevOps agents

@YanaXu
Copy link
Contributor

YanaXu commented Jan 24, 2024

I can confirm this is fixed. Too bad microsoft still uses 9.3.0. in their default azure DevOps agents

Hi @Dylan-Prins , You can choose a specific Azure PowerShell version in Azure Pipelines.
You're right about the default Azure PowerShell version used in ADO. But you can always choose another one.
image

@k290
Copy link

k290 commented Jan 28, 2024

For people still coming across this issue, even in the latest preview release, the Object reference error is also thrown if you forget to run Connect-AzAccount first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported needs-team-attention This issue needs attention from Azure service team or SDK team
Projects
None yet
6 participants