Connect-GraphService
SYNOPSIS
Connect to Microsoft Graph services.
SYNTAX
all (Default)
PSCredential
Connect-GraphService [-tenantID <String>] [-tenantName <String>] [-PSCredential <PSCredential>]
[<CommonParameters>]
clientID
Connect-GraphService [-tenantID <String>] [-tenantName <String>] [-clientID <String>] [-certName <String>]
[<CommonParameters>]
cert
Connect-GraphService [-tenantID <String>] [-tenantName <String>] [-cert] -certName <String>
[<CommonParameters>]
entra
Connect-GraphService [-tenantID <String>] [-tenantName <String>] [-entra] [-onderwijs] [-certName <String>]
[<CommonParameters>]
exo
Connect-GraphService [-tenantID <String>] [-tenantName <String>] [-exo] [-onderwijs] [-certName <String>]
[<CommonParameters>]
spo
Connect-GraphService [-tenantID <String>] [-tenantName <String>] [-spo] [-certName <String>]
[<CommonParameters>]
powerbi
Connect-GraphService [-tenantID <String>] [-tenantName <String>] [-powerBI] [-certName <String>]
[<CommonParameters>]
teams
Connect-GraphService [-tenantID <String>] [-tenantName <String>] [-teams] [-certName <String>]
[<CommonParameters>]
intune
Connect-GraphService [-tenantID <String>] [-tenantName <String>] [-intune] [-certName <String>]
[<CommonParameters>]
DESCRIPTION
The `Connect-MgGraphService` function establishes a connection to Microsoft Graph services. It supports various parameter sets for connecting to specific services such as Entra, Exchange Online, SharePoint Online, Power BI, Teams, and Intune. The function allows authentication using certificates, credentials retrieved from PasswordState or a PSCredential object.
EXAMPLES
EXAMPLE 1
Establishes a connection to Microsoft Entra using the default tenant configuration.
EXAMPLE 2
Connects to Exchange Online using the specified certificate.
EXAMPLE 3
Connect-GraphService -spo -tenantID "12345678-1234-1234-1234-123456789abc" -tenantName "customtenant.onmicrosoft.com"
Connects to SharePoint Online using the specified tenant ID and tenant name.
EXAMPLE 4
Connects to Microsoft Graph using the specified client ID and certificate.
PARAMETERS
-tenantID
The tenant ID of the Azure Active Directory to connect to. Defaults to a predefined tenant ID if not specified.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-tenantName
The tenant name of the Azure Active Directory to connect to. Defaults to a predefined tenant name if not specified.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PSCredential
A PSCredential object containing the username (client id) and password (client secret) for authentication.
Type: PSCredential
Parameter Sets: PSCredential
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-clientID
The client ID used for authentication.
Type: String
Parameter Sets: clientID
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-cert
A switch parameter that, when specified, uses a certificate for authentication.
Type: SwitchParameter
Parameter Sets: cert
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-entra
A switch parameter that, when specified, connects to Microsoft Entra.
Type: SwitchParameter
Parameter Sets: entra
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-exo
A switch parameter that, when specified, connects to Exchange Online.
Type: SwitchParameter
Parameter Sets: exo
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-spo
A switch parameter that, when specified, connects to SharePoint Online.
Type: SwitchParameter
Parameter Sets: spo
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-powerBI
A switch parameter that, when specified, connects to Power BI.
Type: SwitchParameter
Parameter Sets: powerbi
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-teams
A switch parameter that, when specified, connects to Microsoft Teams.
Type: SwitchParameter
Parameter Sets: teams
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-intune
A switch parameter that, when specified, connects to Microsoft Intune.
Type: SwitchParameter
Parameter Sets: intune
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-onderwijs
A switch parameter that, when specified, uses the "onderwijs" tenant configuration.
Type: SwitchParameter
Parameter Sets: entra, exo
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-certName
The friendly name of the certificate to use for authentication.
Type: String
Parameter Sets: clientID, entra, exo, spo, powerbi, teams, intune
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: String
Parameter Sets: cert
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.