Search code examples
ssisoauthexchangewebservices

Convert basic authentication to oauth for legacy public calendar in SSIS


I have a script in SSIS that used Basic authentication to get all my data from a public folder so I push the data into a sql database. Obviously this doesn't work anymore. So how would I setup oauth to use authentication that is not integrated - obviously can't have this in an SSIS job that runs daily.

I use delegate authority (seeing this is a legacy public folder) I followed: https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-authenticate-an-ews-application-by-using-oauth#code-samples

This works but comes up with a login screen when I step through code. Obviously again, can't have this when running the job on a server. Is there any way to do authentication on delegated authority where you don't have to manually login? Or to do it manually once and then have the job run and get refresh token so we don't have to manually login multiple times.


Solution

  • Is there any way to do authentication on delegated authority where you don't have to manually login?

    ROPC would work for unattended code https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc however it isn't recommended because of the security issues around it and you need to have no MFA or conditional MFA where it doesn't apply to the running account when executing from a specific machine.

    A better option is to use the client credentials flow https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow then limit the scope of the Mailboxes your app needs to access https://learn.microsoft.com/en-us/graph/auth-limit-mailbox-access.