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

401 Server failed to authenticate the request Using azcopy login #2623

Open
PaulNacamuli opened this issue Mar 27, 2024 · 2 comments
Open

401 Server failed to authenticate the request Using azcopy login #2623

PaulNacamuli opened this issue Mar 27, 2024 · 2 comments
Assignees

Comments

@PaulNacamuli
Copy link

10.14.1 and 10.23.0 and 10.24.0 on Windows

azcopy login --tenant-id GUID
azcopy file.ext https://storage.blob.core.windows.net/Folder/file.ext

This command works exactly as expected on one windows machine (W2012). On another machine in the same net (W2019) the login prompt comes up with a token. When entered, the copy command then shows scanning... and prompts for another code. When entered, there is a 401 failure:

RESPONSE Status: 401 Server failed to authenticate the request. Please refer to the information in the www-authenticate header.
Content-Length: 302
Content-Type: application/xml
Date: Tue, 26 Mar 2024 19:34:04 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
Www-Authenticate: Bearer authorization_uri=https://login.microsoftonline.com/GUID/oauth2/authorize resource_id=https://storage.azure.com
X-Ms-Client-Request-Id: <>
X-Ms-Error-Code: NoAuthenticationInformation
X-Ms-Request-Id: <>
X-Ms-Version: 2023-08-03

The working source machine has a 1:1 NAT that is in the permit list.
The non-working source machine has a many:1 NAT that is in the permit list.

I have not found any workaround for this yet.

@Aussiemon
Copy link

Aussiemon commented Apr 17, 2024

Getting the same error as above when using the Azure File Copy v6 task in Azure DevOps, which uses 10.24.0: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-file-copy-v6?view=azure-pipelines. The error occurs in AzCopy.exe.

  • Two machines, one working fine (Windows Server 2016), and one failing (Windows Server 2019) with the above error.
  • Both machines are using the same task with the same arguments and parameters.
  • Both machines are set to auto-login with PSCRED.
  • Both machines have pwsh.exe on the PATH

Failing machine:

##[command] & "AzCopy\AzCopy.exe" copy "D:\<file path>\*" "https://<storage account>/<container name>/<blob prefix>"  --log-level=INFO --recursive
INFO: Scanning...
 
Failed to perform Auto-login: PSContextCredential�[31;1mGet-AzAccessToken: -REDACTED-;1mRun Connect-AzAccount to login.�[0m

Working machine:

##[command] & "AzCopy\AzCopy.exe" copy "D:\<file path>\*" "https://<storage account>/<container name>/<blob prefix>"  --log-level=INFO --recursive
INFO: Scanning...
INFO: Login with Powershell context succeeded
INFO: Authenticating to destination using Azure AD
INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support
 
Job <job id> has started
Log file is located at: C:\Users\<username>\.azcopy\<job id>.log

@pranavmalik-msft
Copy link
Collaborator

Hey @Aussiemon ,
have you considered utilizing PowerShell for this task? You could streamline the process by leveraging Connect-AzAccount to log in to Azcopy .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants