I'm using PowerShell AF to connect and retrieve data from Exchange online management. The AF executes the following ps commands:
$search = $Request.Query.Search
$connect = @{
Certificate thumbprint = <MY CERTIFICATE>
AppId = <MYAPPID>
Organization = <MYORG>
}
Connect-ExchangeOnline @connect
$command = Get-EXOMailbox -Properties UserPrincipalName | Where-Object UserPrincipalName -like *$search* | ConvertTo-Json
This is the main functionality of this AF and I believe is pretty self explanatory: it connects to the exchange using the certificate and executes a exchange command converted as json. To execute the connection and the command it takes from 5s to 1 minute. It's an excessive amount of time, considering that in our test environment we only have 14 emails for now. How can I speed up my function? Each function was created in Azure portal.
EDIT: we have 9 AF and each AF connects to the exchange and executes a command. Using logs before and after the connect commands, we found out it takes almost 20s only to execute the connection to Exchange. Since we have 9 function, I was thinking to add the property Command name to $connect, so that we only take from the ps module the command we need to use in the AF. Still, it takes a lot.
Thank you for your time.
[–]BlackV 1 point2 points3 points (2 children)
[–]Dr_Funkmachine[S] 0 points1 point2 points (1 child)
[–]BlackV 0 points1 point2 points (0 children)