Is there a way to setup power platform environment with the database's security group from CLI? I didn't see any command on pac cli nor in powershell side.
Yes you can 😁
The Powerapps administration powershell module has the following command:
Which takes as inputs:
[-DisplayName <String>] -LocationName <String> -EnvironmentSku <String> [-ProvisionDatabase] [-CurrencyName <String>] [-LanguageName <String>] [-Templates <String>] [-SecurityGroupId <String>] [-DomainName <String>] [-WaitUntilFinished <Boolean>] [-ApiVersion <String>] [<CommonParameters>]
so you can actually pas the Azure security group ID!
Not sure if you can actually reset and assign a security group in one call, but you have options in that module to add security groups. It is also possible to do via REST api, so there are some options, might require combining some actions.