aws / aws-toolkit-azure-devops

AWS Toolkit for Azure DevOps
Other
245 stars 104 forks source link

UnrecognizedClientException: The security token included in the request is invalid' when pushing ECR image #465

Closed xyfoo closed 2 years ago

xyfoo commented 2 years ago

Describe the bug

Encounter 'UnrecognizedClientException: The security token included in the request is invalid' when try to push ECR image

To reproduce

  1. Setup Azure DevOps service connection with only access key id & secret access key

  2. Use 'Amazon ECR Push' Task

    - task: ECRPushImage@1
    displayName: "Push docker image to AWS ECR"
    inputs:
      awsCredentials: "$(aws_azdo_svc_connection)"
      regionName: "$(aws_region)"
      sourceImageName: "$(docker_image_name)"
      sourceImageTag: "latest"
      repositoryName: "$(ecr_repo_name)"
      pushTag: "latest"
      logRequest: true
      logResponse: true
  3. Run pipeline

  4. Task failed

==============================================================================
Configuring credentials for task
...configuring AWS credentials from service endpoint '{redacted}'
...endpoint defines standard access/secret key credentials
Configuring region for task
...configured to use region us-east-1, defined in task.
Pushing image '{redacted}:latest'
Obtaining authentication token for ECR login
##[error]Error: Failed to obtain authorization token to log in to ECR, error: UnrecognizedClientException: The security token included in the request is invalid
Finishing: Push docker image to AWS ECR

Expected behavior

Image will be pushed to ECR

Your Environment

Additional context

xyfoo commented 2 years ago

Closing this as the issue was caused by bug in Azure DevOps Service Connection. Reported separately as issue #466