Using OAuth 2.0 Authorization with a Certificate in SSIS

10 December 2019
Chen Huang

In previous posts, we discussed working with various OAuth 2.0 grant types in SSIS by utilizing our OAuth Token Generator (offered in our SSIS Productivity Pack).

In this post, we delve into getting an OAuth 2.0 access token with a certificate in SSIS. This will be a step-by-step demonstration on how to generate the JSON Web Token (JWT) assertion and use that JWT assertion to get the OAuth2 access token. We will be using Microsoft Graph API as an example for this blog.

Prerequisites

  1. You need to register an Azure AD application and set the appropriate permission for the app.
  2. You need to register your certificate with Azure AD. Please refer to this link for more details.

Get Token in SSIS

Before we get started in generating the token in OAuth Token Generator, let’s first take a look at the Microsoft documentation of getting an access token with a certificate.

Documentation (Link)

Endpoint: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token

Parameters:

  • Tenant: The directory tenant the application plans to operate against, in GUID or domain-name format.
  • Client_id: The application (client) ID of the AAD app.
  • Scope: The value passed for the scope parameter in this request should be the resource identifier (application ID URI) of the resource you want.
  • Client_assertion_type: urn:ietf:params:oauth:client-assertion-type:jwt-bearer.
  • client_assertion: An assertion (a JWT) that you need to create and sign with the certificate you registered as credentials for your application.
  • Grant_type: client_credentials

Once you have the Microsoft AAD app registered and configured, you should be able to get all the required information to put into the OAuth Token Generator as shown below:

OAuth Token Generator - General Setting

Click Next to go to the next page and click the Edit Body to edit the Request Body to specify the additional parameters – client_assertion and client_assertion_type.

To create the client_assertion, we need to enable the “Client Assertion” option in the Edit Body page. Let’s have a look at how to format the assertion.

Documentation (Link)

Parameters:

  • Aud: Audience: Should be https://login.microsoftonline.com/*tenant_Id*/oauth2/token
  • Iss: Issuer: should be the client_id (Application ID of the client service)
  • Sub: Subject: As for iss, should be the client_id (Application ID of the client service)

Based on the documentation, we configure the OAuth Token Generator as follows:

OAuth Token Generator - Edit Body

Note in the Certificate Thumbprint option, we specify the thumbprint of the public certificate that we have uploaded to the Microsoft AAD application. Please make sure you have installed the corresponding Private Key file on the machine where HTTP Connection Manager/OAuth Token Generator is used.

Once done with Edit Body, fill the Request Token URL and click the Get Tokens button to get access_token from the endpoint.

OAuth Token Generator - Get Token

The OAuth Token Generator will ask you to save the token once the access_token is successfully retrieved.

Conclusion

In this blog, we went through the JWT assertion OAuth2 authentication with a certificate and demonstrated the process of working with an OAuth2 authentication workflow in SSIS by using OAuth Token Generator found in our SSIS Productivity Pack. We hope this can help you speed up your SSIS development when working with OAuth 2.0 authentication.

Archive

October 2024 1 September 2024 1 August 2024 2 July 2024 1 June 2024 1 May 2024 1 April 2024 2 March 2024 2 February 2024 2 January 2024 2 December 2023 1 November 2023 1 October 2023 2 August 2023 1 July 2023 2 June 2023 1 May 2023 2 April 2023 1 March 2023 1 February 2023 1 January 2023 2 December 2022 1 November 2022 2 October 2022 2 September 2022 2 August 2022 2 July 2022 3 June 2022 2 May 2022 2 April 2022 3 March 2022 2 February 2022 1 January 2022 2 December 2021 1 October 2021 1 September 2021 2 August 2021 2 July 2021 2 June 2021 1 May 2021 1 April 2021 2 March 2021 2 February 2021 2 January 2021 2 December 2020 2 November 2020 4 October 2020 1 September 2020 3 August 2020 2 July 2020 1 June 2020 2 May 2020 1 April 2020 1 March 2020 1 February 2020 1 January 2020 1 December 2019 1 November 2019 1 October 2019 1 May 2019 1 February 2019 1 December 2018 2 November 2018 1 October 2018 4 September 2018 1 August 2018 1 July 2018 1 June 2018 3 April 2018 3 March 2018 3 February 2018 3 January 2018 2 December 2017 1 April 2017 1 March 2017 7 December 2016 1 November 2016 2 October 2016 1 September 2016 4 August 2016 1 June 2016 1 May 2016 3 April 2016 1 August 2015 1 April 2015 10 August 2014 1 July 2014 1 June 2014 2 May 2014 2 February 2014 1 January 2014 2 October 2013 1 September 2013 2 August 2013 2 June 2013 5 May 2013 2 March 2013 1 February 2013 1 January 2013 1 December 2012 2 November 2012 2 September 2012 2 July 2012 1 May 2012 3 April 2012 2 March 2012 2 January 2012 1

Tags