NullReferenceException: Test-AzureRmDataLakeStoreAccount
Cmdlet(s)
Test-AzureRmDataLakeStoreAccount
PowerShell Version
5.1.16299.98
Module Version
5.0.0
OS Version
10.0.16299.98
Description
When running Test-AzureRmDataLakeStoreAccount without an active Azure context (as created by Login-AzureRmAccount, the cmdlet errors out with,
Test-AzureRmDataLakeStoreAccount : Object reference not set to an instance of an object.
+ ... if (!(Test-AzureRmDataLakeStoreAccount -Name $this.DataLakeStor ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Test-AzureRmDataLakeStoreAccount], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataLakeStore.TestAzureDataLakeStoreAccount
Debug Output
DEBUG: 8:49:56 AM - TestAzureDataLakeStoreAccount begin processing with ParameterSet '__AllParameterSets'.
Test-AzureRmDataLakeStoreAccount : Object reference not set to an instance of an object.
At line:1 char:1
+ Test-AzureRmDataLakeStoreAccount
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Test-AzureRmDataLakeStoreAccount], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataLakeStore.TestAzureDataLakeStoreAccount
DEBUG: AzureQoSEvent: CommandName - Test-AzureRmDataLakeStoreAccount; IsSuccess - False; Duration - 00:00:00.0210942;
Exception - System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureSubscriptionExtensions.GetId(IAzureSubscription
subscription)
at Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreClient..ctor(IAzureContext context)
at Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreCmdletBase.get_DataLakeStoreClient()
at Microsoft.Azure.Commands.DataLakeStore.TestAzureDataLakeStoreAccount.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 8:49:56 AM - TestAzureDataLakeStoreAccount end processing.
DEBUG: 8:49:56 AM - TestAzureDataLakeStoreAccount end processing.
Script/Steps for Reproduction
- Open a new PS session
- Run
Test-AzureRmDataLakeStoreAccount
@ro-joowan Hey Joo Wan, would you mind taking a look at this? It seems like if an ADLS Storage Accounts have unique names in Azure, then this cmdlet shouldn't require users to authenticate to check the existence of a storage account.
@matt1883 What do you think about this? It seems to me that all API calls to ADLS should be authenticated.
@cormacpayne @suprak, I confirmed with our PM @matt1883 that the user must login before utilizing any cmdlet.
@ro-joowan , @matt1883
The issue isn't that the user has to log in.
The issue is that there is a null ref exception.
For an example of how other cmdlets handle users who are not logged in, see the below output. Notice how the error points the user to login? This is the standard behavior in most AzureRM cmdlets.
Please fix the behavior of Test-AzureRmDataLakeStoreAccount to match this.
PS C:\Users\akarpus> Get-AzureRmStorageAccount
Get-AzureRmStorageAccount : No account found in the context. Please login using Login-AzureRMAccount.
At line:1 char:1
+ Get-AzureRmStorageAccount
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmStorageAccount], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand
@suprak Thanks for the clarification :)
I believe I found the fix. The ADLS module, however, is frozen at the moment. I'll coordinate the fix in once it's resolved.
@matt1883 @cormacpayne
@suprak I have addressed this in this PR: https://github.com/Azure/azure-powershell/pull/5396. Will update here when it's merged. Thank you.
@matt1883, FYI
@suprak The PR has been approved. Closing the issue now.