Set credentials to connect Microsoft exchange online

tpeleg
Tera Expert

Hello experts,

 

We have to connect Microsoft exchange online to execute automations in Azure side:

Set up email forwarding to manager

Convert mailbox to shared mailbox

Handle Teams extension

Although we are using Integration hub ,our system team found that the only way to do it is to write PowerShell scripts but with API credentials. here is a script template 

 

# Install the MSAL.PS module if not already installed
Install-Module -Name MSAL.PS

 

# Authenticate using app registration
$tenantId = "<your-tenant-id>"
$clientId = "<your-client-id>"
$clientSecret = "<your-client-secret>"

 

$token = Get-MsalToken -TenantId $tenantId -ClientId $clientId -ClientSecret $clientSecret -Scopes "https://outlook.office365.com/.default"

 

# Connect to Exchange Online
Connect-ExchangeOnline -AccessToken $token.AccessToken -AccountId $clientId

 

The thing here is we can't set the 3 parameters hardcoded within the script.

There is a way to save the credentials  (tenant id, client id, client secret) in SN side in a secure way, and to pass it to the PowerShell script dynamically? 

 

Any suggestion could help.

 

Thanks,

 

Tomer

0 REPLIES 0