Create eventhub client using service principal but not from the environment varibales, using parameters, 1. Create Eventhub client options := getOptions(tenantId, clientId,secret) provider, _ := aad.NewJWTProvider(options) hub, err := eventhubGo.NewHub(namespace, name, provider)
2. The blow function provide the Options,
func getOptions(tenantId string, clientId, secrets string)
aad.JWTProviderOption {
return func(config *aad.TokenProviderConfiguration) error {
config.TenantID = tenantId
config.ClientID = clientId
config.ClientSecret = secrets
config.Env = &azure.PublicCloud
return nil
}
}
Is my approach is correct?