Skip to main content

Connect-MSGraphMail

SYNOPSIS​

Retrieves an access token for the Microsoft Graph API.

SYNTAX​

Connect​

Connect-MSGraphMail -ApplicationID <String> -ApplicationSecret <String> [-Scope <Uri>] [-TenantID <String>]
[<CommonParameters>]

Reconnect​

Connect-MSGraphMail [-Reconnect] [<CommonParameters>]

DESCRIPTION​

Uses the provided application id and secret to retrieve an access token for the Microsoft Graph API. If the token has expired, a new one will be retrieved. If the token has not expired, the existing token will be returned. If the token has expired, but the refresh token has not, the token will be refreshed. If the token has expired, and the refresh token has expired, a new token will be retrieved.

EXAMPLES​

PARAMETERS​

-ApplicationID​

Azure AD application id.

Type: String
Parameter Sets: Connect
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ApplicationSecret​

Azure AD application secret.

Type: String
Parameter Sets: Connect
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Scope​

Graph permission scope.

Type: Uri
Parameter Sets: Connect
Aliases:

Required: False
Position: Named
Default value: [uri]'https://graph.microsoft.com/.default'
Accept pipeline input: False
Accept wildcard characters: False

-TenantID​

Tenant ID.

Type: String
Parameter Sets: Connect
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Reconnect​

Reconnect mode

Type: SwitchParameter
Parameter Sets: Reconnect
Aliases:

Required: True
Position: Named
Default value: False
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.

INPUTS​

OUTPUTS​

A powershell object containing the response.​

NOTES​