Azure / azure-cli

Azure Command-Line Interface
MIT License
4.02k stars 2.99k forks source link

az storage blob upload-batch fails with NoAuthenticationInformation #27711

Open singankit opened 1 year ago

singankit commented 1 year ago

Describe the bug

az storage blob upload-batch command fails with below error:

ERROR: Server failed to authenticate the request. Please refer to the information in the www-authenticate header. RequestId:7f9df27e-201e-004f-4d34-08d0a9000000 Time:2023-10-26T17:50:51.1501299Z ErrorCode:NoAuthenticationInformation

Related command

az storage blob upload-batch

Errors

D:\a_work\3\s>az storage blob upload-batch --overwrite true -d development/2.0.1a6 -s extension/schema --account-name azuremlsdk2 WARNING: There are no credentials provided in your command and environment, we will query for account key for your storage account. It is recommended to provide --connection-string, --account-key or --sas-token in your command as credentials.

You also can add --auth-mode login in your command to use Azure Active Directory (Azure AD) for authorization if your login account is assigned required RBAC roles. For more information about RBAC roles in storage, visit https://docs.microsoft.com/azure/storage/common/storage-auth-aad-rbac-cli.

In addition, setting the corresponding environment variables can avoid inputting credentials in your command. Please use --help to get more information about environment variable usage. WARNING: Skip querying account key due to failure: Storage account 'azuremlsdk2' not found. ERROR: Server failed to authenticate the request. Please refer to the information in the www-authenticate header. RequestId:7f9df27e-201e-004f-4d34-08d0a9000000 Time:2023-10-26T17:50:51.1501299Z ErrorCode:NoAuthenticationInformation

Issue script & Debug output

2023-10-26T17:50:34.1009398Z ##[section]Starting: Copy yaml schema to blob 2023-10-26T17:50:34.1144861Z ============================================================================== 2023-10-26T17:50:34.1145235Z Task : Azure CLI 2023-10-26T17:50:34.1145401Z Description : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent. 2023-10-26T17:50:34.1146666Z Version : 2.229.0 2023-10-26T17:50:34.1146814Z Author : Microsoft Corporation 2023-10-26T17:50:34.1147030Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli 2023-10-26T17:50:34.1147502Z ============================================================================== 2023-10-26T17:50:34.6458098Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" --version" 2023-10-26T17:50:35.3327343Z WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade' 2023-10-26T17:50:35.3328514Z azure-cli 2.53.0 2023-10-26T17:50:35.3334935Z 2023-10-26T17:50:35.3342879Z core 2.53.0 2023-10-26T17:50:35.3343947Z telemetry 1.1.0 2023-10-26T17:50:35.3344526Z 2023-10-26T17:50:35.3345038Z Extensions: 2023-10-26T17:50:35.3345867Z azure-devops 0.26.0 2023-10-26T17:50:35.3352175Z 2023-10-26T17:50:35.3352899Z Dependencies: 2023-10-26T17:50:35.3353454Z msal 1.24.0b2 2023-10-26T17:50:35.3354238Z azure-mgmt-resource 23.1.0b2 2023-10-26T17:50:35.3354786Z 2023-10-26T17:50:35.3361200Z Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe' 2023-10-26T17:50:35.3362657Z Extensions directory 'C:\Program Files\Common Files\AzureCliExtensionDirectory' 2023-10-26T17:50:35.3363454Z 2023-10-26T17:50:35.3364326Z Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)] 2023-10-26T17:50:35.3365351Z 2023-10-26T17:50:35.3375635Z Legal docs and information: aka.ms/AzureCliLegal 2023-10-26T17:50:35.3381316Z 2023-10-26T17:50:35.3381814Z 2023-10-26T17:50:35.3390724Z Setting AZURE_CONFIG_DIR env variable to: D:\a_work_temp.azclitask 2023-10-26T17:50:35.3392929Z Setting active cloud to: AzureCloud 2023-10-26T17:50:35.3411703Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" cloud set -n AzureCloud" 2023-10-26T17:50:35.8766241Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login --service-principal -u "--password=" --tenant 72f988bf-86f1-41af-91ab-2d7cd011db47 --allow-no-subscriptions" 2023-10-26T17:50:36.8627501Z [ 2023-10-26T17:50:36.8646557Z { 2023-10-26T17:50:36.8647032Z "cloudName": "AzureCloud", 2023-10-26T17:50:36.8648231Z "homeTenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", 2023-10-26T17:50:36.8649237Z "id": "589c7ae9-223e-45e3-a191-98433e0821a9", 2023-10-26T17:50:36.8655838Z "isDefault": true, 2023-10-26T17:50:36.8658275Z "managedByTenants": [ 2023-10-26T17:50:36.8658868Z { 2023-10-26T17:50:36.8660438Z "tenantId": "2f4a9838-26b7-47ee-be60-ccc1fdec5953" 2023-10-26T17:50:36.8663017Z } 2023-10-26T17:50:36.8669008Z ], 2023-10-26T17:50:36.8669644Z "name": "Project Vienna INT", 2023-10-26T17:50:36.8670215Z "state": "Enabled", 2023-10-26T17:50:36.8671011Z "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", 2023-10-26T17:50:36.8671788Z "user": { 2023-10-26T17:50:36.8677806Z "name": "***", 2023-10-26T17:50:36.8678240Z "type": "servicePrincipal" 2023-10-26T17:50:36.8678847Z } 2023-10-26T17:50:36.8679325Z } 2023-10-26T17:50:36.8679774Z ] 2023-10-26T17:50:36.8696896Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" account set --subscription 589c7ae9-223e-45e3-a191-98433e0821a9" 2023-10-26T17:50:37.5008318Z [command]C:\Windows\system32\cmd.exe /D /S /C "D:\a_work_temp\azureclitaskscript1698342634618.bat" 2023-10-26T17:50:37.5010366Z 2023-10-26T17:50:37.5012289Z D:\a_work\3\s>az storage blob upload-batch --overwrite true -d development/2.0.1a6 -s extension/schema --account-name azuremlsdk2 2023-10-26T17:50:50.4926198Z WARNING: 2023-10-26T17:50:50.4927335Z There are no credentials provided in your command and environment, we will query for account key for your storage account. 2023-10-26T17:50:50.4929400Z It is recommended to provide --connection-string, --account-key or --sas-token in your command as credentials. 2023-10-26T17:50:50.4930426Z 2023-10-26T17:50:50.4931954Z You also can add --auth-mode login in your command to use Azure Active Directory (Azure AD) for authorization if your login account is assigned required RBAC roles. 2023-10-26T17:50:50.4934183Z For more information about RBAC roles in storage, visit https://docs.microsoft.com/azure/storage/common/storage-auth-aad-rbac-cli. 2023-10-26T17:50:50.4935257Z 2023-10-26T17:50:50.4936784Z In addition, setting the corresponding environment variables can avoid inputting credentials in your command. Please use --help to get more information about environment variable usage. 2023-10-26T17:50:51.0778412Z WARNING: 2023-10-26T17:50:51.0779584Z Skip querying account key due to failure: Storage account 'azuremlsdk2' not found. 2023-10-26T17:50:51.1580535Z ERROR: Server failed to authenticate the request. Please refer to the information in the www-authenticate header. 2023-10-26T17:50:51.1582273Z RequestId:7f9df27e-201e-004f-4d34-08d0a9000000 2023-10-26T17:50:51.1582844Z Time:2023-10-26T17:50:51.1501299Z 2023-10-26T17:50:51.1583227Z ErrorCode:NoAuthenticationInformation 2023-10-26T17:50:51.3818018Z ##[error]Script failed with exit code: 1 2023-10-26T17:50:51.5414000Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" account clear" 2023-10-26T17:50:51.9751495Z ##[section]Finishing: Copy yaml schema to blob

Expected behavior

az storage blob upload-batch command should pass

Environment Summary

C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" --version" WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade' azure-cli 2.53.0 *

core 2.53.0 * telemetry 1.1.0

Extensions: azure-devops 0.26.0

Dependencies: msal 1.24.0b2 azure-mgmt-resource 23.1.0b2

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe' Extensions directory 'C:\Program Files\Common Files\AzureCliExtensionDirectory'

Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)]

Additional context

This is failing in azure dev ops pipeline.

azure-client-tools-bot-prd[bot] commented 1 year ago

Hi @singankit,

2.53.0 is not the latest Azure CLI(2.53.1).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

azure-client-tools-bot-prd[bot] commented 1 year ago
Hi @singankit Find similar issue https://github.com/Azure/azure-cli/issues/23821.
Issue title Azure CLI: API version 2022-05-01 does not have operation group 'storage_accounts'
Create time 2022-09-08
Comment number 12

Possible solution: The error message "Server failed to authenticate the request. Please refer to the information in the www-authenticate header." is similar to the error message in issue #23821. In that issue, the solution was to specify --auth-mode key and provide --account-key together with --account-name. If you still have problems after adding --account-key, please share the debug log.

Another possible solution is to manually install the latest Azure CLI version, as it seems like some dependencies may be missing during auto upgrade. You can follow the instructions in this link to install the latest Azure CLI version: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli.


Please confirm if this resolves your issue.

yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

calvinhzy commented 1 year ago

image Is the storage account not accessible by any chance?