Set-MgmtGraphEnvironment
MgmtGraph: Updates endpoints for a registered Microsoft Graph cloud environment
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Authentication
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)]
[string]$Name,
[string]$AzureADEndpoint,
[string]$GraphEndpoint
)
Process {
try {
$params = @{
'Name' = $Name
'Confirm' = $false
'ErrorAction' = 'Stop'
}
if ($AzureADEndpoint) { $params.Add('AzureADEndpoint', $AzureADEndpoint) }
if ($GraphEndpoint) { $params.Add('GraphEndpoint', $GraphEndpoint) }
if ($params.Count -gt 3) {
$env = Set-MgEnvironment @params
$result = [PSCustomObject]@{
Name = $env.Name
AzureADEndpoint = $env.AzureADEndpoint
GraphEndpoint = $env.GraphEndpoint
Action = "EnvironmentUpdated"
Status = "Success"
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
else {
Write-Warning "No properties specified to update for environment '$Name'."
}
}
catch {
throw
}
}Specifies the name of the environment to update.
Optional. Specifies the new Azure AD endpoint URL.
Optional. Specifies the new Microsoft Graph endpoint URL.