Skip to content

/flags/microsoft-graph/connect-mggraph-nowelcome

Connect-MgGraph -NoWelcome: hide the Welcome to Microsoft Graph! message

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
Microsoft Graph PowerShell
command
Connect-MgGraph
flag
-NoWelcome
default
off (the welcome message is printed after every successful connection)

Connect-MgGraph -NoWelcome connects to Microsoft Graph PowerShell without printing the welcome message. Without it, every successful connection writes "Welcome to Microsoft Graph!" followed by links to the SDK documentation and the note "NOTE: You can use the -NoWelcome parameter to suppress this message." The reference describes the switch simply as "Hides the welcome message." It is meant for scripts, scheduled jobs and logs.

powershell
Connect-MgGraph -Scopes "User.Read.All" -NoWelcome
Connect-MgGraph -ClientId $appId -TenantId $tenantId -CertificateThumbprint $thumb -NoWelcome
Get-MgContext | Select-Object Account, TenantId, Scopes, AuthType

The switch in the module

-NoWelcome is a switch parameter available in every parameter set of the authentication cmdlet (interactive, device code, certificate, secret, managed identity, access token), so it combines with any sign-in method. Because it is a switch with default False, -NoWelcome alone is enough; unlike Exchange's -ShowBanner, no colon syntax is needed. Checked offline in Windows PowerShell 5.1 with Microsoft.Graph.Authentication 2.41.2, by listing the module's cmdlets that have it:

powershell
Import-Module Microsoft.Graph.Authentication
(Get-Module Microsoft.Graph.Authentication).ExportedCommands.Values |
  Where-Object { $_.Parameters.ContainsKey('NoWelcome') } | ForEach-Object {
    $p = $_.Parameters['NoWelcome']
    '{0}: {1}, in all parameter sets: {2}' -f $_.Name, $p.ParameterType.Name, ($p.ParameterSets.Keys -contains '__AllParameterSets')
  }

Output

Connect-MgGraph: SwitchParameter, in all parameter sets: True
Connect-Graph: SwitchParameter, in all parameter sets: True

Quiet scripts

ServiceHide the connection message
Microsoft GraphConnect-MgGraph -NoWelcome
Exchange OnlineConnect-ExchangeOnline -ShowBanner:$false
Security & ComplianceConnect-IPPSSession -ShowBanner:$false

Pitfalls

  • Scopes still matter. Hiding the message does not change the permissions; request the right scopes with -Scopes (Connect-MgGraph -Scopes).
  • Confirm the session. Without the message, Get-MgContext (Get-MgContext) is the way to see who is connected. Cmdlets called before a connection fail with Authentication needed. Please call Connect-MgGraph.
  • Alias. Connect-Graph, listed in the check above, is an alias of Connect-MgGraph and takes the same switch.

FAQ

Does -NoWelcome hide errors?

No. It only suppresses the welcome text. Sign-in failures and consent errors are still written to the error stream.

How do I check the connection without the message?

Run Get-MgContext. It shows the account, tenant, scopes and authentication type of the current session, and returns nothing when you are not connected.

Is there an equivalent for Exchange Online?

Yes. Connect-ExchangeOnline -ShowBanner:$false hides the Exchange banner; note the colon syntax, because ShowBanner is a switch that is on by default.

Sources