The cause of this issue may be the account you are using to run the script doesn't have the required permission.
If this account isn't the owner of the security group, in order to use the parameter BypassSecurityGroupManagerCheck to add members to this security group, the account must be assigned Security Group Creation and Membership role.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.