Share via


Add-MgEnvironment

Adds Microsoft Graph environment to the settings file.

Syntax

Default (Default)

Add-MgEnvironment
    [-Name] <String>
    [-AzureADEndpoint] <String>
    [-GraphEndpoint] <String>
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Adds Microsoft Graph environment to the settings file.

Examples

Example 1: Add user defined environment

PS C:\> Add-MgEnvironment -Name "Canary" -GraphEndpoint "https://canary.graph.microsoft.com" -AzureADEndpoint "https://login.microsoftonline.com"
Name     AzureADEndpoint                      GraphEndpoint                 Type
----     ---------------                      -------------                 ----
Canary    https://login.microsoftonline.com   https://microsoftgraph.com User-defined

Adds user defined environment.

Parameters

-AzureADEndpoint

The base URL for Azure AD endpoint to get access tokens for Microsoft Graph endpoint.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureADUrl

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-GraphEndpoint

The service root endpoint for Microsoft Graph.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:GraphUrl

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

The environment name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

System.String

Outputs

Microsoft.Graph.PowerShell.Authentication.Models.GraphEnvironment