共用方式為


Set-MgEnvironment

Sets a Microsoft Graph environment to the settings file.

Syntax

Set-MgEnvironment
   [-Name] <String>
   [[-AzureADEndpoint] <String>]
   [[-GraphEndpoint] <String>]
   [-ProgressAction <ActionPreference>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Sets a Microsoft Graph environment to the settings file.

Examples

Example 1: Set environment for the current session

PS C:\> Set-MgEnvironment -GraphEndpoint "https://canary.graph.microsoft.com" -AzureADEndpoint "https://login.microsoftonline.com"

Sets the environment for the current session.

Parameters

-AzureADEndpoint

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

Type:String
Aliases:AzureADUrl
Position:1
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-GraphEndpoint

The service root endpoint for Microsoft Graph.

Type:String
Aliases:GraphUrl
Position:2
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

The environment name.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ProgressAction

{{ Fill ProgressAction Description }}

Type:ActionPreference
Aliases:proga
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.String

Outputs

Microsoft.Graph.PowerShell.Authentication.Models.GraphEnvironment