public/AzureAD/Connect-AzureADDelegatedTenant.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<#
    .EXTERNALHELP ..\..\Connect-AzureADDelegatedTenant-help.xml
#>

Function Connect-AzureADDelegatedTenant {
    [cmdletbinding()] Param (
        [Parameter(Mandatory,ValueFromPipelineByPropertyName)]
        [Alias('CustomerContextId')]
        [String] $TenantId
    )

    if (Test-IsConnectedToService 'AzureADv2' -ErrorAction SilentlyContinue) {
        Disconnect-AzureAD
    }

    Connect-AzureAD -TenantId $TenantId
}