Documentation
¶
Overview ¶
Package groupmembership synchronises email addresses to groups within an Azure AD tenancy.
Requirements ¶
In order to synchronise group membership within Azure AD, you'll need to ensure you have an App Registration with the following API Permissions:
- GroupMember.ReadWrite.All
- User.ReadWrite.All
You will also need credentials for the App Registration to be configured appropriately in the environment using one of the default authentication mechanisms.
Index ¶
Examples ¶
Constants ¶
const GroupName gosync.ConfigKey = "group_name"
GroupName is the name of your group within Azure AD.
Variables ¶
var ErrNoResults = errors.New("no results found")
ErrNoResults is returned when the query resulted in no results and some were expected.
var ErrTooManyResults = errors.New("too many results in response")
ErrTooManyResults is returned when the query resulted in more results than expected.
Functions ¶
func WithClient ¶ added in v0.14.1
func WithClient(client iClient) func(u *GroupMembership)
WithClient provides a mechanism to pass a custom client to the adapter.
Types ¶
type GroupMembership ¶
func Init ¶
func Init( _ context.Context, config map[gosync.ConfigKey]string, configFns ...gosync.ConfigFn[*GroupMembership], ) (*GroupMembership, error)
Init creates a new adapter. It expects a single configuration entry. Required config:
- groupmembership.GroupName: the name of the AD group to sync members to.
Example ¶
package main import ( "context" "log" gosync "github.com/ovotech/go-sync" "github.com/ovotech/go-sync/adapters/azuread/groupmembership" ) func main() { adapter, err := groupmembership.Init(context.TODO(), map[gosync.ConfigKey]string{ groupmembership.GroupName: "My Azure AD group", }) if err != nil { log.Fatal(err) } gosync.New(adapter) }
Output:
func (*GroupMembership) Add ¶
func (g *GroupMembership) Add(ctx context.Context, members []string) error
Add will add the given members to the group's member list.