internal/functions/get-networkdomain.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
<# .SYNOPSIS Get the network domain from the e-mail .DESCRIPTION Get the network domain provider (Azure) for the e-mail / user .PARAMETER Email The e-mail that you want to retrieve the provider for .EXAMPLE PS C:\> Get-NetworkDomain -Email "Claire@contoso.com" This will return the provider registered with the "Claire@contoso.com" e-mail address. .NOTES Author: Rasmus Andersen (@ITRasmus) Author: Mötz Jensen (@Splaxi) #> function Get-NetworkDomain { [CmdletBinding()] [OutputType('System.String')] param( [Parameter(Mandatory = $true, Position = 1)] [string]$Email ) $tenant = Get-TenantFromEmail $Email $provider = Get-InstanceIdentityProvider $canonicalIdentityProvider = Get-CanonicalIdentityProvider if ($Provider.ToLower().Contains($Tenant.ToLower()) -eq $True) { $canonicalIdentityProvider } else { "$canonicalIdentityProvider$Tenant" } } |