I am new to powershell and dbatools and currently testing a script on an ec2 built-in Microsoft SQL Server 2022. This script should simply create full and differential backup jobs of all databases to a specified path and also pushes backups to a S3 bucket.
However when I run basic dbatools commands I get below warning and it won`t pull any databases.
WARNING: [Get-DbaDatabase] Failure | The certificate chain was issued by an authority that is not trusted
I`ve read setting "TrustServerCertificate" to True fixes the problem in the connection string, but how to bypass this issue when running on a script in powershell with dbatools as it throws an error when adding -TrustServerCertificate to any dbatools command.