New-AzureRmDataLakeStoreItem validation on account name invalidates valid names
Description
(I have replaced account names and usernames with non real values) When running New-AzureRmDataLakeStoreItem with a valid Account Name, it gives back the error message:
New-AzureRmDataLakeStoreItem : Account name accountname.azuredatalakestore.net/ is invalid. Specify the full account including the domain name.
The error message comes from ADLSClient.cs. There is a regex to validate the name. It is failing validation because of the trailing / in the account name. The value of the param provided is just accountname, it automatically adds '.azuredatalakestore.net/' to the end.
This error occurs with versions 6.2.1 and 6.1.1 of the AzureRm.DataLakeStore module. 5.1.0 does not produce the error.
Script/Steps for Reproduction
New-AzureRmDataLakeStoreItem -Folder -AccountName accountname -Path "/test"
Module Version
Get-Module -ListAvailable
ModuleType Version Name
---------- ------- ----
Script 0.5.4 Azure.AnalysisServices
Script 4.6.1 Azure.Storage
Script 6.13.1 AzureRM
Script 0.6.14 AzureRM.AnalysisServices
Script 6.1.7 AzureRM.ApiManagement
Script 0.1.8 AzureRM.ApplicationInsights
Script 6.1.1 AzureRM.Automation
Script 4.0.11 AzureRM.Backup
Script 4.1.5 AzureRM.Batch
Script 0.14.6 AzureRM.Billing
Script 5.0.6 AzureRM.Cdn
Script 0.9.12 AzureRM.CognitiveServices
Script 5.9.1 AzureRM.Compute
Script 0.3.7 AzureRM.Consumption
Script 0.2.12 AzureRM.ContainerInstance
Script 1.0.10 AzureRM.ContainerRegistry
Script 5.0.3 AzureRM.DataFactories
Script 0.5.11 AzureRM.DataFactoryV2
Script 5.1.4 AzureRM.DataLakeAnalytics
Script 6.2.1 AzureRM.DataLakeStore
Script 4.0.9 AzureRM.DevTestLabs
Script 5.1.0 AzureRM.Dns
Script 0.3.7 AzureRM.EventGrid
Script 0.7.0 AzureRM.EventHub
Script 4.1.8 AzureRM.HDInsight
Script 5.1.5 AzureRM.Insights
Script 3.1.8 AzureRM.IotHub
Script 5.2.1 AzureRM.KeyVault
Script 4.1.4 AzureRM.LogicApp
Script 0.18.5 AzureRM.MachineLearning
Script 0.4.8 AzureRM.MachineLearningCompute
Script 0.2.7 AzureRM.MarketplaceOrdering
Script 0.10.4 AzureRM.Media
Script 6.11.1 AzureRM.Network
Script 5.0.3 AzureRM.NotificationHubs
Script 5.0.6 AzureRM.OperationalInsights
Script 1.1.0 AzureRM.PolicyInsights
Script 4.1.10 AzureRM.PowerBIEmbedded
Script 5.8.2 AzureRM.profile
Script 4.1.9 AzureRM.RecoveryServices
Script 4.5.2 AzureRM.RecoveryServices.Backup
Script 0.2.12 AzureRM.RecoveryServices.SiteRec...
Script 5.1.0 AzureRM.RedisCache
Script 0.3.12 AzureRM.Relay
Script 6.7.3 AzureRM.Resources
Script 0.16.10 AzureRM.Scheduler
Script 0.6.13 AzureRM.ServiceBus
Script 0.3.15 AzureRM.ServiceFabric
Script 1.0.0 AzureRM.SignalR
Script 4.12.1 AzureRM.Sql
Script 5.2.0 AzureRM.Storage
Script 4.0.10 AzureRM.StreamAnalytics
Script 4.0.5 AzureRM.Tags
Script 4.1.3 AzureRM.TrafficManager
Script 4.0.5 AzureRM.UsageAggregates
Script 5.2.0 AzureRM.Websites
Binary 1.0.0.1 PackageManagement
Script 1.0.0.1 PowerShellGet
Environment Data
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.14409.1005
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1005
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Debug Output
DEBUG: 3:11:33 PM - NewAzureDataLakeStoreItem begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 3:11:33 PM - using account id 'xx@xx'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'xx@xx', environment: 'AzureCloud', tenant: 'xx-xx-xx-xx'
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 11/30/2018 15:11:33: 66c2c7c4-2ba2-4784-8f5e-403ee6d88b69 - AcquireTokenHandlerBase: === Token Acquisition started:
Authority: https://login.microsoftonline.com/xx-xx-xx-xx/
Resource: https://datalake.azure.net/
ClientId: xx-xx-xx-xx
CacheType: Microsoft.Azure.Commands.Common.Authentication.ProtectedFileTokenCache (19 items)
Authentication Target: User
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 11/30/2018 15:11:33: - TokenCache: Deserialized 19 items to token cache.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 11/30/2018 15:11:33: 66c2c7c4-2ba2-4784-8f5e-403ee6d88b69 - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 11/30/2018 15:11:33: 66c2c7c4-2ba2-4784-8f5e-403ee6d88b69 - TokenCache: An item matching the requested resource was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 11/30/2018 15:11:33: 66c2c7c4-2ba2-4784-8f5e-403ee6d88b69 - TokenCache: 40.7817697316667 minutes left until token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 11/30/2018 15:11:33: 66c2c7c4-2ba2-4784-8f5e-403ee6d88b69 - TokenCache: A matching item (access token or refresh token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 11/30/2018 15:11:33: 66c2c7c4-2ba2-4784-8f5e-403ee6d88b69 - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
Access Token Hash: xx
Refresh Token Hash: xx
Expiration Time: 11/30/2018 15:52:20 +00:00
User Hash: xx
New-AzureRmDataLakeStoreItem : Account name accountname.azuredatalakestore.net/ is invalid. Specify the full account including the domain name.
At line:1 char:1
+ New-AzureRmDataLakeStoreItem -Folder -AccountName accountname -Path " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmDataLakeStoreItem], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataLakeStore.NewAzureDataLakeStoreItem
DEBUG: AzureQoSEvent: CommandName - New-AzureRmDataLakeStoreItem; IsSuccess - False; Duration - 00:00:00.1020218; Exception - System.ArgumentException: Account name accountname.azuredatalakestore.net/ is invalid. Specify the full
account including the domain name.
at Microsoft.Azure.DataLake.Store.AdlsClient..ctor(String accnt, Int64 clientId, ServiceClientCredentials creds, Boolean skipAccntValidation)
at Microsoft.Azure.DataLake.Store.AdlsClient.CreateClient(String accountFqdn, ServiceClientCredentials creds)
at Microsoft.Azure.Commands.DataLakeStore.Models.AdlsClientFactory.GetAdlsClient(String accntNm, IAzureContext context)
at Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreFileSystemClient.TestFileOrFolderExistence(String path, String accountName, DirectoryEntryType& itemType)
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ConfirmAction(Boolean force, String continueMessage, String processMessage, String target, Action action, Func`1 useShouldContinue)
at Microsoft.Azure.Commands.DataLakeStore.NewAzureDataLakeStoreItem.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 3:11:34 PM - NewAzureDataLakeStoreItem end processing.
DEBUG: 3:11:34 PM - NewAzureDataLakeStoreItem end processing.
@rahuldutta90 Hey Rahul, I believe this issue is covered by PR https://github.com/Azure/azure-powershell/pull/7916, correct?
@cormacpayne yes correct.
Till the next release comes out, @edtheshed can you please pass the full adls account name including the domain as a workaround. For ex: if your account name is contoso then pass -Account "contoso.azuredatalakestore.net". That should mitigate the issue.
ah cool you guys are on it already! thanks very much
Hi, I have the same error and version 6.13.1 .

If I use the suggestion of @rahuldutta90 "full adls account name including the domain as a workaround" ej "myacocount.azuredatalakestore.net"
I get other error "The remote name could not be resolved: ". Is there any other workaround?
Regards
@luisjmlky can you use most updated az.datalakestore modules?
There has been number of fixes since then. Would be better to use most recent version
Hi, I work with AzureRM not with Az modules. AzureRM will replace to Az modules isn't it?.
Regards
[cid:d2f8577d-956d-415c-8944-e0f173a2057c]
De: Rahul Dutta [email protected] Enviado: miércoles, 27 de mayo de 2020 3:29 Para: Azure/azure-powershell [email protected] Cc: luisjmlky [email protected]; Mention [email protected] Asunto: Re: [Azure/azure-powershell] New-AzureRmDataLakeStoreItem validation on account name invalidates valid names (#7962)
@luisjmlkyhttps://github.com/luisjmlky can you use most updated az.datalakestore modules?
There has been number of fixes since then. Would be better to use most recent version
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-powershell/issues/7962#issuecomment-634369669, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH5KLH5T72CTVXLPP5HSFPTRTRUGTANCNFSM4GHPNK4Q.