Example 1
Set-AWSSamlRoleProfile -StoreAs Role1 -EndpointName MyADFSEndpoint
Authenticates the currently logged in user account against the specified endpoint (configured previusly using Set-AWSSamlEndpoint). Following successful authentication, if the user is authorized to assume only a single role the role details are stored in a profile named 'Role1'. If the user is authorized for more than one role a menu is presented for the desired role to be associated with the profile to be selected.
The role profile can be used to obtain time-limited temporary AWS credentials by specifying it as the value of the -ProfileName parameter to the Set-AWSCredentials cmdlet or any cmdlet that makes calls to AWS service operations. Authentication prior to obtaining credentials is performed using the current user identity.
Example 2
$credential = Get-Credential -Message "Enter user credentials for authentication"
Set-AWSSamlRoleProfile -StoreAs Role1 -EndpointName MyADFSEndpoint -NetworkCredential $credential
Authenticates the specified user account against the specified endpoint (configured previously using Set-AWSSamlEndpoint). Following successful authentication, if the user is authorized to assume only a single role the role details are stored in a profile named 'Role1'. If the user is authorized for more than one role a menu is presented for the desired role to be associated with the profile to be selected.
The role profile can be used to obtain time-limited temporary AWS credentials by specifying it as the value of the -ProfileName parameter to the Set-AWSCredentials cmdlet or any cmdlet that makes calls to AWS service operations. Authentication prior to obtaining credentials is performed using the current user identity.
Example 3
$params = @{
"PrincipalARN"="arn:aws:iam::012345678912:saml-provider/ADFS"
"RoleARN"="arn:aws:iam::012345678912:role/ADFS-Dev"
}
Set-AWSSamlRoleProfile @params -StoreAs ADFS-Dev
This example shows how to create or update a role profile when the Amazon Resource Names (ARNs) for the role are known in advance. Following authentication for the currently logged in user the cmdlet will verify that the role is present in the set the user is authorized to assume and set up the role profile. If the role is not found the user is prompted to select the correct role.
To authenticate as a different user account add the -NetworkCredential parameter as shown in other examples.
Example 4
Set-AWSSamlRoleProfile -StoreAllRoles -EndpointName MyADFSEndpoint
Authenticates the current user account against the configured endpoint and if successful creates one role profile for each role the user is authorized to assume. The 'friendly name' of the role is used as the name for each profile.
To authenticate as a different user account add the -NetworkCredential parameter as shown in other examples.