New-MgmtGraphDomain
MgmtGraph: Provisions a new Microsoft Graph domain
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Identity.DirectoryManagement
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$Identity
)
Process {
try {
$params = @{
'Id' = $Identity
'Confirm' = $false
'ErrorAction' = 'Stop'
}
$domain = New-MgDomain @params
$result = [PSCustomObject]@{
DomainName = $domain.Id
IsVerified = $domain.IsVerified
Status = "DomainAdded"
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
catch {
throw
}
}Specifies the name of the domain to add (e.g., "contoso.com").