aws / aws/aws-toolkit-azure-devops

Credentials are not working in inline powershell script

Open
#287 1 comment 0 reactions 0 assignees View on GitHub
needs-response
Dominant language
TypeScript
Stars
258
Forks
114
PR merge metrics
No merged PRs in 30d

Description

Hi,
I added the "AWS Tools for Windows PowerShell Script" task to my Azure DevOps pipeline, then I added my valid AWS credentials using AWS Service Connection (input AccessKeyID and SecretAccessKey in popup window), then choose "Inline Script" option and input my powershell script:
New-CFInvalidation -DistributionId 'XXXXX' -Paths_Item ' /*'

When I trigger my pipeline I got the following error:
New-CFInvalidation : No credentials specified or obtained from persisted/shell defaults.
At C:\agent_work_temp\e6ffb344-ff94-47e4-b5b8-2d5801faab61.ps1:5 char:11

$result = New-CFInvalidation -DistributionId 'XXXX' -Paths_Item ' /*

+ CategoryInfo : InvalidOperation: (Amazon.PowerShe...alidationCmdlet:NewCFInvalidationCmdlet) [New-CFInv

alidation], InvalidOperationException

+ FullyQualifiedErrorId : InvalidOperationException,Amazon.PowerShell.Cmdlets.CF.NewCFInvalidationCmdlet

The AWS Service Connection works if I use it for "AWS CLI" task in my pipeline.

Regards,
Alexander

Contributor guide

Open the contributing guide

Research direction

Start by comparing how the AWS CLI task passes the AWS Service Connection to how the AWS Tools for Windows PowerShell Script task runs its Inline Script. Reproduce the New-CFInvalidation command with the reported service connection; done means the command obtains those credentials and no longer reports that none were specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, azure, powershell
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.