Microsoft.Graph.API: Cmdlets for version 0.1.7

Removed cmdlets in version 0.1.7

  • Connect-MSGraphCertificate
  • Connect-MSGraphAppSecret
  • Connect-MSGraphDelegate

New cmdlets in version 0.1.7

  • Connect-MSGraph
  • Disconnect-MSGraph

Connect-MSGraph

From now one we have one cmdlet to log on Microsoft.Graph.API.

With 4 ParameterSets you can choose how to log on.

By selecting one of these parameters you log on with the following:

  • ClientSecret: Will log you on with a ClientSecret
  • Thumbprint: Will log you on with a Certificate
  • UserCredentials: Will log you on with basic authentication
  • RedirectUri: Will log you on with MFA Authentication

Connect-MSGraph – Example

Connecting with a ClientSecret:

$params = @{
    ApplicationID = 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
    ClientSecret  = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    TenantID      = 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
}
Connect-MSGraph @params -Verbose
You successfully logged in. We will keep you logged in until you close your Session.

Connecting with a Certificate:

$params = @{
    ApplicationID = 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
    Thumbprint    = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    TenantID      = 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
}
Connect-MSGraph @params -Verbose
You successfully logged in. We will keep you logged in until you close your Session.

Connecting with UserCredentials – Basic:

if (!($Cred)) {
    $cred = Get-Credential
}
Connect-MSGraph -UserCredentials $Cred -Tenant 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
 -AppID 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
You successfully logged in. We will keep you logged in until you close your Session.

Connecting with UserCredentials – MFA:

Connect-MSGraph -redirectUri 'msalXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX://auth'  -Tenant 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' -AppID 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
You successfully logged in. We will keep you logged in until you close your Session.

Disconnect-MSGraph

this cmdlet removes the saved logins from the scope.
When using the Parameter -Force you do not have to provide a confirmation.

disconnect-MSGraph – Example

Disconnect-MSGraph
You are logged out from Microsoft.Graph.API.

Cmdlets already available in older versions.

Cmdlets already available in an older version can be seen here:

Version 0.1.2-0.1.6

Leave a Reply

Your email address will not be published. Required fields are marked *