the AWS Powershell SAML code below works without problems on all windows workstations but on all windows servers we get this error:
Use-STSRole : Credential generation from SAML authentication failed. + CategoryInfo : InvalidOperation: (Amazon.PowerShe...seSTSRoleCmdlet:UseSTSRoleCmdlet) [Use-STSRole], InvalidOperationException + FullyQualifiedErrorId : Amazon.Runtime.AmazonClientException,Amazon.PowerShell.Cmdlets.STS.UseSTSRoleCmdlet
powershell code:
Clear-AWSCredentials
Set-DefaultAWSRegion eu-west-1
$ADFSendpoint=Set-AWSSamlEndpoint -Endpoint "https://adfs.mycompany.com/adfs/ls/IdpInitiatedSignOn.aspx?loginToRp=urn:amazon:webservices" -StoreAs ADFSendpoint
Set-AWSSamlRoleProfile -EndpointName $ADFSendpoint -StoreAllRoles
Set-AWSCredentials -ProfileName "123456789012:role/MyRole"
$RoleArn = "arn:aws:iam::123456789012:role/MyRole"
$CredentialAws = (Use-STSRole -RoleArn $RoleArn -RoleSessionName "MySession").Credentials
$CredentialAws
Get-S3Bucket
This is maddening - they are otherwise identically set up, and the ADFS endpoint still works fine in a browser on the servers, but NOT in Powershell.
This used to work recently on the servers but I am unable to find out why it stopped working.