func CreateServicePrincipal(ctx context.Context, appID string) (graphrbac.ServicePrincipal, error) {
	spClient := getServicePrincipalsClient()
	return spClient.Create(ctx,
		graphrbac.ServicePrincipalCreateParameters{
			AppID:          to.StringPtr(appID),
			AccountEnabled: to.BoolPtr(true),
		})
}
CreateServicePrincipal creates a service principal associated with the specified application.
package graphrbac
import (
	"context"
	"fmt"
	"time"
	"github.com/Azure-Samples/azure-sdk-for-go-samples/internal/config"
	"github.com/Azure-Samples/azure-sdk-for-go-samples/internal/iam"
	"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
	"github.com/Azure/go-autorest/autorest"
	"github.com/Azure/go-autorest/autorest/date"
	"github.com/Azure/go-autorest/autorest/to"
	"github.com/marstr/randname"
)
func getServicePrincipalsClient() graphrbac.ServicePrincipalsClient {
	spClient := graphrbac.NewServicePrincipalsClient(config.TenantID())
	a, _ := iam.GetGraphAuthorizer()
	spClient.Authorizer = a
	spClient.AddToUserAgent(config.UserAgent())
	return spClient
}
func getApplicationsClient() graphrbac.ApplicationsClient {
	appClient := graphrbac.NewApplicationsClient(config.TenantID())
	a, _ := iam.GetGraphAuthorizer()
	appClient.Authorizer = a
	appClient.AddToUserAgent(config.UserAgent())
	return appClient
}
func getADGroupsClient() graphrbac.GroupsClient {
	groupsClient := graphrbac.NewGroupsClient(config.TenantID())
	a, _ := iam.GetGraphAuthorizer()
	groupsClient.Authorizer = a
	groupsClient.AddToUserAgent(config.UserAgent())
	return groupsClient
}