You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Assume that I have an IAM user for Azure DevOps and the IAM user can switch two roles in a dev account and a production account.
I want to use one service connection for the IAM user and pass a role ARN in build runtime.
However AWSShellScript@1 task (and other tasks) don't accept a role ARN as input paramter. Now, I manually AssumeRole in AWSShellScript@1 task and set variables like AWS.AccessKeyID as below.
jobs:
- job: job_in_devvariables:
AWS.Region: ap-northeast-1roleArn: arn:aws:iam::123456789012:role/azure-devops-DevRolesessionName: $(Build.BuildId)steps:
- task: AWSShellScript@1displayName: AssumeRoleinputs:
awsCredentials: aws-sample-connectionscriptType: inlineinlineScript: | aws sts assume-role --role-arn $(roleArn) --role-session-name $(sessionName) \ --query 'Credentials.[AccessKeyId, SecretAccessKey, SessionToken]' --out text \ | while read -r v1 v2 v3; do echo "##vso[task.setvariable variable=AWS.AccessKeyID;issecret=true]$v1" echo "##vso[task.setvariable variable=AWS.SecretAccessKey;issecret=true]$v2" echo "##vso[task.setvariable variable=AWS.SessionToken;issecret=true]$v3" done
- task: AWSShellScript@1displayName: Do the job in dev accountinputs:
scriptType: inlineinlineScript: aws ec2 describe-instances
This method works but the first step is too redundant.
Describe the solution you'd like
I suggest to add a task to AssumeRole (ex: AWSAssumeRole@0). If AWSAssumeRole@0 accept a service connection (awsCredentials) and a role ARN, the above yaml is simplified.
jobs:
- job: job_in_devvariables:
AWS.Region: ap-northeast-1steps:
- task: AWSAssumeRole@0inputs:
awsCredentials: aws-sample-connectionassumeRoleArn: arn:aws:iam::123456789012:role/azure-devops-DevRoleroleSessionName: $(Build.BuildId)externalId: xxx# subsequent steps can use a shot-live credential genereated by AssumeRole
- task: AWSShellScript@1displayName: Do the job in dev accountinputs:
scriptType: inlineinlineScript: aws ec2 describe-instances
Describe alternatives you've considered
An alternative solution is a method to pass a role ARN as build variable. If AWSShellScript@1 (and other tasks) read a role ARN from build variable like AWS.AssumeRoleArn, the above yaml is simplified.
jobs:
- job: job_in_devvariables:
AWS.Region: ap-northeast-1AWS.AssumeRoleArn: arn:aws:iam::123456789012:role/azure-devops-DevRoleAWS.RoleSessionName: $(Build.BuildId)AWS.ExternalId: xxxsteps:
- task: AWSShellScript@1displayName: Do the job in dev accountinputs:
awsCredentials: aws-sample-connectionscriptType: inlineinlineScript: aws ec2 describe-instances
Is your feature request related to a problem? Please describe.
Assume that I have an IAM user for Azure DevOps and the IAM user can switch two roles in a dev account and a production account.
I want to use one service connection for the IAM user and pass a role ARN in build runtime.
However
AWSShellScript@1
task (and other tasks) don't accept a role ARN as input paramter. Now, I manually AssumeRole inAWSShellScript@1
task and set variables likeAWS.AccessKeyID
as below.This method works but the first step is too redundant.
Describe the solution you'd like
I suggest to add a task to AssumeRole (ex:
AWSAssumeRole@0
). IfAWSAssumeRole@0
accept a service connection (awsCredentials
) and a role ARN, the above yaml is simplified.Describe alternatives you've considered
An alternative solution is a method to pass a role ARN as build variable. If
AWSShellScript@1
(and other tasks) read a role ARN from build variable likeAWS.AssumeRoleArn
, the above yaml is simplified.This solution is already suggested by @FaridNeshat-TomTom in #340 (comment).
The text was updated successfully, but these errors were encountered: