Saturday, November 7, 2026
HomeBig DataFederate entry to Amazon Redshift utilizing the JDBC browser plugin for Single...

Federate entry to Amazon Redshift utilizing the JDBC browser plugin for Single Signal-on authentication with Microsoft Azure Lively Listing

[ad_1]

Since 2020, Amazon Redshift has supported multi-factor authentication (MFA) to any SAML 2.0 compliant id supplier (IdP) in our JDBC and ODBC drivers. You may map the IdP person id and group memberships so as to management authorization for database objects in Amazon Redshift. This simplifies administration by enabling you to handle person entry in a central location, decreasing the overhead of making and sustaining customers within the database at the side of the IdP.

Not too long ago, we helped a buyer who was constructing their knowledge warehouse on Amazon Redshift and had the requirement of utilizing Microsoft Azure Lively Listing (Azure AD) as their company IdP with MFA. This submit illustrates easy methods to arrange federation utilizing Azure AD and AWS Id and Entry Administration (IAM). Azure AD manages the customers and offers federated entry to Amazon Redshift utilizing IAM.

Conditions

This submit assumes that you’ve the next:

Resolution overview

This submit consists of the next three sections to implement the answer:

  1. Arrange the Azure Enterprise non-gallery software utilizing single sign-on (SSO) with SAML.
  2. Arrange the IAM supplier and roles, which incorporates the next steps:
    1. Create the SAML id supplier.
    2. Create an IAM function for entry to the Amazon Redshift cluster.
    3. Create an IAM supplier and an IAM function to make use of SAML-based federation.
    4. Take a look at the SSO setup.
  3. Configure the JDBC shopper to make use of Azure AD person credentials utilizing a browser to log in to the Amazon Redshift cluster. This submit makes use of a JDBC shopper, however you should utilize the identical setup to assist ODBC purchasers.

Arrange an Azure Enterprise software

To arrange an Azure Enterprise software to regulate Amazon Redshift entry, full the next steps:

  1. Log in to Azure Portal and beneath Companies, select Enterprise functions.
  2. Select New software.
  3. For Add an software, select Non-gallery software.
  4. For Identify¸ enter Redshift.
  5. Select Add.
  6. For Identifier (Entity ID), enter a string (it’s not used within the circulate by default).
  7. For ReplyURL, enter http://localhost/redshift/.
  8. Select Add new declare.
  9. Configure your SAML claims as proven within the following desk (for extra info, see Configure SAML assertions to your IdP).
Declare identify Worth
Distinctive person identifier (identify ID) person.userprincipalname
https://aws.amazon.com/SAML/Attributes/Function arn:aws:iam::111122223333:function/AzureSSO,arn:aws:iam::111122223333:saml-provider/AzureADProvider
https://aws.amazon.com/SAML/Attributes/RoleSessionName person.userprincipalname
https://redshift.amazon.com/SAML/Attributes/AutoCreate "true"
https://redshift.amazon.com/SAML/Attributes/DbGroups person.assignedroles
https://redshift.amazon.com/SAML/Attributes/DbUser person.userprincipalname

  1. Within the Handle declare part, for Identify, enter Function.
  2. For Supply attribute, enter your supply, which incorporates your AWS account ID, IAM coverage, and IAM supplier.
  3. On the Permissions web page, add customers or teams to your software (alternatively, grant common admin consent for the complete group).
  4. Obtain your federation metadata.

You want the metadata to configure the IAM IdP. Examine your IdP for easy methods to obtain this doc, as a result of each IdP handles this in another way.

  1. On the App registration web page, select Authentication within the navigation pane.
  2. Within the Cellular and desktop functions part, add http://localhost/redshift/.
  3. For Allow the next cell and desktop flows, select Sure.
  4. On the Enterprise functions web page, select your software.
  5. Within the Arrange Single Signal-On with SAML part, select Edit.
  6. Verify the reply URL.

  7. On the Customers and teams web page, add the required function or group.

Arrange IAM to permit Azure AD customers to entry Amazon Redshift

On this part, you configure IAM to permit Azure AD customers to entry Amazon Redshift assets and get short-term credentials.

  1. Check in to the AWS Administration Console because the admin account.
  2. On the IAM console, select Id suppliers within the navigation pane.
  3. Select Create Supplier.
  4. For Supplier Sort, select SAML.
  5. For Supplier identify, enter a reputation to your supplier.
  6. For Metadata Doc, select the file you downloaded or saved out of your IdP.
  7. Select Subsequent Step.
  8. Select Create.

Now you arrange your coverage. For detailed directions, see Federate Database Consumer Authentication Simply with IAM and Amazon Redshift.

  1. On the IAM console, select Insurance policies within the navigation pane.
  2. Select Create coverage.

You’re directed to the Create coverage web page, the place you may select the Visible editor tab for step-by-step coverage creation or the JSON tab to edit the coverage in a single step.

  1. For this submit, select the JSON tab.
  2. Within the textual content field, enter the next code:
{
    "Model": "2012-10-17",
    "Assertion": [
        {
            "Effect": "Allow",
            "Action": "redshift:GetClusterCredentials",
            "Resource": [
                "arn:aws:redshift:us-west-1:your-account-number:dbname:cluster-identifier/dev",
                "arn:aws:redshift:us-west-1:your-account-number :dbuser:cluster-identifier/${redshift:DbUser}",
                "arn:aws:redshift:us-west-1:your-account-number :cluster:cluster-identifier"
            ],
            "Situation": {
                "StringEquals": {
                    "aws:userid": "distinctive function ID:${redshift:DbUser}@companyemail.com"
                }
            }
        },
        {
            "Impact": "Enable",
            "Motion": "redshift:CreateClusterUser",
            "Useful resource": "arn:aws:redshift:us-west-1:your-account-number:dbuser:cluster-identifier/${redshift:DbUser}"
        },
        {
            "Impact": "Enable",
            "Motion": "redshift:JoinGroup",
            "Useful resource": "arn:aws:redshift:us-west-1:your-account-number:dbgroup:cluster-identifier/db_group"
        },
        {
            "Impact": "Enable",
            "Motion": [
                "redshift:DescribeClusters",
                "iam:ListRoles"
            ],
            "Useful resource": "*"
        }
    ]
}

Within the previous code, present the next info:

  • The Area of your cluster (for this submit, we use us-west-1).
  • The account quantity your cluster is on.
  • The Amazon Redshift cluster you wish to grant customers permission to (you may as well enter * for all clusters beneath that account).
  • Your database identify (for this submit, we use dev; you may as well enter * to permit entry to all databases).
  • The distinctive ID of the IAM function you created (you may get this by working aws iam get-role --role-name Your_Role_Name within the terminal).
  • Your tenant or firm e mail.
  • The database group you wish to assign customers to.
  • ${redshift:DbUser} is changed with no matter your IdP (Azure) specified for the SAML DbUser discipline for the person.

The primary assertion permits customers to seize short-term credentials from the cluster if:

  • It’s on the desired cluster, within the appropriate account, within the Area specified.
  • The dbname the person is making an attempt to hook up with is dev.
  • The person making an attempt to attach matches the DbUser laid out in Azure.
  • The person is beneath the function specified by the distinctive function ID with the IAM account beneath your organization’s e mail.

This all is dependent upon your setup with IdP (Azure) configuration. In case your worker’s e mail is johndoe@firm.org, it’s essential to set ${redshift:DbUser} to the tremendous discipline that matches to the worker’s username johndoe and set the AWS SAML RoleSessionName discipline to be the tremendous discipline that matches the worker’s e mail johndoe@firm.org to make this situation work.

In case you set ${redshift:DbUser} to be the worker’s e mail, take away the @companyemail.com within the instance code to match the RoleSessionName.

In case you set the RoleSessionId to be simply the worker’s username, take away the @companyemail.com within the instance code to match the RoleSessionName.

Within the Azure setup directions, ${redshift:DbUser} and RoleSessionName are each set to the worker’s e mail, so it’s best to take away @companyemail.com within the previous code when you’re following these directions carefully. This submit creates the person’s database username beneath their e mail and indicators them in to AWS beneath this e mail.

The second assertion permits customers to create a database username beneath the desired circumstances. Within the previous code, it restricts creation to ${redshift:DbUser}.

The third assertion specifies what teams the person can be a part of.

The ultimate assertion specifies what actions the person can carry out on the assets. Within the previous code, customers can name DescribeClusters to get cluster info, and IAM ListRoles to verify which roles the person can assume. “Useful resource: “*” applies the previous actions to any Amazon Redshift cluster the person has entry to.

  1. Select Assessment coverage.
  2. For Identify¸ enter a reputation to your coverage.
  3. For Description, enter an non-obligatory description.
  4. For Abstract, assessment your coverage elements and ensure to resolve any warnings or errors.
  5. Select Create coverage.

Lastly, we create the IAM function.

  1. Within the navigation pane, select Roles.
  2. Select Create function.
  3. For Choose sort of trusted entity, select SAML 2.0 federation.
  4. For SAML supplier, select the supplier you created (for this submit, AzureTest).
  5. For Attribute, depart on the default (SAML:aud).
  6. For Worth¸ enter http://localhost/redshift/.
  7. Select Subsequent: Permissions.
  8. Below Connect permissions insurance policies, seek for and choose the coverage you created.
  9. Below Set permissions boundary¸ you may set superior controls for person permissions (for this submit, we don’t make any adjustments).
  10. Select Subsequent: Tags.
  11. Below Add tabs (non-obligatory), you may add key-value tags to raised arrange, monitor, or management entry for this function. For this submit, we don’t add any tags.
  12. Select Subsequent: Assessment.
  13. For Function identify, enter a reputation to your function.
  14. For Function description, enter an non-obligatory description.
  15. For Trusted entities, confirm the ARN of the supplier you specified earlier is appropriate.
  16. For Permissions boundary, confirm that the settings you specified earlier (if any) are appropriate.
  17. Select Create function.

In case you haven’t already, you’re now able to create the Amazon Redshift cluster for the Azure AD customers to hook up with.

Join by JDBC and run queries

You should utilize any software that may soak up a JDBC driver to attach utilizing Azure SSO, and even use a language like Java to attach utilizing a script. For this submit, we use SQL Workbench/J, which is a standard software to hook up with JDBC and run queries.

  1. Set up SQL Workbench/J if not already put in.
  2. Begin SQL Workbench/J.
  3. On the Choose Connection Profile web page, select the Add profile group icon.

Including a folder is non-obligatory however helps hold issues organized.

  1. Identify your folder (for this submit, AzureAuth).
  2. Select the New connection profile icon.

Creating a brand new profile in your profile group is non-obligatory however helps hold issues organized.

  1. Identify your profile (for this submit, Azure).
  2. Select Handle Drivers.
  3. Select Amazon Redshift.
  4. Select the Open folder icon.
  5. Select the JDBC JAR file.
  6. Select OK.
  7. On the Choose Connection Profile web page, for Driver, select Amazon Redshift (com.amazon.redshift.jdbc.Driver).
  8. For URL, enter the IAM JDBC URL along with your cluster identifier, Area, and database identify (for instance, jdbc:redshift:iam://cluster-identifier:us-west-1/dev).

Alternatively, you should utilize the format jdbc:redshift:iam://<cluster-dns-here>:<cluster-port>/<your-DB-name-here>.

  1. Select Prolonged Properties.
  2. Select the Create new entry icon.
  3. Enter the next info:
    1. Property plugin_name with worth com.amazon.redshift.plugin.BrowseAzureCredentialsProvider. This tells the motive force what authentication methodology to decide on. This could at all times be set to com.amazon.redshift.plugin.BrowserAzureCredentialsProvider.
    2. Property idp_tenant with the worth of your IdP tenant. That is the tenant identify of your organization configured in your IdP (Azure). This worth can both be the tenant identify or the tenant distinctive ID with hyphens (most popular). In case you use a tenant identify, it may trigger uncertainty when organising the appliance.
    3. Property client_id with the worth of your software shopper ID. That is the shopper ID with hyphens of the Amazon Redshift software you created when organising your Azure SSO configurations.
  4. Select OK.
  5. On the Choose Connection Profile web page, depart every part else on the default values and select OK.

The driving force opens the default browser with the SSO sign-in web page.

After you check in, you’re redirected to localhost with successful message.

Troubleshooting

If one thing goes incorrect, logging is the primary name to begin an investigation.

You may add an prolonged property with the next code:

DSILogLevel=6
LogPath=<any present listing>

Alternatively, use a connection string:

jdbc:redshift://<cluster_url>:<port>/<db>?DSILogLevel=6&LogPath=<any present listing>

For an Unauthorized exception, verify your authentication in Azure Portal, beneath Cellular and desktop functions.

For a PKX exception, first attempt to use the ssl=false prolonged property. The vanish exception signifies that the issue is within the SSL certificates between the cluster and shopper. If that’s the case, first attempt to use the newest driver and verify in case your cluster model is previous. Then run your software with the “-Djavax.internet.debug=all” key for JVM. This reveals all of the TLS visitors. Be certain the certification is there.

For the exception SAML error: Not approved to carry out sts:AssumeRoleWithSAML, it’s essential to edit the IAM function belief relationship.

Change "StringEquals" to "StringLike" : { "saml:aud": "*" }, then put it aside and check out once more. Additionally verify that saml:aud and replyURL in Azure are precisely the identical. In the event that they’re completely different, authentication fails and causes the identical error.

Abstract

Amazon Redshift makes it straightforward to combine with third-party id suppliers to supply centralized person administration. On this submit, we confirmed easy methods to configure the Amazon Redshift browser-based plugin to make use of multi-factored authentication with Microsoft Azure Lively Listing. You may comply with these similar steps to work along with your SAML 2.0 compliant id supplier of selection.


Concerning the Authors


Ilesh Garish is a Software program Growth Engineer at AWS. His function is to develop connectors for Amazon Redshift. Previous to AWS, he constructed database drivers for the Oracle RDBMS, TigerLogic XDMS, and OpenAccess SDK. He labored within the database inside applied sciences at San Francisco Bay Space startups.

Brandon Schur is a Senior Database Engineer at AWS.  He focuses on efficiency tuning for MPP databases, drivers & connectivity, and integrations with AWS companies and companions.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments