[Bug]New-DbaAvailabilityGroup does not assign permissions for service account to connect to Endpoint #5341
Closed
Description
Lines 585-589 look like they should be assigning permissions, but the permissions are missing upon creating a new Always On group.
Line 437 outputs a progress message that it is granting permissions to the endpoint, but there are no endpoint permissions granted.
Personally, I would recommend adding the code for endpoint permissions in Add-DbaAgReplica after line 185 where AvailabilityGroup permissions are granted. I've tried adding the endpoint and permissions prior to calling New-DbaAvailabilityGroup but that doesn't turn out correctly. I think it needs to happen as part of the replica addition - which is probably why the AvailabilityGroup permissions are granted at that location.